apcglmfit {APCG1}R Documentation

APC Generalized Linear Model

Description

Fit a generalized linear model to APC data. So far, loglinear model only for APC data.

Usage

apcglmfit(r, header = F, n.risk = NA, apcmodel = "AP", fam = "loglin", 
Plot = F, pylim = c(0, 0), Scale = 1e-05, apc = 0, lindex = 0, 
lvalue = 0, amin = 1, pmin = 1, cmin = 1, n.interval = 1, pcex = 1)

Arguments

r

matrix of APC rate or value with rows as age groups and columns as period groups

header

logic value, if True, the matrix r has row and column dimnames as header

n.risk

population exposure matrix having the same dimension as matrix r. Its header is not required.

apcmodel

models to fit APC data: "A", "P", "C" for single factor models; "AP", "AC" for two factor models, or "APC" for full APC model.

fam

family of models to fit: "loglin" for loglinear model, or "qlik" for quasi-Poisson (loglinear) model.

Plot

logic value, whether to plot the effect estimates

pylim

range of values in estimate plot

Scale

scales of data r, default is 1e-5 for rate.

apc

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

lindex, lvalue

values to specify effects and coefficients in a constraint: lindex*lvalue = 0.

amin, pmin, cmin

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

n.interval

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

pcex

value to specify font of plot charaters.

Details

Fit a generalized linear model to the frequency following a Poisson distribution with population exposure as the offset term log(pop). It calculates the frequency with the rates multiplied by the population exposure and by the scale as response variable. It estimates fixed effeccts of rows, columns, and diagonals. It may fit with a quasi-likelihood approach for option fam = "qlik" while default is fam = "loglin". The model may choose to specify apcmodel = "A", "P", "C" for single factor model, "AP" or "AC" for two factor model, and "APC" for full age-period-cohort model. The full APC model estimates the effects with the intrinsic estimator method (Fu 2016), the standard errors for the period and cohort effects are estimated with the Delta method (Fu 2018). It calls the running horse function apcglmfit_run.

Value

model

specification of model and family

deviance

model deviance and degrees of freedom

pearson.chisq

the Pearson chi-square statistic

p.val

p-value of the model goodness-of-fit by the deviance following chi-squares distribution.

dispersion

dispersion parameter, if quasi-likelihood is specified

parameter

parameter estimates for the intercept, age, period, and cohort effects, standard errors, Z values (or t values, if quasi-likelihood is specified), and p-values.

Author(s)

Wenjiang Fu

References

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

apclinfit

Examples

x = APCG_data(apcdata="lungCAmale",header=TRUE) 
apcglmfit(r=x$rate,n.risk = x$pop, header=TRUE, Plot=TRUE, 
 apcmodel = "APC",apc=0, Scale = 1e-5,fam="qlik")

[Package APCG1 version 1.0 Index]