reaggregate_interval_rates {ageutils} | R Documentation |
Reaggregate rates across intervals
Description
reaggregate_interval_rates()
enables the reweighting of interval rates in
to different intervals ranges. It first replicates the rates of a given
age interval into the individual years of said interval. These are then
aggregated allowing for a user specified weight vector.
Usage
reaggregate_interval_rates(
lower_bounds,
upper_bounds = NULL,
rates,
breaks,
weights = NULL
)
Arguments
lower_bounds , upper_bounds |
A pair of vectors representing the bounds of the current intervals. If
Missing (NA) bounds are not permitted. Double vectors will be coerced to integer. |
rates |
Vector of counts to be averaged. |
breaks |
1 or more non-negative cut points in increasing (strictly) order. These correspond to the left hand side of the desired intervals (e.g. the closed side of [x, y). Double values are coerced to integer prior to categorisation. |
weights |
Population weightings to apply for individual years. If If specified, must be of length most 2000 and represent weights in the range 0:1999.
|
Value
A data frame with 4 entries; interval
, lower_bound
, upper_bound
and an
associated count
.
Examples
reaggregate_interval_rates(
lower_bounds = c(0, 5, 13),
upper_bounds= c(5, 15, 100),
rates = c(1, 0.1, 0.01),
breaks = c(0, 1, 9, 15),
weights = round(runif(70, 10, 30))
)
reaggregate_interval_rates(
lower_bounds = c(0, 5, 13),
rates = c(1, 0.1, 0.01),
breaks = c(0, 1, 9, 15),
weights = round(runif(70, 10, 30))
)