[R] Multiple linear regression with constraint (imposition)
David Winsemius
dwinsemius at comcast.net
Sat Oct 31 01:02:07 CET 2009
On Oct 30, 2009, at 7:47 PM, CE.KA wrote:
>
> Sorry there was a mistake:
I could not see what was different?
>
> Hi R users
>
> I want to do a multiple linear regression with R
>
> With a normal model (Y=Cste+A1*X1+A2*X2) the program would be
> lm(Y~X1+X2)
>
> My model is Y=Cste+A1*X1+A2*X2 with the constraint A1=-A2
> What is the program for such a model?
>
Try calculating X3= X2-X1 and estimate the shared parameter with:
lm(y ~ X3)
or instead;
lm(Y ~ I(X2 - X1) )
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list