plot.Mort2Dsmooth {MortalitySmooth}R Documentation

Plot of the Mort2Dsmooth outcomes

Description

It produces two level plots, side-by-side, where the x- and y-axis are the predictors (x and y) of the given Mort2Dsmooth object and the numeric response is either the matrices of actual and fitted log-rates, or the matrices of actual and fitted counts.

Usage

## S3 method for class 'Mort2Dsmooth'
## S3 method for class 'Mort2Dsmooth':
plot(x, type = c("logrates", "deaths"), ...)

Arguments

x An object of class "Mort2Dsmooth", usually, a result of a call to Mort2Dsmooth.
type The type of plot which should be returned. The alternatives are: logrates (default) and death.
... Other plotting parameters passed to levelplot.

Details

The function provides a simple tool for checking the outcomes of a Mort2Dsmooth object. In a Poisson setting, one would commonly look at rates in log-scale, but actual and fitted counts can be plotted too.

The function uses levelplot from package lattice to construct the two level plots side-by-side. Plotting parameters can not be changed. A rainbow palette with 9 colors is chosen so that lower values are red, followed by orange, yellow, green, blue and indigo with the highest values plotted in violet. The breaks for the level plot are chosen according to the deciles of distributions of actual and fitted log-rates (counts).

Value

None. Function produces a plot.

Author(s)

Carlo G Camarda

See Also

Mort2Dsmooth for computing Mort2Dsmooth.object.

Examples

# selected data
ages <- 50:100
years <- 1970:2006
death <- selectHMDdata("Denmark", "Deaths", "Females",
                       ages = ages, years = years) 
exposure <- selectHMDdata("Denmark", "Exposures", "Females",
                          ages = ages, years = years)
# fit
fit <- Mort2Dsmooth(x=ages, y=years, Z=death, offset=log(exposure),
                    method=3, lambdas=c(100,500)) 
# plotting log-death rates (default)
plot(fit)
# plotting death counts
plot(fit, type="death")

[Package MortalitySmooth version 1.0 Index]