dlnm-package: Distributed Lag Non-linear Models (DLNM)
Description
The package dlnm contains functions to specify and run distributed lag linear and non-linear models. These functions are used to specify basis and cross-basis matrices among a set of available options, then to predict and plot the results for a fitted model.Details
Distributed lag non-linear models (DLNM) represent a modelling framework to describe simultaneously non-linear and delayed dependencies in time-series data. This methodology is based on the definition of a cross-basis, a bi-dimensional space of functions specifying the dependency along the space of the predictor and along lags. The cross-basis functions are built combining the basis functions for the two dimensions, chosen among a set of possible bases. This family includes simple distributed lag models (DLM) as a special case. A thorough methodological overview is given in the references below.
Given a series of observations ordered and equally spaced in time, crossbasis
creates two set of basis functions to define the relationship in the two dimensions of predictor and lags, by calling the function onebasis
, which provides a list of possible options (splines, strata, and threshold functions, among others). The two matrices are then combined in a matrix object of class "crossbasis"
, containing the transformed variables to be included in the model formula. After the model fitting, crosspred
generate predictions for a set of suitable values of the original predictor and stores them in a "crosspred"
object. The fit of a DLNM can be reduced and re-expressed as the chosen function of one of the two dimensions through the function crossreduce
. It returns a "crossreduce"
object storing the new parameters and predictions.
Method functions are available for both objects "crosspred"
and "crossreduce"
. The plotting functions plot
, lines
and points
, offer a set of choices to plot the results, while coef
and vcov
return the coefficients and associated (co)variance matrix for a (optionally reduced) DLNM.
The DLNM framework is developed for time series data: the data are assumed to be an equally-spaced, complete and ordered series of observations, where the interval defines the lag unit. The estimation can be carried out with the default regression functions, such as lm
, glm
or gam
(package mgcv). The function crosspred
extracts the relevant parameters directly from the model object if methods for coef
and vcov
are available for that model class. Alternatively, the user must extract the parameters manually.
Potential applications to other study desing and data structures are currently under evaluation. Preliminary results for matched case-control and cohort data are promising, and the functions included in the package already works with clogit
and coxph
(package survival).
Additonal information on the package dlnm are available in the vignette included in the installation. This document offers a detailed description of the capabilities of the package, and some examples of application to real data, with an extensive illustration of the use of the functions. The vignette is available by typing:
vignette("dlnmOverview")
Use citation("dlnm")
to cite this package.
A list of changes included in the current and previous versions can be found by typing:
file.show(system.file("ChangeLog",package="dlnm"))
References
Gasparrini A. Distributed lag linear and non-linear models in R: the package dlnm. Journal of Statistical Software. 2011; 43(8):1-20. [freely available http://www.jstatsoft.org/v43/i08/{here}].
Gasparrini A., Armstrong, B.,Kenward M. G. Distributed lag non-linear models. Statistics in Medicine. 2010; 29(21):2224-2234. [freely available http://www.ncbi.nlm.nih.gov/pubmed/20812303{here}]
Armstrong, B. Models for the relationship between ambient temperature and daily mortality. Epidemiology. 2006, 17(6):624-31.