two options are to use an offset term or the linear.hypothesis()
function from package car, e.g.,
y <- rnorm(100, 2 - 1 * (x <- runif(100, -3, 3)), 3)
fit0 <- lm(y ~ 1 + offset(-x))
fit1 <- lm(y ~ x)
anova(fit0, fit1)
library(car)
linear.hypothesis(fit1, c("x = -1"))
I hope it he
Hello
Instead of testing against 0 i would like to test regression slopes against -1.
Any idea if there's an R script (package?) available.
Thanks for any hint.
Cheers
Lukas
°°°
Lukas Indermaur, PhD student
eawag / Swiss Federal Institute of Aquatic Science and Technology
ECO - Depart
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Manuel
> Gutierrez
> Sent: Thursday, February 10, 2005 1:36 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] testing slopes different than a given value
>
In a multiple linear regression with two independent
variables is there any function in R to test for the
coefficients being different than some given values?
Example:
x1<-rnorm(100)
x2<-rnorm(100)
y<-3+0.6*x1+0.3*x2
lm(y~x1+x2)
Obtain a test for the coefficients for x1 being
different than 0.6 a