predict.DLM {BayesMortalityPlus} | R Documentation |
DLM: Prediction of death probability
Description
Extrapolates the mortality curve fitted by DLM by calculating the median of death probability and the respective prediction interval.
Usage
## S3 method for class 'DLM'
predict(object, h, prob = 0.95, ...)
Arguments
object |
A |
h |
The ages prediction horizon. |
prob |
Coverage probability of the predictive intervals. |
... |
Other arguments. |
Value
A data.frame with the death probability prediction and prediction interval for the ages in the prediction horizon.
See Also
Examples
## 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)
## Extrapolating the death probabilities (qx)
predict(fit, h = 3, prob = 0.95)
[Package BayesMortalityPlus version 0.2.4 Index]