predict.DLM | R Documentation |
Extrapolates the mortality curve fitted by DLM by calculating the median of death probability and the respective prediction interval.
## S3 method for class 'DLM'
predict(object, h, prob = 0.95, ...)
object |
A |
h |
The ages prediction horizon. |
prob |
Coverage probability of the predictive intervals. |
... |
Other arguments. |
A data.frame with the death probability prediction and prediction interval for the ages in the prediction horizon.
fitted.DLM()
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.