This can be used as an external check of population counts in older ages, assuming the stable population standard is representative enough, or it can be used to redistribute population in ages above a specified ages Redistribute_from. This is handy, for instance, for ensuring all censuses extend to a specified maximum age (e.g. 100+) prior to intercensal interpolations. The assumption is that, at least in ages including Age_fit and higher ages, the population should follow a stable pattern proportional to a given survival curve subject to constant growth, r.

OPAG(
Pop,
Age_Pop,
nLx,
Age_nLx,
Age_fit = NULL,
AgeInt_fit = NULL,
Redistribute_from = max(Age_Pop),
OAnew = max(Age_nLx),
method = "mono"
)

## Arguments

Pop numeric vector of population counts integer vector of the lower bounds of the population age groups numeric vector of stationary population age structure in arbitrary integer age groups integer vector of lower bounds of age groups of nLx integer vector of lower bounds for age groups of Pop_fit integer vector of widths of age groups of Pop_fit integer lower age bound that forms the cutoff, above which we redistribute counts using the stable standard. integer. Desired open age group in the output (must being element of Age_nLx) character, graduation method used for intermediate graduation. Default "mono". Other reasonable choices include "pclm" or "uniform".

## Details

It may be helpful to try more than one fitting possibility, and more than one Redistribute_from cut point, as results may vary.

Redistribute_from can be lower than your current open age group, and OAnew can be higher, as long as it is within the range of Age_nLx. If Age_nLx doesn't go high enough for your needs, you can extrapolate it ahead of time. For this, you'd want the nMx the underlie it, and you can use lt_abridged(), specifying a higher open age, and then extracting nLx again from it.

## Examples

# India Males, 1971
Pop            <- smooth_age_5(pop1m_ind,
Age = 0:100,
method = "Arriaga")
Age_Pop        <- names2age(Pop)
AgeInt_Pop     <- age2int(Age_Pop, OAvalue = 1)

AgeInt_nLx     <- age2int(Age_nLx, OAvalue = 1)

Pop_fit <- OPAG(Pop,
Age_Pop = Age_Pop,
nLx = nLx,
Age_nLx = Age_nLx,
Age_fit =  c(60,70),
AgeInt_fit = c(10,10),
Redistribute_from = 80)
#>
#> Age_Pop and Age_nLx age intervals are different!
if (FALSE) {
# look at 75+
ind <- Age_Pop >= 75
plot(Age_Pop[ind], Pop[ind])
lines(Age_Pop[ind], Pop_fit$Pop_out[ind], col = "blue") # relative differences in ages 80+ ind <- Age_Pop >= 80 plot(Age_Pop[ind], (Pop_fit$Pop_out[ind] - Pop[ind]) / Pop[ind])
}