apclinkfit {APCG1} | R Documentation |
Fit linear model of fixed effects of age, period, and cohort to APC data of unequal spans.
apclinkfit(r, Plot = F, CIplot = T, transform = "log", amin = 1, pmin = 1, cmin = 1, agapyr = 1, lambda = 0, pgapyr = 1, cgapyr = 1, p0 = 0, k = 1, header = F, ModelDiag = F, pplim = c(0, 0))
r |
matrix of APC data of rate or value with a rows and p columns. The rows (age groups) and columns (periods) have different spans, often agespan is larger than periodspan, such as 10 year agespan and 3 year periodspan. |
Plot |
Logic value, if True, plot effect estimates. |
CIplot |
Logic value, if True, plot effect estimates with 95% confidence interval. |
transform |
scale of response variable for linear model, either linear scale ("ID") or log scale ("log"). |
amin, pmin, cmin |
Start values of labels for age, period, and cohort effects. |
agapyr, pgapyr, cgapyr |
span (number of years in each group) of age, period, and cohort. |
lambda |
penalty tuning parameter, value 0 indicates the use of intrinsic estimator method. |
p0 |
The number of columns in the first collapsed period for modeling, it can be incomplete period so that the total number of collapsed periods (thus the number of cohorts) may be greater. |
k |
number of periods to collapse in order to achieve about the same number of years as in each age group by the intend-to-collapse method. |
header |
logic value, if True, the matrix r has row and column dimnames as header. |
ModelDiag |
logic value, if True, produce residual plot against fitted value for model diagnostics. |
pplim |
range of estimate plot, all plots have the same range. |
APC unequal span data is fitted with the APC effects using the intend-to-collapse (ITC) method to code the cohort effect. The ITC method does not collapse data, thus does not result in fewer periods (when period span is smaller than age span). All original age and period groups are kept in modeling, while cohort effects are coded according to the ITC method so that real cohorts rather than the table diagonals are estimated. The intrinsic estimator method is also applied to estimate the effects of age, period and cohorts.
model |
model fitted to the APC data. |
scale |
scale of response variable. |
Rsquared |
R-square and adjusted R-square |
varcomp |
variance component and residual degrees of freedom |
Parameter |
estimates for the intercept, model parameters, standard errors, t values, and p-values. |
A plot of estimates may also be generated as an option. Due to incomplete period in the first collapsed period, the label of the first cohort may need to be adjusted. Hence cmin is handy to specify.
Wenjiang Fu
Fu, W. (2016) Constrained Estimators and COnsistency of a Regression Model on a Lexis diagram, JASA, Vol 111:180-199.
Fu, W. (2018) A Practical Guide to Age-Period-COhort Analysis: the Identification Problem and Beyond, CRC.
apcglmfit, alclinfit
x=APCG_data(apcdata="retire", header=TRUE)$med.value apclinkfit(r=x, header=TRUE, p0=1, k=3, transform = "log", Plot = TRUE, CIplot=TRUE, agapyr=10, pgapyr=3, cgapyr=10, cmin=1910, pplim=c(-1.5,0.7))