[R] regression slope
Douglas Bates
bates at stat.wisc.edu
Wed Jul 21 12:30:46 CEST 2004
>>>On Tue, 2004-07-20 at 17:02, Avril Coghlan wrote:
>>>
>>>
>>>>Hello,
>>>>
>>>> I'm a newcomer to R so please
>>>>forgive me if this is a silly question.
>>>>
>>>>It's that I have a linear regression:
>>>>fm <- lm (x ~ y)
>>>>and I want to test whether the
>>>>slope of the regression is significantly
>>>>less than 1. How can I do this in R?
Another way of doing this is to use offset(x) in the model formula
summary(fm <- lm(y ~ x + offset(x)))
(I know you wrote lm(x ~ y) but I find I have to think of it as lm(y ~
x) - old habits are hard to break.)
If you want to test for "slope is significantly less than 2" you would use
summary(fm <- lm(y ~ x + offset(2*x)))
More information about the R-help
mailing list