Skip to content
Prev 25631 / 398502 Next

simple test on slope of lm()

Hello,

To test the slope of your linear model against an arbitrary value, you can 
use lm() directly with a little trick. Let b1 be the value of the slope you 
want to test your model against, then use lm(y-b1*x~x). The significance 
test of the slope for this lm model gives the answer you need.

 > x <- rnorm(10)
 > y <- 2*x + rnorm(10)
 > lm(y~x)
 > lm(y-2*x~x)

Hope this helped,

Yves Brostaux.
At 04:01 23/11/02, you wrote: