cohortdeviation {APCI} | R Documentation |
Calculate cohort deviation
Description
Calculate cohort deviation
Usage
cohortdeviation(
A,
P,
C,
model = temp6,
weight = "wt",
covariate,
gee = FALSE,
unequal_interval = FALSE,
age_range = NULL,
period_range = NULL,
age_interval = NULL,
period_interval = NULL,
age_group = NULL,
period_group = NULL,
...
)
Arguments
A , P , C |
The numbers of age groups, period groups, and cohort groups separately. |
model |
A generalized linear regression model generated from the internal function temp_model |
weight |
An optional vector of sample weights to be used in the model fitting process. If non-NULL, the weights will be used in the first step to estimate the model. Observations with negative weights will be automatically dropped in modeling. |
covariate |
An optional vector of characters, representing the name(s) of the user-specified covariate(s) to be used in the model. If the variable(s) are not found in data, there will be an error message reminding the users to check the data again. |
gee |
Logical, indicating if the data is cross-sectional data or
longitudinal/panel data. If |
unequal_interval |
Logical, indicating if age and period groups are
of the same interval width. The default is set as |
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. |
... |
Additional arguments to be passed to the function. |
Value
A list containing:
cohort_average |
The estimated inter-cohort average deviations from age and period main effects. |
cohort_slope |
The estimated intra-cohort life-course linear slopes. |
int_matrix |
A matrix containing the estimated coefficients for age-by-period interactions. |
cohort_index |
Indices indicating different cohorts. |