[R] syntax to restrict coefficient in lm()

Duncan Murdoch murdoch at stats.uwo.ca
Sat Oct 4 22:06:22 CEST 2008


On 04/10/2008 3:29 PM, Werner Wernersen wrote:
> Hi,
> 
> I would like to estimate an error correction model with lm() but I don't find the correct syntax for that.
> The model (leaving out the time indices) looks like:
> 
> dY = a0 - a1 * (Y - b1*X) + b0*dX + e
> 
> the problem is the term - a1 * (Y - b1*X). How can I restrict a1 to be the same for both Y and -b1*X ?

lm() fits linear models, and that's not parametrized as a linear model. 
  It is equivalent to this linear model:

dY = a0 + a1 * Y + a2 * X + b0 * dX + e

where I have changed the sign of a1, and replaced a1*b1 with a2.  You 
can specify that model in lm() as

dY ~ Y + X + dX

Duncan Murdoch

> 
> Thanks for considering my question!
> 
> All the best,
>   Werner
> 
> 
> 
> 
> 
> ______________________________________________
> R-help at r-project.org 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