[R] Setting constraints in the glm package

Viechtbauer Wolfgang (STAT) wolfgang.viechtbauer at maastrichtuniversity.nl
Tue Oct 26 16:50:57 CEST 2010


The constraint b1=b2 in a model such as b0 + b1 x1 + b2 x2 + b3 x3 implies that b0 + b1 (x1 + x2) + b3 x3, so just add x1 and x2 (call this x12) and fit the model b0 + b1 x12 + b3 x3 and you have imposed the constraint that b1=b2. To impose the constraint that b3=0, just fit the model without variable x3 in it.

Best,

--
Wolfgang Viechtbauer
Department of Methodology and Statistics
School for Public Health and Primary Care
Maastricht University, P.O. Box 616
6200 MD Maastricht, The Netherlands
Tel: +31 (43) 388-2277
Fax: +31 (43) 361-8388
Web: http://www.wvbauer.com


----Original Message----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of David Smith Sent:
Tuesday, October 26, 2010 12:24 To: r-help at r-project.org
Subject: [R] Setting constraints in the glm package

> Hi,
>
> I would like to set a constraint on the fixed effect estimates in a
> GLM model, such as b1=b2. Is this possible in the glm package?
> Similarly I would like to set some to equal zero too. I have tried
> searching the information with this package, but I can't find
> anything for this.
>
> Thanks in advance for any help!
>
> David



More information about the R-help mailing list