% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mdecomp.R
\name{mdecomp}
\alias{mdecomp}
\title{Age and cause decomposition of differences in life expectancies}
\usage{
mdecomp(mx1, mx2, age, method = "andreev", ...)
}
\arguments{
\item{mx1}{List of numeric arrays. 1st array should be all-cause nmx in the 1st population, other arrays are cause-specific nmx in the 1st population}

\item{mx2}{List of numeric arrays. 1st array should be all-cause nmx in the 2nd population, other arrays are cause-specific nmx in the 2nd population}

\item{age}{Numeric array of age intervals; for full life table = \code{0:100}; for concise life table = \code{c(0:1, seq(5,85,5))}}

\item{method}{Character. Decomposition method. "andreev" (1982) or "arriaga" (1984) - slightly different in their results. By default, \code{method = "andreev"}.}

\item{...}{Optional. Additional arguments for \code{\link[=decomp]{decomp()}}.}
}
\value{
A data frame of class \code{c("mdecomp", "data.frame")} with one row per
age group. Column \code{age} contains ages, \code{ex12} contains the overall age
contribution to the life-expectancy difference, and the remaining columns
contain cause-specific contributions named after the cause-specific
elements of \code{mx1} and \code{mx2}.
}
\description{
Age and cause decomposition of differences in life expectancies
}
\details{
The contribution of each cause \eqn{c} to the absolute difference in life expectancies between the first and second population is caculated as
\deqn{\Delta_{x,c} = \frac{m^1_{x,c} - m^2_{x,c}}{m^1_{x} - m^2_{x}} \times \Delta_{x}}
where \eqn{\Delta_{x}} is contribution of age \eqn{x} to difference \eqn{e_0^2 - e_0^1} from function \code{\link[=decomp]{decomp()}}, \eqn{m^i_{x,c}} is age-specific mortality rate for population \eqn{i} from cause \eqn{c}, and \eqn{m^i_x} is total age-specific mortality rate.
}
\examples{
data(mdecompex)
usa <- subset(mdecompex, cnt == "usa")
eng <- subset(mdecompex, cnt == "eng")
dec <- mdecomp(
  mx1 = list(
    all = usa$all,
    neoplasms = usa$neoplasms,
    circulatory = usa$circulatory
  ),
  mx2 = list(
    all = eng$all,
    neoplasms = eng$neoplasms,
    circulatory = eng$circulatory
  ),
  age = usa$age
)
dec[1:3, ]
}
\seealso{
\code{\link[=decomp]{decomp()}} for just age decomposition and \code{\link[=plot.mdecomp]{plot.mdecomp()}} for graph of \code{mdecomp} results
}
