This method offers both ordinary and modified Beers splitting, with an optional Demographic Analysis & Population Projection System Software adjustment johnson
for ages under 10.
graduate_beers(Value, Age, AgeInt, OAG = TRUE, method = "ord", johnson = FALSE)
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 = |
method | character. Valid values are |
johnson | logical. Whether or not to adjust young ages according to the Demographic Analysis & Population Projection System Software method. Default |
A numeric vector of single age data.
Ages should refer to lower age bounds. Value
must be labeled with ages unless Age
is given separately. There must be at least six 5-year age groups (including the open group, 5 otherwise). If you want the johnson
adjustment then Value
must contain a single-year estimate of the population count in age 0. That means Value
must come either as standard abridged or single age data.
method
option "ord"
conserves sums in 5-year age groups, whereas "mod"
does some smoothing between 5-year age groups too, and is not constrained.
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.
Beers HS (1945). “Modified-interpolation formulas that minimize fourth differences.” Record of the American Institute of Actuaries, 34(69), 14--20. 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. Stover J, Johnson P, Zaba B, Zwahlen M, Dabis F, Ekpini RE (2008). “The Spectrum projection package: improvements in estimating mortality, ART needs, PMTCT impact and uncertainty bounds.” Sexually Transmitted Infections, 84(Suppl 1), i24--i30.
#> 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 31940#> 0 1 2 3 4 5 #> 11932.734 11342.324 10788.613 10280.289 9826.041 9435.405#> 99 100 101 102 103 104 #> 2.8740 2.8627 2.4001 1.1396 -1.2605 -5.1419#> [1] 0# another case, starting with single ages # note beers() groups ages. Value <- pop1m_ind Age <- 0:100 names(Value) <- Age ord1 <- graduate_beers(Value, Age, OAG = TRUE, method = "ord") mod1 <- graduate_beers(Value, Age, OAG = TRUE, method = "mod") if (FALSE) { plot(Age,Value, ylab = 'The counts', xlab = 'Age groups') lines(Age, ord1, t='l', col='blue') lines(Age, mod1, t = 'l', col ='red', lty =2) legend(80,15000000, legend = c('Ordinary', 'Modified'), col=c('blue', 'red'), lty = c(1,2)) } # notice this negative value. Yuck! tail(mod1)#> 95 96 97 98 99 100 #> 59273.54 47761.30 31560.53 10671.23 -14906.60 72373.00# this replaces ages 90+, guaranteed no negatives. graduate_mono_closeout(Value, Age = Age, pops = mod1, OAG = TRUE)#> 0 1 2 3 4 5 #> 9549663.507 10101199.499 10562432.945 10933363.847 11213992.203 11404022.043 #> 6 7 8 9 10 11 #> 11503489.930 11515538.375 11441201.536 11284656.084 11051631.663 10751592.372 #> 12 13 14 15 16 17 #> 10398328.701 10010512.913 9608297.123 9215689.989 8848118.205 8512426.504 #> 18 19 20 21 22 23 #> 8219231.487 7972902.145 7776643.481 7622270.883 7490210.123 7372175.066 #> 24 25 26 27 28 29 #> 7259799.619 7140210.110 7006995.796 6860208.864 6698664.255 6524847.383 #> 30 31 32 33 34 35 #> 6350141.755 6184836.889 6038128.309 5911285.883 5801301.234 5697672.479 #> 36 37 38 39 40 41 #> 5589226.711 5464120.002 5318598.391 5152813.373 4968872.369 4773954.832 #> 42 43 44 45 46 47 #> 4580312.243 4393731.686 4218912.585 4066741.706 3940063.015 3833677.675 #> 48 49 50 51 52 53 #> 3743348.665 3661458.399 3564064.288 3436072.960 3271240.261 3071781.068 #> 54 55 56 57 58 59 #> 2848207.053 2634458.313 2457674.321 2338193.933 2278972.576 2270890.760 #> 60 61 62 63 64 65 #> 2281330.093 2277665.808 2227266.767 2121006.399 1961829.511 1771596.767 #> 66 67 68 69 70 71 #> 1577907.068 1414097.548 1289488.833 1204518.075 1144452.316 1090119.172 #> 72 73 74 75 76 77 #> 1017906.831 923319.754 808279.521 686331.243 572837.070 484976.191 #> 78 79 80 81 82 83 #> 426689.118 396508.708 384900.772 379540.402 365311.969 337647.530 #> 84 85 86 87 88 89 #> 295836.397 244315.240 190661.361 145592.692 111888.135 90214.132 #> 90 91 92 93 94 95 #> 256770.233 37448.080 22290.673 7176.951 5463.064 75195.000 #> 96 97 98 99 100 #> 13140.000 5889.000 18915.000 21221.000 72373.000# Note: there are no kludges built into beers() to handle such cases. # graduate() deals with this automatically. # This replicates Johnson_2016_BEERSP.XLS, males M <- c(184499,752124-184499,582662,463534,369976,286946,235867, 199561,172133,151194,131502,113439,95614, 78777,60157,40960,21318,25451) Age <- c(0,1,seq(5,80,by=5)) Age0 <- 184499 johnson <- graduate_beers( Value = M, Age = Age, OAG = TRUE, method = "ord", johnson = TRUE)