[R] syntax to restrict coefficient in lm()

Mark Leeds markleeds at verizon.net
Sat Oct 4 22:30:55 CEST 2008


Werner: what you want done is more easily done using a time series
framework. I think there are examples for doing what you want to in the urca
package or , if not there, then in the associated book of Bernhard Pfaff.
If you send your question to R-Sig-Finance , that may illicit other ideas
besides Duncan's and mine.


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Duncan Murdoch
Sent: Saturday, October 04, 2008 4:06 PM
To: Werner Wernersen
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] syntax to restrict coefficient in lm()

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