# lqgroup: Log-Quadratic Mortality Model In PPgp/MortCast: Estimation and Projection of Age-Specific Mortality Rates

## Description

Predict age-specific mortality rates using the Log-Quadratic Mortality Model (Wilmoth et al. 2012).

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```logquad( e0, sex = c("male", "female", "total"), my.coefs = NULL, q5ranges = c(1e-04, 0.9), k = 0, keep.lt = FALSE, ... ) logquadj(e0m, e0f, ...) ```

## Arguments

 `e0` Vector of target life expectancies. `sex` Which sex does the give `e0` corresponds to. `my.coefs` Data frame with columns “sex”, “age”, “ax”, “bx”, “cx”, “vx”. The “sex” column should contain values “female”, “male” and/or “total”. The “age” column must be sorted so that it assures that rows correspond to ages in increasing order. Any `NA`s are internally converted to zeros. If not given, the dataset `LQcoef` is used. `q5ranges` A vector of size two, giving the min and max of 5q0 used in the bisection method. `k` Value of the k parameter. `keep.lt` Logical. If `TRUE` additional life table columns are kept in the resulting object. `...` Additional arguments passed to the underlying function. `e0m` A time series of target male life expectancy. `e0f` A time series of target female life expectancy.

## Details

The LogQuad method in this implementation projects mortality rates using the equation

\log(m_x) = a_x + b_x h + c_x h^2 + v_x k

where a_x, b_x, c_x and v_x are age-specific coefficients, h = \log( 5q0 ) (i.e. reflects child mortality), and k should be chosen to match 45q15 (adult mortality) or set to 0 (default). The coefficients can be passed as inputs, or taken from the package default dataset `LQcoef` which are taken from https://u.demog.berkeley.edu/~jrw/LogQuad/.

For the given inputs and values of life expectancy e0, the function finds values of h that best match e0, using life tables and the bisection method. It returns the corresponding mortality schedule for each value of e0.

Function `logquad` is for one sex, while `logquadj` can be used for both sexes.

## Value

Function `logquad` returns a list with the following elements: a matrix `mx` with the predicted mortality rates. If `keep.lt` is `TRUE`, it also contains matrices `sr` (survival rates), and life table quantities `Lx` and `lx`. Function `logquadj` returns a list of objects, one for each sex.

## References

Wilmoth, J., Zureick, S., Canudas-Romo, V., Inoue, M., Sawyer, C. (2012). A Flexible Two-Dimensional Mortality Model for Use in Indirect Estimation. Population studies, 66(1), 1-28. doi: 10.1080/00324728.2011.611411

`LQcoef`, `mortcast.blend`, `mortcast`, `pmd`, `mlt`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```data(e0Mproj, package = "wpp2017") country <- "Brazil" # get target e0 e0m <- as.numeric(subset(e0Mproj, name == country)[-(1:2)]) # project into future pred <- logquad(e0m, sex = "male") # plot first projection in black and the remaining ones in heat colors plot(pred\$mx[,1], type = "l", log = "y", ylim = range(pred\$mx), ylab = "male mx", xlab = "Age", main = country) for(i in 2:ncol(pred\$mx)) lines(pred\$mx[,i], col = heat.colors(20)[i]) ```