[R] linear model with coefficient constraints
Rnewb
oneoff1234 at yahoo.com
Tue Oct 6 15:46:11 CEST 2009
I would like to perform a regression like the one below:
lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data)
However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and
c1+c2+c3 = C, where A, B, and C are positive constants. So there are two
extra degrees of freedom, and R handles this by producing NA for two of the
coefficients. Instead, I would prefer to remove the degrees of freedom by
forcing constraints on the coefficients produced by the model.
Specifically, I want
coeff(b1) + coeff(b2) + coeff(b3) = coeff(c1) + coeff(c2) + coeff(c3) = 0.
I could accomplish this by writing code to suitably shift the coefficients
after performing the basic regression above, but I'm hoping there's a better
way. Is there?
thanks,
Rnewb
--
View this message in context: http://www.nabble.com/linear-model-with-coefficient-constraints-tp25769020p25769020.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list