
crossplot(crosspred, type="3d", cumul=FALSE, ci="area",
var=NULL, lag=NULL, ylim=NULL, title=NULL, label="var")
"crosspred"
.TRUE
, cumulative effects along lags are reported. Used only if type="slices"
. See Details"area"
, "bars"
or "lines"
.type="slices"
.type
equal to "overall"
or "slices"
, z-axis for "3d"
).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 illustration of the use of the functions, see:
vignette("dlnmOverview")
crossbasis
, crosspred
# Example 3. See crossbasis and crosspred for other examples
### complex DLNM
### space of predictor: 5df quadratic spline for temperature
### space of predictor: linear effect for PM10
### lag function: 5df natural cubic spline for temperature up to lag30
### 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 + ns(time, 7*14) + dow,
family=quasipoisson(), chicagoNMMAPS)
pred.temp <- crosspred(basis.temp, model, at=-26:33)
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")
### See the vignette 'dlnmOverview' for a detailed explanation of this example
Run the code above in your browser using DataLab