dlim | R Documentation |
Fit distributed lag interaction model
dlim(
y,
x,
modifiers,
z = NULL,
df_m,
df_l,
penalize = TRUE,
pen_fn = "ps",
mod_args = NULL,
lag_args = NULL,
fit_fn = "gam",
model_type = "standard",
ID = NULL,
...
)
y |
vector of response values (class " |
x |
matrix of exposure history (columns) for individuals (rows) (class " |
modifiers |
vector of modifying values (class " |
z |
matrix of covariates, not including the modifier (class " |
df_m |
degrees of freedom for modifier basis (class " |
df_l |
degrees of freedom for exposure time basis (class " |
penalize |
|
pen_fn |
if penalizing, can specify "ps" for penalized B-splines or "cr" for cubic regression splines with penalties on second derivatives |
mod_args |
a list of additional arguments for the spline function (must be named by argument) |
lag_args |
a list of additional arguments for the spline function (must be named by argument) |
fit_fn |
specify "gam" to use the |
model_type |
"linear" for a DLIM with linear interaction, "quadratic" for a DLIM with quadratic interaction, "standard" for a DLIM with splines (class " |
ID |
group identifier for random intercept, only supported for penalized models |
... |
Other arguments to pass to model fitting function |
This function returns a list that is an object of class "dlim
" with the following components
cb |
cross-basis (class " |
fit |
model object (class " |
modifiers |
modifying values (class " |
call |
model call |
Type vignette('dlimOverview')
for a detailed description.
predict.dlim
plot_cumulative
plot_DLF
library(dlim)
data("ex_data")
dlim_fit <- dlim(y = ex_data$y,
x = ex_data$exposure,
modifier = ex_data$modifier,
z = ex_data$z,
df_m = 10,
df_l = 10,
method = "REML")
dlim_pred <- predict(dlim_fit,
newdata = 0.5,
type="CE")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.