Heatmap.DLM {BayesMortalityPlus}R Documentation

DLM: Heatmap for the life expectancy

Description

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

Usage

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

Arguments

x

Object or a list of objects of the class DLM or ClosedDLM returned by dlm() or dlm_close() 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 (prediction will be considered to match the age interval if needed). This argument is only necessary with objects of the class DLM.

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.HP() for BLC or HP 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 1: -------------------------------

USA2010 = USA[USA$Year == 2010,]

ExF = USA2010$Ex.Female[1:91]
DxF = USA2010$Dx.Female[1:91]
yF = log(DxF/ExF)

fitF <- dlm(yF, M = 100)

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



[Package BayesMortalityPlus version 0.2.3 Index]