L | R Documentation |
Creates lagged variables for use with bayesGAM
, including the functionality
to create lags for each specified subject if desired. The input data must be pre-
sorted according by time, and within each subject id if specified.
L(x, k = 1, id = NULL)
x |
numeric vector |
k |
integer vector of lagged variables to create |
id |
optional identification number for each subject |
numeric vector or matrix of the lagged variable(s)
Zeileis A (2019). dynlm: Dynamic Linear Regression. R package version 0.3-6
x <- rnorm(20) id <- rep(1:4, each=5) L(x, 1:2, id) # autoregressive ar.ols(lh, demean = FALSE, intercept=TRUE, order=1) f <- bayesGAM(lh ~ L(lh), family=gaussian) coef(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.