Creates cross-basis using natural splines for regression in DLIM
Arguments
- x
a numeric time series vector of length n or matrix of lagged exposures (columns) for n individuals (rows)
- M
vector of length n containing modifier values
- L
a numeric vector of length 1 containing the number of lag terms. This is required if
x
is vector, and is not used ifx
is a matrix.- argmod
a list: $fun is the spline function for the modifier ("ps" or "cr" to penalize), $arg is a list of arguments for the spline function (must be named by argument), $df is the degrees of freedom, $sp is optional smoothing parameter
- arglag
a list: $fun is the spline function for the lag ("ps" or "cr" to penalize), $arg is a list of arguments for the spline function (must be named by argument), $df is the degrees of freedom, $sp is optional smoothing parameter
- model_type
"linear" for a DLIM with linear interaction, "quadratic" for a DLIM with quadratic interaction, "standard" for a DLIM with splines
Value
This function returns a list of 5 or 6 elements:
- cb
cross-basis (matrix)
- B_lag
lag basis (basis matrix)
- B_mod
modifier basis (basis matrix)
- df_l
lag degrees of freedom (numeric)
- df_m
modifier degrees of freedom (numeric)
- L
number of lags (numeric)
- Slist
lag and modifier penalty matrices, if penalizing (list)
See also
Type vignette('dlimOverview')
for a detailed description.