If x is a zoo object note that zoo (and therefore dyn) allows the more compact
form lag(x, -(1:2)) so if we write:
mod.eq <- x ~ lag(x, -(1:2))
then mod.eq[[3]][[3]] is the vector -(1:2) or if you like you can define
Lag <- function(x, k) lag(x, -k) in which case you can write it:
mod.eq <- x ~
On Fri, May 2, 2008 at 1:35 PM, Kerpel, John <[EMAIL PROTECTED]> wrote:
> Hi folks!
>
>
>
> How do I extract lags from a formula? An example:
>
>
>
> mod.eq<-formula(x~lag(x,-1)+lag(x,-2))
>
> > mod.eq
>
> x ~ lag(x, -1) + lag(x, -2)
>
> > mod.eq[1]
>
> "~"()
>
> > mod.eq[2]
>
> x()
>
> >
Hi folks!
How do I extract lags from a formula? An example:
mod.eq<-formula(x~lag(x,-1)+lag(x,-2))
> mod.eq
x ~ lag(x, -1) + lag(x, -2)
> mod.eq[1]
"~"()
> mod.eq[2]
x()
> mod.eq[3]
lag(x, -1) + lag(x, -2)()
I'm trying to extract the lags into a vector that would be simply [1,2
3 matches
Mail list logo