Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Lagged effects between variables

12 views
Skip to first unread message

Ruby Ji

unread,
Dec 12, 2024, 6:32:47 PM12/12/24
to R-inla discussion group
Dear INLA experts,

I have developed a model that considers the effect of "y" on "e". The model formula is as follows:

form <- y ~ -1 + y.b0 + e.b0 +
 
  f(year.y, model="rw1", scale.model=TRUE, constr=TRUE) +
  f(sy, model=spde) +
 
  f(year.e, model="rw1", scale.model=TRUE, constr=TRUE) +
  f(se, model=spde) +
  f(year.ey, copy="year.y", fixed=FALSE) +
  f(sey, copy="sy", same.as="
year.ey", fixed=FALSE) 

Now, I want to explore the lagged effect of "y" on "e". That means, I am interested in determining whether "y" from the previous year could impact "e" in the current year. Is it possible to model this effect?

Thanks,
Ruby
 

Håvard Rue

unread,
Dec 13, 2024, 1:50:08 AM12/13/24
to Ruby Ji, R-inla discussion group
you can have

y ~ y

you just need to index the rhs differently, like

y ~ yy

data=data.frame(y,yy=c(0,y[-length(y)]))
> --
> You received this message because you are subscribed to the Google Groups "R-
> inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to r-inla-discussion...@googlegroups.com.
> To view this discussion, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/ab450369-196d-4930-b189-85b7f012a0c1n%40googlegroups.com
> .

--
Håvard Rue
hr...@r-inla.org

Reply all
Reply to author
Forward
0 new messages