apclinfit {APCG1}R Documentation

APC Linear Models

Description

Fit a linear model with fixed effects of the age, period, and/or cohort groups to APC data.

Usage

apclinfit(r, apcmodel = "AP", header = F, Plot = F, pylim = c(0, 0), 
transform = "log", ref = c(0, 0, 0), apc = 0, lindex = 0, lvalue = 0, 
amin = 1, pmin = 1, cmin = 1, gapyear = 1, ModelDiag = F, pcex = 1)

Arguments

r

APC data in a matrix of dimension (a by p) as response variable of the linear model, either the original or log scale.

apcmodel

specify the effects in the model, "A", "P", and "C" for single factor models; "AP"and "AC" for two factor samples; and "APC" for full age-period-cohort model.

header

logic value, if True, label the effects by the dimnames of the matrix.

Plot

logic value, whether to plot the effect estimates.

pylim

range of effect estimates in plot.

transform

specify the scale of the response variable, and fit the model to the original ("ID") or log ("log") scale.

ref

a 3-dimensional vector specifying side conditions on the effects of age, period, and cohort. Value 0 is centralization (sum of the effect equals to 0). positive integer indicates the reference level.

apc

specify factor in a constraint: 1 for age effects; 2 for period effects; 3 for cohort effects. 0 for intrinsic estimator.

lindex, lvalue

vectors to specify effect levels (lindex) and coefficients (lvalue) in a constraint: lindex*lvalue = 0.

amin, pmin, cmin

start values of age, period and cohort labels. Not required for data with header.

gapyear

number of units in each age or period group for the labels. Not required for data with header.

ModelDiag

logic value, if True, produce residual plot of the linear model against the fitted value for model diagostics.

pcex

specify the font of plot charaters.

Details

Fit a linear model to the APC data (rate or value) or its log-tranformation. It estimates fixed effects of age (row), period (column), and cohort (diagonal) with a specified side condition (centralization for all as default). Following the discussion (Fu 2018) that the centralization yields efficient estimation with the smallest variance. As options, it may fit single factor models by specifying apcmodel = "A", "P", or "C", two factor models by "AP" or "AC", or full APC model by "APC". The full APC model estimates the fixed effects and the standard errors with the intrinsic estimator method (Fu 2000, 2016) with apc=0, or estimates the effects with bias by specifying a constraint. It calls the running horse function: apclinfit_run to fit the linear model. Constraint may be specified through a linear combination of effects, lindex*lvalue=0.

Value

model

Linear model fitted to the data.

transform

scale of response variable

varcomp

variance component and residual degrees of freedom

F.stats

F-statistic assessing the linear model significance

Rsquared

R-square and adjusted R-square

Parameter

estimates for the intercept, model parameters, standard errors, t values, and p-values.

Note

A plot of estimates may also be generated as an option. Always use data with a header for the ease of group labels.

Author(s)

Wenjiang Fu

References

Fu, W. (2000) Ridge estimator in singular design with application to age-period-cohort analysis of disease rates, Comm Statist. Theory Method, 29:263-278.

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.

See Also

apcglmfit, apclinkfit

Examples

x=APCG_data(apcdata="hiv", header=TRUE)
apclinfit(r=x$rate,  apcmodel = "APC",apc=0, Plot = TRUE, header = TRUE, ModelDiag = TRUE)

[Package APCG1 version 1.0 Index]