dlm: Distributed lag models

Description Usage Arguments Details Value References See Also Examples

Description

Fit distributed lag models using lme4 to penalize smooth terms. Other random effects terms and generalized mixed models supported.

Usage

1
2
3
dlm(formula, data, subset, na.action, weights, offset,
    method = c("REML", "MLE"), family = gaussian(),
    control = list(), ...)

Arguments

formula

an object of class stats::formula: a symbolic description of the model to be fitted. See Details

data

an optional data frame, list, or environment containing the variables of the model to be fitted

subset

optional vector specifying a subset of observations to be used in the fitting process

na.action

optional function that indicates what should happen when the data contains NA's. The default is set by the na.action setting of base::options, usually stats::na.omit

weights

optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector

offset

a known offset term to include in the model, e.g. for poisson() family models

method

algorithm used to fit the DLM. Partial matching and capitalization allowed. The default is "REML" for linear/gaussian(link = "identity") family models, and "MLE" otherwise

family

a description of the error distribution and link function to be used in the model. The default is gaussian(link = "identity"). See stats::family for possible family functions and details

control

either a list object with arguments to be passed to the lme4::lmerControl sequence, or the output of [g]lmerConrol directly

...

Additional parameters passed to lme4::lFormula

Details

Models are specified using typical lme4 formula syntax with at least one set of lag terms returned by a given smoothing function (e.g. see cr). The smoothing function can be any that returns a SmoothLag basis object. See Examples for a basic call to dlm using the formula interface, and a cubic radial lag basis specified via cr, and the dlmBE package documentation for a discussion of the types of models dlm is designed to handle.

Value

An S4 object that inherits from dlMod (and lme4::merMod, by extension) containing the results of the fitted model. Many standard model summary methods are available for these object types

References

Baek J, Sanchez BN, Berrocal VJ, & Sanchez-Vaznaugh EV (2016) Epidemiology 27(1):116-24. (PubMed)

Baek J, Hirsch JA, Moore K, Tabb LP, et al. (2017) Epidemiology 28(3):403-11. (PubMed)

Bates D, Maechler M, Bolker BM, & Walker SC (2015) Fitting linear mixed-effects models using lme4. J Stat Softw 67(1). (jstatsoft.org)

See Also

lme4::lmer, cr, dlMod

Examples

1
2
3
4
5
6
7
8
data (simdata)

## Setup distance count matrix and corresponding lag distances
X <- as.matrix(simdata[, -(1:3)])
lag <- seq(0.1, 10, length.out = ncol(X))

fit <- dlm(Y ~ Age + Gender + cr(lag, X), data = simdata)
summary (fit)

asw221/dlm documentation built on May 8, 2019, 5:59 p.m.