Heatmap.list {BayesMortalityPlus}R Documentation

Heatmap for a set of life tables

Description

This function plots a heatmap for the life expectancy of the mortality graduations returned by hp(), dlm(), hp_close() or dlm_close() functions.

Usage

## S3 method for class 'list'
Heatmap(
  x,
  x_lab = NULL,
  age = NULL,
  max_age = NULL,
  color = c("red", "white", "blue"),
  ...
)

Arguments

x

List of objects of classes: HP, DLM, ClosedHP, or ClosedDLM.

x_lab

Description of the object 'fit'.

age

Vector with the ages to plot the heatmap.

max_age

Positive number indicating the last age to be considered to compute the life expectancy (methods for matching the age interval will be considered if needed). This argument is only necessary with objects of the class HP or DLM.

color

Vector with colours used in the heatmap.

...

Further arguments passed to or from other methods.

Value

A ggplot2 heatmap of the life expectancy.

See Also

Heatmap.HP(), Heatmap.DLM() and Heatmap.BLC() for drawing single Heatmaps.

Examples

## Importing mortality data from the USA available on the Human Mortality Database (HMD):
data(USA)

# Example (HP): -------------------------------

## Selecting the data from 2010
USA2010 = USA[USA$Year == 2010,]

ExF = USA2010$Ex.Female[1:91]
DxF = USA2010$Dx.Female[1:91]
x <- 0:90

fitF <- hp(x, ExF, DxF, model = "lognormal", M = 1000, bn = 0, thin = 10)

ExM = USA2010$Ex.Male[1:91]
DxM = USA2010$Dx.Male[1:91]

fitM <- hp(x, ExM, DxM, model = "lognormal", M = 1000, bn = 0, thin = 10)

fits <- list(fitF = fitF, fitM = fitM)

Heatmap(fits, x_lab = c("Female 2010 USA","Male 2010 USA"),
        age = 15:85)



[Package BayesMortalityPlus version 0.2.3 Index]