R/OPAG.R
OPAG_fit_stable_standard.Rd
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)
Pop_fit | numeric vector of at least two population counts to use for fitting |
---|---|
Age_fit | integer vector of lower bounds for age groups of |
AgeInt_fit | integer vector of widths of age groups of |
Lx1 | numeric vector of stable population standard by single ages |
Age_Lx1 | integer vector of lower bounds for age groups of |
list constaining
Standard
numeric vector, the transformed nLx
to be used for
redistribution in OPAG()
r_opt the output of optimize()
, where min
is the growth parameter, r
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.
#> Downloading nLx data for Spain, years 1971, gender femaleAge_nLx <- names2age(nLx) Lx1 <- graduate(nLx,Age=Age_nLx,method = "mono") 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) nLx <- downloadnLx(NULL, "India","male",1971)#> Downloading nLx data for India, years 1971, gender maleAge_nLx <- names2age(nLx) 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") }