Re: [R] regression slope

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Wed 21 Jul 2004 - 20:30:46 EST

>>>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)))



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 21 21:02:21 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:09 EST