plot.resStMoMo: Plot the residuals of a Stochastic Mortality Model

Description Usage Arguments Details Examples

View source: R/residualsfitStMoMo.R

Description

Plots the deviance residuals of a Stochastic Mortality Model which are of class "resStMoMo". Three types of plots are available: scatter plot of residuals by age, period and cohort, colour map (heatmap) of the residuals, and a black and white signplot of the residuals.

Usage

1
2
3
4
5
6
## S3 method for class 'resStMoMo'
plot(x, type = c("scatter", "colourmap", 
                                            "signplot"), 
                                reslim = NULL, plotAge = TRUE, 
                                plotYear = TRUE, plotCohort  = TRUE, 
                                pch = 20, col = NULL, ...)

Arguments

x

an object of class resStMoMo with the residuals of a Stochastic Mortality Model.

type

the type of the plot. The alternatives are "scatter"(default), "colourmap", and "signplot".

reslim

optional numeric vector of length 2, giving the range of the residuals.

plotAge

logical value indicating if the age scatter plot should be produced. This is only used when type = "scatter".

plotYear

logical value indicating if the calendar year scatter plot should be produced. This is only used when type = "scatter".

plotCohort

logical value indicating if the cohort scatter plot should be produced. This is only used when type = "scatter".

pch

optional symbol to use for the points in a scatterplot. This is only used when type = "scatter". See plot.

col

optional colours to use in plotting. If type = "scatter" this is a single colour to use in the points in the scatter plots, while if type = "colourmap" this should be a list of colours (see help in image.plot for details). This argument is ignored if type = "signplot".

...

other plotting parameters to be passed to the plotting functions. This can be used to control the appearance of the plots.

Details

When type = "scatter" scatter plots of the residuals against age, calendar year and cohort (year of birth) are produced.

When type = "colourmap" a two dimensional colour map of the residuals is plotted. This is produced using function image.plot. See image.plot for further parameters that can be passed to this type of plots.

When type = "signplot" a two dimensional black and white map of the residuals is plotted with dark grey representing negative residuals and light grey representing positive residuals. This is produced using function image.default.

@seealso residuals.fitStMoMo

Examples

1
2
3
4
5
6
CBDfit <- fit(cbd(), data = central2initial(EWMaleData), ages.fit = 55:89)
CBDres <- residuals(CBDfit)
plot(CBDres)
plot(CBDres, type = "signplot")
plot(CBDres, type = "colourmap")
  

Example output

Loading required package: gnm
Loading required package: forecast
StMoMo: Start fitting with gnm
StMoMo: Finish fitting with gnm

StMoMo documentation built on May 2, 2019, 11:42 a.m.