[R] syntax to restrict coefficient in lm()
Gabor Grothendieck
ggrothendieck at gmail.com
Sun Oct 5 04:53:01 CEST 2008
Frankly, I would do it Duncan's way as that represents it simply as
a linear model but if you insist you could use nls.
nls(dY ~ a0 - a1 * (Y - b1*X) + b0*dX, DF, start = whatever)
On Sat, Oct 4, 2008 at 4:06 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> 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.
>
> ______________________________________________
> 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