lc_stan {StanMoMo} | R Documentation |
Bayesian Lee-Carter with Stan
Description
Fit and Forecast Bayesian Lee-Carter model. The model can be fitted with a Poisson or Negative-Binomial distribution. The function outputs posteriors distributions for each parameter, predicted death rates and log-likelihoods.
Usage
lc_stan(
death,
exposure,
forecast,
validation = 0,
family = c("poisson", "nb"),
...
)
Arguments
death |
Matrix of deaths. |
exposure |
Matrix of exposures. |
forecast |
Number of years to forecast. |
validation |
Number of years for validation. |
family |
specifies the random component of the mortality model. |
... |
Arguments passed to |
Details
The created model is either a log-Poisson or a log-Negative-Binomial version of the Lee-Carter model:
or
with
To ensure the identifiability of th model, we impose
For the priors, the model chooses relatively wide priors:
For the period term, we consider a first order autoregressive process (AR(1)) with linear trend:
with .
Value
An object of class stanfit
returned by rstan::sampling
.
References
Lee, R. D., & Carter, L. R. (1992). Modeling and forecasting U.S. mortality. Journal of the American Statistical Association, 87(419), 659-671.
Examples
#10-year forecasts for French data for ages 50-90 and years 1970-2017 with a log-Poisson model
ages.fit<-50:90
years.fit<-1970:2017
deathFR<-FRMaleData$Dxt[formatC(ages.fit),formatC(years.fit)]
exposureFR<-FRMaleData$Ext[formatC(ages.fit),formatC(years.fit)]
iterations<-50 # Toy example, consider at least 2000 iterations
fitLC=lc_stan(death = deathFR,exposure=exposureFR, forecast = 10,
family = "poisson",iter=iterations,chains=1)