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)
Arguments
x: numeric vector
k: integer vector of lagged variables to create
id: optional identification number for each subject
Returns
numeric vector or matrix of the lagged variable(s)