Generalizes apc.fit.model
to a 2 sample model. For an application, see the vignette ReproducingN2025.pdf, ReproducingN2025.R on vignette.
apc.fit.model.2s(apc.data.list.1,apc.data.list.2,model.family,
model.design.common="APC",model.design.difference="APC",
gls.weight=c(1,1),apc.index=NULL,time.series=NULL)
apc.fit.table.2s(apc.data.list.1,apc.data.list.2,model.family,
restrict="difference",model.design.reference.common="APC",
model.design.reference.difference="APC",
gls.weight=c(1,1),time.series=NULL,digits=3)
List. For 1st sample. See apc.data.list
for a description of the format.
List. For 2nd sample. See apc.data.list
for a description of the format.
Character. The following options are implemented. These are used internally when
calling glm.fit
.
Gaussian regression for log(rates) and with identity link (Least Squares).
Gaussian regression for log(rates) and with identity link (Generalized Least Squares). The option gls.weight
must be used to give the relative weight of the two samples.
Gaussian regression for log(response) and with identity link (Least Squares).
Optional. Indicates which sub-model should be fitted for the common part of the parameters, that is for the sum of the canonical parameters (xi.1+xi.2)/2. Possible choices: "APC","AP","AC","PC","Ad","Pd","Cd","A","P","C","t","tA","tP","tC" and "ATC". Default is "APC"
Optional. Indicates which sub-model should be fitted for the difference part of the parameters, that is for the difference of the canonical parameters (xi.1-xi.2)/2. Possible choices: "APC","AP","AC","PC","Ad","Pd","Cd","A","P","C","t","tA","tP","tC" and "ATC". Default is "APC"
Optional for apc.fit.table.2s
. Default is "APC"
Optional for apc.fit.table.2s
. Default is "APC"
Optional for apc.fit.table.2s
. Character. Either "difference" or "common". Which type of parameter is restricted? Default is "difference
Optional. Vector. Use to set relative weights when estimating by GLS using model.family
set to "gls.log.normal.rates". GLS regression divides log(rates) and design for each sample by respective weights Weights could be their residual standard deviation in 1-sample analysis. Or, Weights could be normalized so that 2nd element is 1 and 1st element is 1-sample residual standard deviation for 1st sample divided by that of 2nd sample deviation for the first sample and 1 for second sample. Default is c(1,1)
.
Optional. List. See apc.get.index
for a description of the format. If not provided this is computed internally. If apc.fit.model
is used in a simulation study computational effort can be saved when using this option.
Optional. Vector. Should have same length as the number of periods. Double differences of period parameters will be restricted to follow double differences of the time series. Should be used with model.design.common
and/or model.design.difference
set to "ATC". Default is NULL.
Optional. Numerical. Number of digits in output. Default=3.
Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 7 Jul 2025
Nielsen, B. (2022) Two-sample age-period-cohort models with an application to Swiss suicide rates. Download: Nuffield Discussion Paper 2022-W03.