mortcast.blend: Mortality Prediction by Method Blending

Description Usage Arguments Details Value See Also Examples

View source: R/other_methods.R

Description

Predict age-specific mortality rates using a blend of two different methods (Coherent Lee-Carter, Coherent Pattern Mortality Decline, Log-Quadratic model, or Model Life Tables). Weights can be applied to fine-tune the blending mix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
mortcast.blend(
  e0m,
  e0f,
  meth1 = "lc",
  meth2 = "mlt",
  weights = c(1, 0.5),
  nx = 5,
  apply.kannisto = TRUE,
  min.age.groups = 28,
  match.e0 = TRUE,
  keep.lt = FALSE,
  meth1.args = NULL,
  meth2.args = NULL,
  kannisto.args = NULL,
  ...
)

Arguments

e0m

A time series of future male life expectancy.

e0f

A time series of future female life expectancy.

meth1

Character string giving the name of the first method to blend. It is one of “lc”, “pmd”, “mlt” or “logquad”, corresponding to Coherent Lee-Carter (function mortcast), Pattern Mortality Decline (function copmd), Log-Quadratic model (function logquadj), and Model Life Tables (function mltj), respectively. The “logquad” method can only be used with 5-year age groups.

meth2

Character string giving the name of the second method to blend. One of the same choices as meth1.

weights

Numeric vector with values between 0 and 1 giving the weight of meth1. If it is a single value, the same weight is applied for all time periods. If it is a vector of size two, it is assumed these are weights for the first and the last time period. Remaining weights will be interpolated. Note that meth2 is weighted by 1 - weights.

nx

Size of age groups. Should be either 5 or 1.

apply.kannisto

Logical. If TRUE and if any of the methods results in less than min.age.groups age categories, the coherent Kannisto method (cokannisto) is applied to extend the age groups into old ages.

min.age.groups

Minimum number of age groups. Triggers the application of Kannisto, see above. Change the default value if 1-year age groups are used (see Example).

match.e0

Logical. If TRUE the blended mx is scaled so that it matches the input e0.

keep.lt

Logical. If TRUE additional life table columns are kept in the resulting object. Only used if match.e0 is TRUE.

meth1.args

List of arguments passed to the function that corresponds to meth1.

meth2.args

List of arguments passed to the function that corresponds to meth2.

kannisto.args

List of arguments passed to the cokannisto function if Kannisto is applied. If 1-year age groups are used various defaults in the Kannisto function need to be changed (see Example).

...

Additional life table arguments.

Details

The function allows to combine two different methods using given weights. The weights can change over time - by default they are interpolated from the starting weight to the end weight. As the blended mortality rates do not necessarily match the target life expectancy, scaling is applied to improve the match, controlled by the match.e0 argument. The projection is done for both sexes, so that coherent methods can be applied.

Value

List with elements female and male, each of which contains a matrix mx with the predicted mortality rates. If the result has been scaled (match.e0 is TRUE), the element mx.rawblend contains the mx before scaling. Also in such a case, if keep.lt is TRUE, it also contains matrices sr (survival rates), and life table quantities Lx and lx. In addition, the return object contains elements meth1res and meth2res which contain the results of the functions corresponding to the two methods. Elements meth1 and meth2 contain the names of the methods. A vector weights contains the final (possibly interpolated) weights.

See Also

mortcast, copmd, mltj, logquad, cokannisto

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
data(mxM, mxF, e0Fproj, e0Mproj, package = "wpp2017")
country <- "Brazil"
# estimate parameters from historical mortality data
mxm <- subset(mxM, name == country)[,4:16]
mxf <- subset(mxF, name == country)[,4:16]
rownames(mxm) <- rownames(mxf) <- c(0,1, seq(5, 100, by=5))
lcest <- lileecarter.estimate(mxm, mxf)
# project into future
e0f <- subset(e0Fproj, name == country)[-(1:2)]
e0m <- subset(e0Mproj, name == country)[-(1:2)]

# Blend LC and MLT
pred1 <- mortcast.blend(e0m, e0f, meth1 = "lc", meth2 = "mlt",
    meth1.args = list(lc.pars = lcest),
    meth2.args = list(type = "CD_North"),
    weights = c(1,0.25))
    
# Blend PMD and MLT
pred2 <- mortcast.blend(e0m, e0f, meth1 = "pmd", meth2 = "mlt",
    meth1.args = list(mxm0 = mxm[, "2010-2015"],
                      mxf0 = mxf[, "2010-2015"]))
                      
# plot projection by time
plotmx <- function(pred, iage, main) 
    with(pred, {
        # blended projections 
        plot(female$mx[iage,], type="l", 
            ylim=range(meth1res$female$mx[iage,], 
                       meth2res$female$mx[iage,]),
            ylab="female mx", xlab="Time", main=main, col = "red")
        lines(meth1res$female$mx[iage,], lty = 2)
        lines(meth2res$female$mx[iage,], lty = 3)
        legend("topright", legend=c("blend", meth1, meth2),
               lty = 1:3, col = c("red", "black", "black"), bty = "n")
    })
age.group <- 3 # 5-9 years old
par(mfrow=c(1,2))
plotmx(pred1, age.group, "LC-MLT (age 5-9)")
plotmx(pred2, age.group, "PMD-MLT (age 5-9)")

# Blend LC and MLT for 1-year age groups
#########################################
# First interpolate e0 to get 1-year life expectancies (for first five years)
e0m1y <- approx(as.double(e0m[,1:2]), n = 5)$y
e0f1y <- approx(as.double(e0f[,1:2]), n = 5)$y
# derive toy mx in order to get some LC parameters
mxm1y <- mlt(seq(70, 72, length = 4), sex = "male", nx = 1)
mxf1y <- mlt(seq(78, 79, length = 4), sex = "female", nx = 1)
lcest1y <- lileecarter.estimate(mxm1y, mxf1y, nx = 1)

# projections
pred3 <- mortcast.blend(e0m1y, e0f1y, meth1 = "lc", meth2 = "mlt",
    weights = c(1,0.25), min.age.groups = 131, nx = 1, 
    meth1.args = list(lc.pars = lcest1y),
    kannisto.args = list(est.ages = 90:99, proj.ages = 100:130))
    
# plot results
par(mfrow=c(1,1))
plot(0:130, pred3$female$mx[,5], log = "y", type = "l", col = "red")
lines(0:130, pred3$male$mx[,5], col = "blue")

PPgp/MortCast documentation built on Aug. 8, 2021, 5:17 p.m.