% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CBDS.R
\name{CBDS}
\alias{CBDS}
\title{CBD model}
\usage{
CBDS(
  x,
  M,
  curve = c("gompertz", "makeham", "perks", "weibull", "beard", "martinelle", "thatcher",
    "gompertz2", "makeham2", "perks2", "weibull2", "beard2", "martinelle2", "thatcher2"),
  h = 10,
  jumpoff = 1
)
}
\arguments{
\item{x}{vector of ages.}

\item{M}{matrix of mortality rates (rows as years and columns as ages).}

\item{curve}{name of mortality curve for smoothing forecasted mortality rates (including gompertz, makeham, perks, weibull, beard, martinelle, thatcher, gompertz2, makeham2, perks2, weibull2, beard2, martinelle2, thatcher2, where first 7 curves' parameters are unconstrained and last 7 curves' parameters are generally restricted to be positive).}

\item{h}{forecast horizon (default = 10).}

\item{jumpoff}{if 1, forecasts are based on estimated parameters only; if 2, forecasts are anchored to observed mortality rates in final year (default = 1).}
}
\value{
An object of class CBDS with associated S3 methods coef, forecast, plot, residuals, and simulate (nsim for setting number of simulations; seed for initialising random number generator).
}
\description{
Fits and forecasts mortality rates using CBD model.
}
\details{
The CBD (M5) model is specified as

\eqn{ln(m_{x,t}) = \kappa_{1,t} + \kappa_{2,t} (x-\bar{x}) + \epsilon_{x,t}}.

The model is estimated by regression and is forecasted by ARIMA applied to \eqn{\kappa_{1,t}} and \eqn{\kappa_{2,t}}. It is designed for ages 50-90.
}
\examples{
x <- 60:89
k1 <- -2.97-0.0245*(0:29)
k2 <- 0.101+0.000345*(0:29)
set.seed(123)
M <- exp(matrix(k1,nrow=30,ncol=30,byrow=FALSE)+outer(k2,(x-mean(x)))+rnorm(900,0,0.035))
fit <- CBDS(x=x,M=M,curve="makeham",h=30,jumpoff=2)
coef(fit)
forecast::forecast(fit)
plot(fit)
residuals(fit)

}
\references{
Cairns, A.J.G., Blake, D., and Dowd, K. (2006). A two-factor model for stochastic mortality with parameter uncertainty: Theory and calibration. Journal of Risk and Insurance, 73(4), 687-718.
}
