crossplot {dlnm}R Documentation

Plot predicted effects for a DLNM

Description

Plot several graphs (3d, slices and overall effects) of predicted effects from distributed lag non-linear models (DLNM).

Usage

crossplot(crosspred, type="3d", cumul=FALSE, ci="area", 
        var=NULL, lag=NULL, ylim=NULL, title=NULL, label="var")

Arguments

crosspred an object of class "crosspred".
type type of plot. See Details below.
cumul logical. If TRUE, cumulative effects along lags are reported. Used only if type="slices". See Details
ci type of confidence intervals representation, one of "area", "bars" or "lines".
var, lag vectors of predictor values and lags for which specific effects must be plotted. Used only if type="slices".
ylim numeric vectors of length 2, giving the coordinates ranges for the response axis (y-axis for type equal to "overall" or "slices", z-axis for "3d").
title the main title on top of the plot.
label label for predictor to be inserted in the plot.

Details

Different plots can be obtained choosing the following values for the argument type:

"3d": a 3-D plot generated by calling the function persp.

"contour": a contour/level plot generated by calling the function filled.contour.

"overall": a plot of the overall effects (summed up all the single lag contributions).

"slices": a multiple plot of effects at specific values of predictor or lags, chosen by var and lag, respectively. Up to 4 plots for each dimension are allowed. Cumulative effects along lags are reported if cumul=TRUE: in this case, the same option must have been set to obtain the prediction saved in the crosspred object (see crosspred).

For a detailed overview of the options, see:

vignette("dlnmOverview")

Note

All the effects are reported versus a reference value. For continuous functions, this is specified by the centering point defined in the object crossbasis (see crossbasis). Exponentiated effects are automatically returned if model has link equal to log or logit.

The values in var must match those specified in the object crosspred (see crosspred), while the values in lag must be included in the lag period specified by crossbasis.

This function creates plots with default settings (i.e. perspective in 3-D plot, colours etc.). Refer to the original estimates stored in the crosspred object in order to personalize the output with generic plot commands.

Author(s)

Antonio Gasparrini, antonio.gasparrini@lshtm.ac.uk

References

Armstrong, B. Models for the relationship between ambient temperature and daily mortality. Epidemiology. 2006, 17(6):624-31.

See Also

crossbasis, crosspred

Examples

# Example 3. See crossbasis and crosspred for other examples

### DLNM for the effect of temperature on mortality up to 30 days of lag
### space of predictor: 5df quadratic spline for temperature
### space of predictor: linear effect for PM10
### lag function: 5df natural cubic spline for temperature
### lag function: single strata at lag 0-1 for PM10

data(chicagoNMMAPS)
basis.pm <- crossbasis(chicagoNMMAPS$pm10,vartype="lin", lagtype="strata",
        cen=FALSE, maxlag=1)
basis.temp <- crossbasis(chicagoNMMAPS$temp, vartype="bs", vardf=5, vardegree=2,
        lagdf=5, cenvalue=21, maxlag=30)
summary(basis.pm)
summary(basis.temp)
model <- glm(death ~  basis.pm + basis.temp, family=quasipoisson(), chicagoNMMAPS)
pred.temp <- crosspred(basis.temp, model, at=-26:33, cumul=TRUE)

crossplot(pred.temp, label="Temperature",
        title="3D graph of temperature effect")
crossplot(pred.temp, "contour", label="Temperature",
        title="Contour graph of temperature effect")
crossplot(pred.temp, "overall", label="Temperature",
        title="Overall effect of temperature over 30 days of lag")
crossplot(pred.temp, "slices", var=c(-20,0,27,33),
        lag=c(0,5,15,28), label="Temperature")
crossplot(pred.temp, "slices", cum=TRUE, ci="bars", var=-20,
        label="Temperature", title="Cumulative effect for -20C along lags")

### See the vignette 'dlnmOverview' for a detailed explanation of this example

[Package dlnm version 1.1.1 Index]