[R] testing slopes
Dimitris Rizopoulos
Dimitris.Rizopoulos at med.kuleuven.be
Tue Feb 20 18:07:18 CET 2007
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 helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
Quoting Indermaur Lukas <Lukas.Indermaur at eawag.ch>:
> 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 - Department of Aquatic Ecology
> Überlandstrasse 133
> CH-8600 Dübendorf
> Switzerland
>
> Phone: +41 (0) 71 220 38 25
> Fax : +41 (0) 44 823 53 15
> Email: lukas.indermaur at eawag.ch
> www.lukasindermaur.ch
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list