Computes the cumulative rate up to a specified age limit, typically used in cancer epidemiology to estimate the probability of developing or dying from a disease over a lifetime or up to a target age.
cumrate(
count,
pop,
rate = NULL,
eage = 70,
agewidth = 5,
sep_zero = TRUE,
mp = 1,
decimal = 6
)
Numeric vector, number of incident cases or deaths in each age group.
Numeric vector, corresponding population at risk for each age group.
Numeric vector, age-specific incidence or mortality rates. If not
supplied, it will be calculated as count / pop
.
Integer, the upper age limit (e.g., 70) up to which the cumulative rate is calculated.
Integer, width of the age intervals (e.g., 5 for 5-year bands).
Logical, whether the 0–1 age group is separated (i.e.,
age groups are 0, 1–4, 5–9, ...). Default is TRUE
.
Numeric. A multiplier used to scale the final cumulative rate
(e.g., 100,000 or 1). Default is 1
.
Integer, number of decimal places to round the result.
Default is 6
.
A named numeric value representing the cumulative rate, scaled
by mp
.
px <- c(
20005, 86920, 102502, 151494, 182932, 203107, 240289, 247076, 199665,
163820, 145382, 86789, 69368, 51207, 39112, 20509, 12301, 6586, 1909
)
dx <- c(
156, 58, 47, 49, 48, 68, 120, 162, 160, 294, 417, 522, 546, 628,
891, 831, 926, 731, 269
)
mx <- dx / px
cumrate(mx, eage = 70)
#> Cumulative Rate(1/1)
#> 0.497705