collindlnm {collin}R Documentation

Simulates effects from a distributed lag model pattern.

Description

Simulates results from a distributed lag model under an hypothetical effect pattern provided by the user, which can be linear or non-linear. The output is the passed to the plot method to visualize consequences of collinearity.

Usage

collindlnm(
  model,
  x,
  cb,
  at = 1,
  cen = 0,
  effect,
  type = c("coef", "risk"),
  shape = c("linear", "nonlinear"),
  nsim = 100,
  verbose = TRUE,
  seed = NULL
)

Arguments

model

a model that includes a crossbasis. Currently, models allowed are those of class "glm" or "lme", if shape = "linear"; or "glm", if shape = "nonlinear".

x

if shape = "linear", a matrix that includes the values of the predictor under study, in the first column, and the lagged values, up to the maximum lag considered, as the subsequent columns. If shape = "nonlinear", a numeric vector or 1-column matrix including the original (i.e. lag 0) values of the predictor.

cb

an object of class "crossbasis". The crossbasis included in model.

at

the increase(s) in the predictor under study to be considered to report the effects of the variable. If shape = "linear", at must be a single number. If shape = "nonlinear", at must be a numeric vector with at least two different values.

cen

a number. Reference value of the predictor under study, used to calculate effects. If shape = "linear", the value of cen is irrelevant (and it is internally set to 0).

effect

a vector or a matrix, depending on shape, including the hypothetical effect of the predictor under analysis. If shape = "linear", a vector including the linear effect at each lag (including lag 0). If shape = "nonlinear", a matrix including the effect at each lag (including lag 0) (columns) and for each value in at (rows).

type

a character. If type = "coef" (default), effect is supposed to be in the linear predictor scale (i.e. it is considered as regression coefficients in model). If type = "risk", effect is supposed to be in terms of relative risks (i.e. exp(coef), as ORs or RRs in logistic or Poisson families, respectively). If model is of class "lme", then it must be type = "coef" (default).

shape

the shape of the relationship between the linear predictor of the model and the outcome. Default is "linear".

nsim

number of simulations. Default is 100.

verbose

a logical value indicating output status messages. Default is TRUE.

seed

a number. Seed for reproducibility of results. Default is NULL (no seed).

Value

A list including the results of the simulations to be passed to the plot method.

See Also

crossbasis, glm, lme.

Examples

# For detailed examples:
browseVignettes("collin")

[Package collin version 0.0.4 Index]