Learn R Programming

BayesMortalityPlus (version 0.2.3)

fitted.DLM: DLM: Fitted death probabilities (qx)

Description

This function computes the point estimations of the death probabilities (qx) of a mortality graduation returned by dlm() or dlm_close() functions.

Usage

# S3 method for DLM
fitted(object, age = NULL, prob = 0.95, ...)

Value

A data.frame object with the selected ages and the corresponding estimates and predictive intervals of the death probabilities.

Arguments

object

Object of the following classes: DLM or ClosedDLM.

age

Vector with the ages to calculate the death probabilities (Optional). By default, all ages are considered.

prob

Coverage probability of the predictive intervals.

...

Other arguments.

See Also

fitted.HP() and fitted.BLC() for HP or BLC methods.

Examples

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

## Selecting the log mortality rate of the year 2000, ranging from 0 to 100 years old:
USA2000 = USA[USA$Year == 2000,]
x = 0:100
Ex = USA2000$Ex.Total[x+1]
Dx = USA2000$Dx.Total[x+1]
y = log(Dx/Ex)

## Fitting dlm
fit = dlm(y, M = 100)

## Estimating the death probabilities (qx)
fitted(fit)

Run the code above in your browser using DataLab