[R] how to fix coefficients in regression
jwiley.psych at gmail.com
Fri Jul 22 05:39:55 CEST 2011
It is slightly clunky but:
mod2 <- glm(Y ~ offset(I(1.3 * X1)) + X2, family = "binomial")
should do the trick. See ?offset for details.
On Thu, Jul 21, 2011 at 7:42 PM, Johan Jackson
<johan.h.jackson at gmail.com> wrote:
> Hello all,
> I am using a glm() and would like to fix one of the regression coefficients
> to be a particular value and see what happens to the fit of the model. E.g.:
> mod1 <- glm(Y ~ X1 + X2,family='binomial')
> mod2 <- glm(Y~[fixed to 1.3]X1 + X2,family='binomial')
> The beta for X1 is freely estimated in mod1 but is constrained to be 1.3 in
> mod2. Is there a way to do this?
> Thank you in advance,
> [[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.
Ph.D. Student, Health Psychology
University of California, Los Angeles
More information about the R-help