Learn R Programming

dlnm (version 1.6.6)

crossreduce: Reduce the Fit of a DLNM to One-Dimensional summaries

Description

The function reduces the fit of a bi-dimensional DLNM to summaries defined in the the dimension of predictor or lags only, and re-expresses it in terms of modified parameters of the one-dimensional basis functions chosen for that space. Specifically, it summarizes lag-specific or overall cumulative predicted associations in the predictor dimension, or predictor-specific associations in the lag dimension. It returns the new parameters and predictions.

Usage

crossreduce(basis, model=NULL, type="overall", value=NULL, coef=NULL, vcov=NULL,
  model.link=NULL, at=NULL, from=NULL, to=NULL, by=NULL, lag, bylag=1,
  ci.level=0.95)
  
## S3 method for class 'crossreduce':
summary(object, ...)

Arguments

basis
an object of class "crossbasis".
model
a model object for which the reduction and prediction are desired. See Details below.
coef, vcov, model.link
user-provided coefficients, (co)variance matrix and model link for the reduction and then prediction. See Details below.
type
type of reduction. Possible options are "overall" (default) for reduction to the overall cumulative association, "lag" for reduction to a lag-specific association, or "var" for reduction to a predictor-specific assoc
value
the single value of predictor or lag at which predictor-specific or lag-specific associations must be defined, respectively. See Details below.
at
vector of values used for prediction in the dimension of predictor.
from, to
range of predictor values used for prediction.
lag
either an integer scalar or vector of length 2, defining the lag range used for prediction. Defalut to values used for estimation.
by, bylag
increment of the sequences of predictor and lag values used for prediction.
ci.level
confidence level for the computation of confidence intervals.
object
an object of class "crossreduce".
...
additional arguments to be passed to summary.

Value

  • A list object of class "crossreduce" with the following (optional) components:
  • coefficients, vcovreduced parameters of the original fitted model for the chosen dimension.
  • basisbasis matrix computed at predvar or for the sequence of lags defined by lag, depending on the chosen dimension.
  • type, valuetype of reduction and (optional) value, as arguments above.
  • predvarvector of observations used for prediction, if the reduction is in the dimension of predictor.
  • laginteger vector defining the lag range.
  • bylagincrement of the sequence of lag values.
  • fit, sevectors of the predicted association and related standard errors.
  • RRfitvector of exponentiated predicted associations from fit.
  • RRlow, RRhighvectors with low and high confidence intervals for RRfit.
  • ci.levelconfidence level used for the computation of confidence intervals.
  • model.classclass of the model command used for estimation.
  • model.linka specification for the model link function.

Warnings

In case of collinear variables in the basis object, some of them are discarded and the related parameters not included in model. Then, crossreduce will return an error. Check that the specification of the variables is meaningful through summary.crossbasis . The name of the object basis will be used to extract the related estimated parameters from object. If more than one variable is transformed by cross-basis functions in the same model, different names must be specified.

Details

model is the model object including basis. It must include methods for coef and vcov, applied to extract the parameters. For model classes without these methods, the user can manually extract the related parameters and include them in coef-vcov, also specifying model.link. In this case, the dimensions and order of the first two must match the variables included in basis. The dimension to which the fit is reduced is chosen by type, computing summaries for overall cumulative or lag-specific associations expressed in the predictor space, or predictor-specific associations expressed in the lag space. For specific associations, the value at which the reduction is computed is chosen by value. The function then re-expresses the original fit of the model, defined by the parameters of the bi-dimensional cross-basis functions, in summaries defined by the one-dimensional basis for the related space and a (usually smaller) set of modified parameters. Similarly to crosspred, the object basis must be the same containing the cross-basis matrix included in object, including its attributes and class. The optional arguments at and from/to/by provides the predictor values for predicted associations when the reduction is in the dimension of predictor. lag and bylag determine instead the lag values for predictor-specific associations. Exponentiated predictions and confidence intervals are also optionally returned. See crosspred for details. For a detailed illustration of the use of the functions, see: vignette("dlnmOverview")

References

Gasparrini A., Armstrong, B., Kenward M. G. Reducing and meta-analyzing estimates from distributed lag non-linear models.BMC Medical Research Methodology. 2013; 13(1):1. [freely available http://www.ag-myresearch.com/bmcmrm2013{here}]. 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.ag-myresearch.com/jss2011{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.ag-myresearch.com/statmed2010{here}]

See Also

crossbasis to generate cross-basis matrices. crosspred to obtain predictions after model fitting. plot.crossreduce to plot several the graphs. See dlnm-package for an overview of the package and type 'vignette(dlnmOverview)' for a detailed description.

Examples

Run this code
# CREATE THE CROSS-BASIS: DOUBLE THRESHOLD AND NATURAL SPLINE
cb4 <- crossbasis(chicagoNMMAPS$temp, lag=30, argvar=list(type="dthr",
  knots=c(10,25)), arglag=list(df=5))

# RUN THE MODEL AND GET THE PREDICTION FOR TEMPERATURE
library(splines)
model4 <- glm(death ~  cb4 + ns(time, 7*14) + dow,
  family=quasipoisson(), chicagoNMMAPS)
pred4 <- crosspred(cb4, model4, by=1)

# REDUCE TO OVERALL CUMULATIVE ASSOCIATION
redall <- crossreduce(cb4, model4)
summary(redall)
# REDUCE TO LAG-SPECIFIC ASSOCIATION FOR LAG 5
redlag <- crossreduce(cb4, model4, type="lag", value=5)
# REDUCE TO PREDICTOR-SPECIFIC ASSOCIATION AT VALUE 33
redvar <- crossreduce(cb4, model4, type="var", value=33)

# NUMBER OF PARAMETERS OF THE ORIGINAL MODEL
length(coef(pred4))
# NUMBER OF PARAMETERS FOR OVERALL CUMULATIVE AND LAG-SPECIFIC SUMMARIES
length(coef(redall)) ; length(coef(redlag))
# NUMBER OF PARAMETERS FOR PREDICTOR-SPECIFIC SUMMARY
length(coef(redvar))

# TEST: IDENTICAL FIT BETWEEN ORIGINAL AND REDUCED FIT
plot(pred4, "overall", xlab="Temperature", ylab="RR",
  ylim=c(0.8,1.6), main="Overall cumulative association")
lines(redall, ci="lines",col=4,lty=2)
legend("top",c("Original","Reduced"),col=c(2,4),lty=1:2,ins=0.1)

# RECONSTRUCT THE FIT IN TERMS OF ONE-DIMENSIONAL BASIS
b4 <- onebasis(0:30,knots=attributes(cb4)$arglag$knots,int=TRUE,cen=FALSE)
pred4b <- crosspred(b4,coef=coef(redvar),vcov=vcov(redvar),model.link="log",by=1)

# TEST: IDENTICAL FIT BETWEEN ORIGINAL, REDUCED AND RE-CONSTRUCTED
plot(pred4, "slices", var=33, ylab="RR", ylim=c(0.9,1.2),
  main="Predictor-specific association at 33C")
lines(redvar, ci="lines", col=4, lty=2)
points(pred4b, col=1, pch=19, cex=0.6)
legend("top",c("Original","Reduced","Reconstructed"),col=c(2,4,1),lty=c(1:2,NA),
  pch=c(NA,NA,19),pt.cex=0.6,ins=0.1)

Run the code above in your browser using DataLab