apcheader {APCG1} | R Documentation |
Add group labels to each row and column of APC data matrix, so that in data plot and the output of model parameter estimates, labels will be automatically calculated and used.
apcheader(r, header = F, agestart = 1, yearstart = 1, agespan = 1, yearspan = 1)
r |
matrix of APC data with a rows and p columns, |
header |
logic value. "False" prompts to add header to the data; "True" makes no change. |
agestart, yearstart |
starting value of age and period groups. |
agespan, yearspan |
spans or number of years in each group of age and period. |
Add a header to apc data matrix and label of the effects in the plot or model fitting output. without header, the group labels are group number: 1, 2, 3, ... for the age, period, and cohort effects.
A matrix of the input APC data matrix with group labels in dimension names.
A matrix with rows as age groups and columns as periods is preferred.
Wenjiang Fu
Fu, W. (2018) A Practical Guide to Age-Period-Cohort Analysis - the Identification Problem and Beyond, CRC.
apcplot, apclinfit, apcglmfit
r = matrix(c(1:40), ncol=8, byr=TRUE) r = apcheader(r, agestart=20, yearstart=1980, agespan=10, yearspan=5)