This method is used to interpolate counts based on the Sprague formula. It is based on the first stage of the Sprague R script prepared by Thomas Buettner and Patrick Gerland, itself based on the description in Siegel and Swanson, 2004, p. 727.
graduate_sprague(Value, Age, AgeInt, OAG = TRUE)
Value | numeric vector, presumably counts in grouped ages |
---|---|
Age | integer vector, lower bounds of age groups |
AgeInt | integer vector, age interval widths |
OAG | logical, default = |
Numeric vector of counts split into single ages.
Ages should refer to lower age bounds, ending in the open age group in the last row (not a closed terminal age). Dimension labeling is necessary. There must be at least six age groups (including the open group). One year of data will work as well, as long as it's given as or coercible to a single-column matrix. This method may produce negative values, most likely in the youngest or oldest ages. This case is dealt with in the graduate()
wrapper function but not in this function.
If the highest age does not end in a 0 or 5, and OAG == TRUE
, then the open age will be grouped down to the next highest age ending in 0 or 5. If the highest age does not end in a 0 or 5, and OAG == FALSE
, then results extend to single ages covering the entire 5-year age group.
Sprague TB (1880). “Explanation of a new formula for interpolation.” Journal of the Institute of Actuaries, 22(4), 270--285. Shryock HS, Siegel JS, Larmon EA (1973). The methods and materials of demography. US Bureau of the Census. Siegel Jacob S, Swanson David A (eds.) (2004). The Methods and Materials of Demography, 2 edition. Elsevier Academic Press, California, USA, San Diego, USA.
#> 1950 1951 1952 1953 1954 #> 0 54170 57424 60272 62727 64816 #> 5 44775 44475 44780 45681 47137 #> 10 42142 41752 41804 42101 42508 #> 15 38464 39628 40229 40474 40532 #> 20 34406 34757 35155 35599 36083 #> 25 30386 30605 30978 31439 31940a5 <- as.integer(rownames(pop5_mat)) # the last value is an open age group, preserve as such: p1 <- graduate_sprague(Value = pop5_mat[,1], Age = a5, OAG = TRUE) head(p1); tail(p1)#> 0 1 2 3 4 5 #> 12172.491 11380.448 10717.448 10171.000 9728.613 9377.795#> 95 96 97 98 99 100 #> 5.8576 4.5040 3.4240 2.3200 0.8944 0.0000#> [1] 0# another case, starting with single ages Age <- 0:100 # notice how this particular case produces a negative value in the last age # before OAG: pops <- graduate_sprague(Value = pop1m_ind, Age = Age, OAG = TRUE) # the graduate() wrapper deals with this automatically. if (FALSE) { plot(seq(0,100,by=5), pop5_mat[,1]/5, type = 's') lines(0:100, p1, lty = 1, col = "red") }