APCS: Age-period-cohort model

View source: R/APCS.R

APCSR Documentation

Age-period-cohort model

Description

Fits and forecasts mortality rates using age-period-cohort model.

Usage

APCS(
  x,
  M,
  curve = c("gompertz", "makeham", "oppermann", "thiele", "wittsteinbumsted", "perks",
    "weibull", "vandermaen", "beard", "heligmanpollard", "rogersplanck", "siler",
    "martinelle", "thatcher", "gompertz2", "makeham2", "oppermann2", "thiele2",
    "wittsteinbumsted2", "perks2", "weibull2", "vandermaen2", "beard2",
    "heligmanpollard2", "rogersplanck2", "siler2", "martinelle2", "thatcher2"),
  h = 10,
  jumpoff = 1
)

Arguments

x

vector of ages.

M

matrix of mortality rates (rows as years and columns as ages).

curve

name of mortality curve for smoothing forecasted mortality rates (including gompertz, makeham, oppermann, thiele, wittsteinbumsted, perks, weibull, vandermaen, beard, heligmanpollard, rogersplanck, siler, martinelle, thatcher, gompertz2, makeham2, oppermann2, thiele2, wittsteinbumsted2, perks2, weibull2, vandermaen2, beard2, heligmanpollard2, rogersplanck2, siler2, martinelle2, thatcher2, where first 14 curves' parameters are unconstrained and last 14 curves' parameters are generally restricted to be positive).

h

forecast horizon (default = 10).

jumpoff

if 1, forecasts are based on estimated parameters only; if 2, forecasts are anchored to observed mortality rates in final year (default = 1).

Details

The age-period-cohort (APC) model is specified as

ln(m_{x,t}) = \alpha_x + \kappa_t + \gamma_{t-x} + \epsilon_{x,t}.

The model is estimated by Newton updating scheme and is forecasted by ARIMA applied to \kappa_t and \gamma_c. Constraints include sum of \kappa_t is zero and and sum of \gamma_c is zero. It can be applied to whole age range.

Value

An object of class APCS with associated S3 methods coef, forecast, plot, and residuals.

References

Bray, I. (2002). Application of Markov chain Monte Carlo methods to projecting cancer incidence and mortality. Journal of the Royal Statistical Society Series C, 51(2), 151-164.

Examples

x <- 60:89
a <- c(-4.8499,-4.7676,-4.6719,-4.5722,-4.4847,-4.3841,-4.2813,-4.1863,-4.0861,-3.9962,
-3.8885,-3.7896,-3.6853,-3.5737,-3.4728,-3.3718,-3.2586,-3.1474,-3.0371,-2.9206,
-2.7998,-2.6845,-2.5653,-2.4581,-2.3367,-2.2159,-2.1017,-1.9941,-1.8821, -1.7697)
b <- rep(1/30,30)
k <- c(12.11,10.69,11.18,9.64,9.35,8.21,6.89,5.74,4.56,3.6,
3.27,2.04,1.11,-0.44,-1.05,-1.03,-1.84,-2.9,-4.03,-4.12,
-5.18,-5.64,-6,-6.51,-6.91,-6.9,-8.32,-8.53,-9.69,-9.31)
set.seed(123)
M <- exp(outer(k,b)+matrix(a,nrow=30,ncol=30,byrow=TRUE)+rnorm(900,0,0.035))
fit <- APCS(x=x,M=M,curve="makeham",h=30,jumpoff=2)
coef(fit)
forecast::forecast(fit)
plot(fit)
residuals(fit)


demofit documentation built on April 9, 2026, 5:09 p.m.

Related to APCS in demofit...