fitted.HP {BayesMortalityPlus}R Documentation

HP: Fitted death probabilities (qx)

Description

This function computes the point estimations of the death probabilities (qx) of the HP or the ClosedHP class object fitted by the hp() or hp_close() functions.

Usage

## S3 method for class 'HP'
fitted(object, age = NULL, Ex = NULL, prob = 0.95, ...)

Arguments

object

Object of the class HP or ClosedHP adjusted by the hp() or hp_close() functions.

age

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

Ex

Vector with the exposures of the selected ages. Its length must be equal to the age vector. This argument is only necessary when using the Poisson and the Binomial distributions.

prob

Coverage probability of the predictive intervals.

...

Other arguments.

Value

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

See Also

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

Examples

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

## Selecting the exposure and the death count of the year 2000, ranging from 0 to 90 years old:
USA2000 = USA[USA$Year == 2000,]
x = 0:90
Ex = USA2000$Ex.Total[x+1]
Dx = USA2000$Dx.Total[x+1]

## Fitting a simple model:
fit = hp(x = x, Ex = Ex, Dx = Dx, M = 5000, bn = 0, thin = 10)

## Estimating the death probabilities (qx)
fitted(fit)
fitted(fit, age = 0:110, Ex = USA2000$Ex.Total[0:110+1])


[Package BayesMortalityPlus version 0.2.3 Index]