[R] coefficient constraints

chao gai chaogai at duineveld.demon.nl
Wed Nov 1 17:09:17 CET 2006


Hi,

Isn't this a complex way to calculate:
mean(y-x1-x2)

Yours,
Kees

On Wednesday 01 November 2006 02:13, John Fox wrote:
> Dear John,
>
> You can subtract the variables in question from the left-hand-side of the
> model [e.g., lm(y - x1 - x2 ~ 1)], or use the offset argument to lm [e.g.,
> lm(y ~ 1, offset=x1 + x2)], or use offset() in the model formula [e.g.,
> lm(y ~ offset(x1 + x2)]. All of these options are equivalent.
>
> I hope this helps,
>  John
>
> --------------------------------
> John Fox
> Department of Sociology
> McMaster University
> Hamilton, Ontario
> Canada L8S 4M4
> 905-525-9140x23604
> http://socserv.mcmaster.ca/jfox
> --------------------------------
>
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch
> > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of John Gauss
> > Sent: Tuesday, October 31, 2006 7:28 PM
> > To: r-help at stat.math.ethz.ch
> > Subject: [R] coefficient constraints
> >
> > Hi,
> >
> > Thank you for your help.  I'm trying to constrain the
> > coefficients on a linear regression model, <-lm(...), to all
> > equal one, except for the intercept.  I've searched
> > help(glm), help(model.fit), etc. but I can not find where to
> > add the constraint.  Your help would be greatly appreciated.
> >
> > Thanks.
> >
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
>
> ______________________________________________
> 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.



More information about the R-help mailing list