maple_fit_model: Fit a single forecasting model.

Description Usage Arguments Value Examples

View source: R/maple_fit_model.R

Description

Fit a single forecasting model.

Usage

1
maple_fit_model(model, deaths, population, forecast.horizon, num.threads)

Arguments

model

A forecasting model; see ?maple_models for more details.

deaths

Deaths matrix; see ?maple for more details.

population

Population matrix; see ?maple for more details.

forecast.horizon

The number of years to produce projections for.

num.threads

The number of threads passed to INLA; see ?maple for more details.

Value

If the model is fitted using INLA, an INLA object. See ?INLA::inla for more details. For Lee Carter models, a list is returned with the following entries

logrates

The logarithm of the fitted death rates.

rates

The fitted death rates.

alphas

The intercepts.

betas

The age-specific components in the Lee Carter model. This is a matrix whose columns correspond to age groups and rows to principal components.

gammas

The time-varying components in the Lee Carter model. This is a matrix whose columns correspond to years and rows to principal components.

gammas.fit

A list of length equal to the number of principal components. Each item in the list is the random walk fitted as an Arima object; see ?stats::arima for more details.

gammas.pred

The extrapolated values of gammas.fit used for projections.

pct.var

The proportion of variance explained by the principal component decomposition.

num.pcs

The number of principal components used.

forecast.horizon

The number of years forecast ahead.

Examples

1
2
maple_fit_model(maple_models()[[1]], deaths = maple.deaths,
                population = maple.population, forecast.horizon = 20)

vkontis/maple documentation built on July 15, 2019, 5:08 p.m.