ageperiod_group {APCI}R Documentation

Get the cohort index matrix for any age and period groups

Description

This function returns the cohort index matrix for any age and period groups. The cohort index matrix will then be used to extract the cohort effects.

Usage

ageperiod_group(
  age_range,
  period_range,
  age_interval = NULL,
  period_interval = NULL,
  age_group = NULL,
  period_group = NULL
)

Arguments

age_range, period_range

Numeric vector indicating the actual age and period range (e.g., 10 to 59 years old from 2000 to 2019).

age_interval, period_interval, age_group, period_group

Numeric values or character vectors indicating how age and period are grouped. age_interval and period_interval are numbers indicating the width of age and period groups respectively. age_group and period_group are character vectors explicitly listing all potential age and period groups. Either age_interval(period_interval) or age_group (period_group) have to be defined when unequal_interval is TRUE.

Value

a matrix respresenting the relationship among age, period, and cohort groups under the current setting.

Examples

## age and period groups have equal width
ageperiod_group(age_range = 10:59, period_range = 2000:2019,
                age_interval = 5, period_interval = 5)
ageperiod_group(age_range = 10:59, period_range = 2000:2019,
                age_group = c("10-14","15-19","20-24","25-29",
                              "30-34","35-39","40-44","45-49",
                              "50-54","55-59"),
                period_group = c("2000-2004","2005-2009","2010-2014",
                                 "2015-2019"))

## age and period groups have unequal width
ageperiod_group(age_range = 10:59, period_range = 2000:2019,
                age_interval = 10, period_interval = 5)
ageperiod_group(age_range = 10:59, period_range = 2000:2019,
                age_group = c("10-19","20-29","30-39","40-49","50-59"),
                period_group = c("2000-2004","2005-2009",
                                 "2010-2014","2015-2019"))


[Package APCI version 1.0.7 Index]