Re: [R] How to test if a slope is different than 1?

2012-04-26 Thread Mark Na
Hi Greg and others, Thanks for your replies. Okay, I'm convinced that the offset is the best approach and wonder if you might have a quick look at what I did. Here's the original model containing the slope (0.56) that I'd like to test if it's different from 1.0 model1 -

Re: [R] How to test if a slope is different than 1?

2012-04-26 Thread Greg Snow
Yes, you can see that in the new model the slope is now 1- the old slope, so it is measuring difference from 1. Since it is significant that means the slope is significantly different from 1. To test the null that slope = 0.5 just change the offset to offset(0.5*log(data$SIZE,10)) To save

Re: [R] How to test if a slope is different than 1?

2012-04-25 Thread Greg Snow
Doesn't the p-value from using offset work for you? if you really need a p-value. The confint method is a quick and easy way to see if it is significantly different from 1 (see Rolf's response), but does not provide an exact p-value. I guess you could do confidence intervals at different

Re: [R] How to test if a slope is different than 1?

2012-04-25 Thread Walmes Zeviani
You can also run two nls() models, one under h0 restriction, other under no restriction or h1, and compare them (if they are nested) by likelihood ratio test using anova() method, look x1 - seq(0,10,l=15) x2 - runif(x1) set.seed(1) y - x1+0.5*x2+rnorm(x1,0,0.01) nls.h0 - nls(y~b0+x1+b2*x2,

Re: [R] How to test if a slope is different than 1?

2012-04-24 Thread Mark Na
Hi Greg. Thanks for your reply. Do you know if there is a way to use the confint function to get a p-value on this test? Thanks, Mark On Mon, Apr 23, 2012 at 3:10 PM, Greg Snow 538...@gmail.com wrote: One option is to subtract the continuous variable from y before doing the regression (this

Re: [R] How to test if a slope is different than 1?

2012-04-24 Thread Rolf Turner
On 25/04/12 02:17, Mark Na wrote: Hi Greg. Thanks for your reply. Do you know if there is a way to use the confint function to get a p-value on this test? In general it is at least *roughly* true that one rejects H_0: theta = theta_0 vs. H_a: theta != theta_0 at significance level alpha if and

[R] How to test if a slope is different than 1?

2012-04-23 Thread Mark Na
Dear R-helpers, I would like to test if the slope corresponding to a continuous variable in my model (summary below) is different than one. I would appreciate any ideas for how I could do this in R, after having specified and run this model? Many thanks, Mark Na Call: lm(formula =

Re: [R] How to test if a slope is different than 1?

2012-04-23 Thread Greg Snow
One option is to subtract the continuous variable from y before doing the regression (this works with any regression package/function). The probably better way in R is to use the 'offset' function: formula = I(log(data$AB.obs + 1, 10)-log(data$SIZE,10)) ~ log(data$SIZE, 10) + data$Y formula =