timriffe / DemoTools

Tools for the evaluation, adjustment, and standardization of demographic data
https://timriffe.github.io/DemoTools
Other
61 stars 31 forks source link

OPAG changes #239

Closed peterdavjohnson closed 3 years ago

peterdavjohnson commented 3 years ago

A. First will test continuous = FALSE issue. The problem is that when OPAG_r_min is called through the optimize sub, the continuous variable did not get passed to that sub (and subsequently OPAG_nLx_warp_r), the default value of continuous = TRUE is used, so the r value with the min value is based on continuous = TRUE, so it gives the same r_opt$minimum value, but different population results. The formula for continuous = FALSE should be w <- (1 - r) ^ (a1 + .5) instead of w <- (1 + r) ^ (a1 + .5)

When I corrected that problem and also the formula for the continuous = FALSE, the results come out very close (less than 0.001% different), but the r_opt$minimum values are different: • For continuous = FALSE the value is -0.00398 • For continuous = TRUE the value is -0.00397 Thus, I think it would simplify things if the continuous option were dropped.

B. Ensure Lx is single ages once for use throughout Since OPAG currently uses an interative process to find the optimal value of r, it does not make sense to need to split an abridged life table into single ages again and again. Instead, the main OPAG routine does the split (if needed) and the single year LT is then passed along through the other subs.

C. Make AgeInt not required for Pop and Lx The AgeInt (age interval) variable is not needed for the Pop and Lx inputs because they can be inferred from the corresponding Age values.

D. Change default method to “mono” The “uniform” method for graduation creates a step function, which does not work well with creating a single year stable population. However, further research is needed to make sure that the “mono” option does a reasonable job splitting the oldest ages. We switched the spline function from “hyman” to “monoH.FC” to make the splitting of 0 and 1-4 work better, but it is possible that “hyman” may work better at older ages. The “pclm” option seems very similar to “uniform” in graduate, with the default options, so “mono” seems best for now.

E. Change open age formula in warp function Changed the formula for the average age in the open-ended age group from the original

w1Lx <- exp(-r * (a1 + .5)) * Lx1

to:

      Tlast <- Lx1[nAges]
    Tprev <- Tlast + Lx1[nAges-1]
    abar <- -((log(Lx1[nAges-1])-r*a1[nAges-1])-log(Tprev*exp(r)-Tlast)) / r
    w1Lx[nAges]  <- exp(-r * abar) * Tlast

This will tend to result in lower OPAG values than the original version. For a sample using CD West female level 25, with e80 = 80, the old OPAG uses 80.5 while the new uses 87.1. Another version, used in the past, would be ω + eω, which in this case would give 87.45. The original CD book (1966) used the formula: abar80 = 80 + 0.6*e80 + 0.92

Which in this case would be 85.39.

OPAG notes and questions2021-05-31.docx Considerations for testing projections using stable populations.docx