This is exactly the function pclm() from the ungroup package, except with arguments using standard DemoTools argument names.

graduate_pclm(Value, Age, AgeInt, OAnew = max(Age), OAG = TRUE, ...)

Arguments

Value

numeric vector, presumably counts in grouped ages

Age

integer vector, lower bounds of age groups

AgeInt

integer vector, age interval widths

OAnew

integer, optional new open age, higher than max(Age). See details.

OAG

logical, default = TRUE is the final age group open?

...

further arguments passed to ungroup::pclm()

Details

The PCLM method can also be used to graduate rates using an offset if both numerators and denominators are available. In this case Value is the event count and offset is person years of exposure. The denominator must match the length of Value or else the length of the final single age result length(min(Age):OAnew). This method can be used to redistribute counts in the open age group if OAnew gives sufficient space. Likewise, it can give a rate extrapolation beyond the open age.

If there are 0s in Value, these are replaced with a small value prior to fitting. If negatives result from the pclm fit, we retry after multiplying Value by 10, 100, or 1000, as sometimes a temporary rescale for fitting can help performance.

Age be any age range, it does not need to start at 0.

References

Pascariu MD, Dańko MJ, Schöley J, Rizzi S (2018). “ungroup: An R package for efficient estimation of smooth distributions from coarsely binned data.” Age, 10, 0. Rizzi S, Gampe J, Eilers PH (2015). “Efficient estimation of smooth distributions from coarsely grouped data.” American journal of epidemiology, 182(2), 138--147.

See also

Examples

a5 <- seq(0,100,by=5) p5 <- pop5_mat[, 1] p1 <- graduate_pclm(Value = p5, Age = a5)
#> #> 0s detected in Value, replacing with .01
p1s <- graduate_sprague(Value = p5, Age = a5) if (FALSE) { plot(a5, p5/5, type = "s",xlim=c(40,60),ylim=c(2000,4000)) lines(0:100, p1, lwd = 2, col = "red") lines(0:100, p1s, lwd = 1, col = "blue",lty="8282") } # example of how to graduate rates by splitting deaths using population # as PCLM offset dth.ind <- c(49, 14, 9, 39, 60, 101, 147, 178, 177, 232) pop.ind <- c(7231, 28400, 66836, 52380, 38022, 36886, 26145, 14205, 6406, 3322) age <- c(0,1,5,15,25,35,45,55,65,75) mx <- graduate_pclm(Value = dth.ind, Age = age, OAnew = 85, offset = pop.ind) if (FALSE) { plot(age, dth.ind / pop.ind, type = 's', log = 'y', xlim = c(0,85)) lines(0:85, mx, col = "red") }