[R] significantly different from one (not zero) using lm
Achim.Zeileis at uibk.ac.at
Wed May 1 10:32:08 CEST 2013
On Wed, 1 May 2013, Elaine Kuo wrote:
> I am work with a linear regression model:
> y=ax+b with the function of lm.
> y= observed migration distance of butterflies
> x= predicted migration distance of butterflies
> Usually the result will show
> if the linear term a is significantly different from zero based on the
> Now I would like to test if the linear term is significantly different from
> (because I want to know if the regression line (y=ax+b) is significantly
> from the line with the linear term =1 and the intercept =0)
In addition to the solutions suggested by Paul and Thomas, you could use
linearHypothesis() from the "car" package. A (non-sensical) example using
the cars dataset is:
m <- lm(dist ~ speed, data = cars)
linearHypothesis(m, c("(Intercept) = 0", "speed = 1"))
The output is equivalent to the anova() for the offset model that Thomas
m0 <- lm(dist ~ 0 + offset(1 * speed), data = cars)
> Please kindly advise if it is possible
> to adjust some default parameters in the function to achieve the goal.
> Thank you.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help