Heatmap.HP {BayesMortalityPlus}R Documentation

HP: Heatmap for the life expectancy

Description

This function plots a heatmap for the life expectancy of the fitted HP models.

Usage

## S3 method for class 'HP'
Heatmap(
  x,
  x_lab = NULL,
  age = 0:90,
  max_age = 110,
  color = c("red", "white", "blue"),
  ...
)

Arguments

x

Object or a list of objects of the class HP or ClosedHP returned by hp() or close_hp() functions.

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 (extrapolation will be considered to match the age interval if needed). This argument is only necessary with objects of the class HP.

color

Vector of colours used in the heatmap.

...

Further arguments passed to or from other methods.

Value

A ggplot2 heatmap of the life expectancy.

See Also

Heatmap.BLC() and Heatmap.DLM() for BLC or DLM methods.

Heatmap.list() to the list method, adding multiple objects in one single Heatmap.

Examples

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

# Example: -------------------------------

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)

Heatmap(fitF, x_lab = "Female expec. 2010 USA")


[Package BayesMortalityPlus version 0.2.3 Index]