Skip to content
Prev 165526 / 398506 Next

Implementing a linear restriction in lm()

If it is only for a single coefficient you can just subtract your test-value
from the coefficient and divide by the coefficient's standard-error, which
gives you a t-value for the test (see Greene 2006). 

Otherwise, lookup "linear.hypothesis" in the "car" library.

Cheers,
Daniel

-------------------------
cuncta stricte discussurus
-------------------------

-----Urspr?ngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Ravi Varadhan
Gesendet: Thursday, December 25, 2008 11:40 AM
An: Serguei Kaniovski
Cc: r-help at stat.math.ethz.ch
Betreff: Re: [R] Implementing a linear restriction in lm()

Hi,

You could use the "offset" argument in lm().  Here is an example:

set.seed(123)
x <- runif(50)
beta <- 1
y <- 2 + beta*x + rnorm(50)

model1 <- lm (y ~ x)
model2 <- lm (y ~ 1, offset=x)

anova(model2, model1)

Best,
Ravi.
____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology School of Medicine Johns
Hopkins University

Ph. (410) 502-2619
email: rvaradhan at jhmi.edu


----- Original Message -----
From: Serguei Kaniovski <Serguei.Kaniovski at wifo.ac.at>
Date: Wednesday, December 24, 2008 9:39 pm
Subject: [R] Implementing a linear restriction in lm()
To: r-help at stat.math.ethz.ch
______________________________________________
R-help at r-project.org 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.