dlnm-package: Distributed Lag Non-linear Models (DLNM)
Description
The package dlnm contains functions to specify basis and cross-basis matrices in order to run distributed lag models (DLM) and their non-linear extension (DLNM), 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 two internal functions mkbasis and mklagbasis, respectively. The two matrices produced by these functions 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 predicts the results for a set of suitable values of the original predictor and stores them in a "crosspred" object. Finally, the plotting method functions plot, lines and points offer a set of choices to plot the results.
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. URL http://www.jstatsoft.org/v43/i08/.
Gasparrini A., Armstrong, B.,Kenward M. G. Distributed lag non-linear models. Statistics in Medicine. 2010; 29(21):2224-2234.
Armstrong, B. Models for the relationship between ambient temperature and daily mortality. Epidemiology. 2006, 17(6):624-31.See Also
crossbasis to create the basis and cross-basis matrices. crosspred to predict the effects after model fitting. plot.crosspred to plot several type of graphs.