rescaleAgeGroups: Rescale counts in age groups to match counts in different age...

Description Usage Arguments Details

View source: R/utils.R

Description

This method rescales a vector of counts in arbitrary (integer) age groups to approximate a vector of counts in a potentially different age grouping. Common use cases will be to scale single ages (whose age pattern we wish to roughly maintain) to sum to abridged or 5-year age groups from another source. The counts to be rescaled could potentially be in any grouping (see example).

Usage

1
2
3
4
5
6
7
8
9
rescaleAgeGroups(
  Value1,
  AgeInt1,
  Value2,
  AgeInt2,
  splitfun = splitUniform,
  recursive = FALSE,
  tol = 0.001
)

Arguments

Value1

numeric vector. A vector of demographic counts for population 1.

AgeInt1

integer vector. Age interval widths for population 1.

Value2

numeric vector. A vector of demographic counts for population 2.

AgeInt2

integer vector. Age interval widths for population 2.

splitfun

function to use for splitting pop1. Presently on splitUniform() works.

recursive

logical. Shall we repeat the split/regroup/rescale process until stable? See details. Default FALSE.

tol

numeric. Default 1e-3. The numerical tolerance for the residual. Used to detect stability if recursive = TRUE.

Details

If the final age group is open, define its age interval as 1.

Presently the intermediate splitting function assumes that counts inside the age groups of population 1 are uniformly distributed, although this may be relaxed if other methods become available whose behavior matches that of splitUniform(). splitMono() will be modified soon to be applicable here.

The method is an original contribution. It works by first splitting the counts of Value1 to single ages using the assumptions of splitfun(), which presently only works for splitUniform(). Value1 is then rescaled such that were it re-grouped to match the age classes of Value2 they would be identical. If recursive = FALSE, the single-age rescaled Value1 data are returned regrouped to their original ages. If recursive = TRUE, the process is repeated until Value1 is rescaled such that it could be split and regrouped to Value2 using the same process a single time with no need for further rescaling. If age groups in Value1 are very irregular, recursive = TRUE can induce noise (see example). If the age groups of Value1 nest cleanly within the age groups of Value2 then recursion is unnecessary. This is the case, for example, whenever Value1 is in single ages and Value2 is in grouped ages, which is likely the most common usage scenario.


hhmacedo/dmtls documentation built on Dec. 20, 2021, 3:49 p.m.