The stationary standard, nLx is transformed into a stable standard by optimizing a growth rate, r such that the stable standard matches observed population counts in selected age groups. Usually the ages used for fitting are wide age groups in older ages preceding the open age group. The standard output by this function is used by OPAG to create the standard used to redistribute counts over older age groups up to a specified open age group, such as 100.

OPAG_fit_stable_standard(Pop_fit, Age_fit, AgeInt_fit, Lx1, Age_Lx1)

## Arguments

Pop_fit numeric vector of at least two population counts to use for fitting integer vector of lower bounds for age groups of Pop_fit integer vector of widths of age groups of Pop_fit numeric vector of stable population standard by single ages integer vector of lower bounds for age groups of Lx1

## Value

list constaining

1. Standard numeric vector, the transformed nLx to be used for redistribution in OPAG()

2. r_opt the output of optimize(), where min is the growth parameter, r

## Details

The argument method don't have much leverage on the result. In short, the stable population transformation is done by ungrouping nLx to single ages (if it isn't already), and method controls which graduation method is used for this, where "uniform", "mono", "pclm" are the reasonable choices at this writing.

## Examples

Pop_fit    <- c(85000,37000)
Age_fit    <- c(70,80)
Age_Lx1 <- 0:100
# India Males, 1971
Pop        <- smooth_age_5(pop1m_ind,
Age = 0:100,
method = "Arriaga")
Pop80      <- groupOAG(Pop, names2age(Pop), 80)
Age        <- names2age(Pop80)

Pop_fit    <- groupAges(Pop80, Age, N = 10)[c("60","70")]
Age_fit    <- c(60,70)
AgeInt_fit <- c(10,10)

Standard <- OPAG_fit_stable_standard(
Pop_fit = Pop_fit,
Age_fit = Age_fit,
AgeInt_fit = AgeInt_fit,
Lx1=Lx1,
Age_Lx1 = Age_Lx1
)

# A visual comparison:
nL60 <- rescale_vector(nLx[Age_nLx >= 60])
St60p <- rescale_vector( Standard\$Standard[c(0:100) >= 60] )
ages_plot <- seq(60,100,by=5)
if (FALSE) {
plot(ages_plot,nL60, type = 'l')
lines(60:100, St60p, col = "blue")
}