apc.get.index {apc} | R Documentation |
Get indices for mapping data into trapezoid formation
Description
This function does the internal book keeping between the original data format and the trapezoid format. It creates index matrices to transform data between original format, trapezoid format and a vector, as well as values to keep track of the labels for the time scales.
The generalized trapezoids are introduced in Kuang, Nielsen and Nielsen (2008), see also Nielsen (2014).
Usage
apc.get.index(apc.data.list)
Arguments
apc.data.list |
See |
Value
A list containing the following values.
response |
Matrix. An argument |
dose |
Matrix or NULL. An argument |
data.format |
Character. An argument |
unit |
Numeric. An argument. |
data.xmax |
Numeric. Number of rows of response matrix. |
data.ymax |
Numeric. Number of columns of response matrix. |
data.xlab |
Character. Label for row index of response matrix. Derived from |
data.ylab |
Character. Label for column index of response matrix. Derived from |
data.xlab1 |
Numeric. Year for smallest row index of response matrix. |
data.ylab1 |
Numeric. Year for smallest column index of response matrix. |
n.data |
Numeric. Number of observations. |
index.data |
Matrix of dimension |
index.trap |
Matrix of dimension |
age.max |
Numeric. Number of age groups. |
per.max |
Numeric. Number of period groups. |
coh.max |
Numeric. Number of cohort groups. |
per.zero |
Numeric. Anchor for period index, so that period starts from |
per.odd |
Logic. TRUE if per.zero is odd. |
U |
Numeric. Integer value of (per.zero+3)/2. |
age1 |
Numeric. Year for smallest age index. Derived for data.format="CP", "PC", otherwise an argument. |
per1 |
Numeric. Year for smallest period index. Derived for data.format="AC","CA","CL","CL.vector.by.row","trapezoid", otherwise an argument. |
coh1 |
Numeric. Year for smallest cohort index. Derived for data.format="AP", "PA", otherwise an argument. |
Author(s)
Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 31 Mar 2015
References
Kuang, D., Nielsen, B. and Nielsen, J.P. (2008a) Identification of the age-period-cohort model and the extended chain ladder model. Biometrika 95, 979-986. Download: Article; Earlier version Nuffield DP.
Nielsen, B. (2014) Deviance analysis of age-period-cohort models. Nuffield DP.
Examples
################
# Artificial data
###############
# Artificial data
# Generate a 3x5 matrix and make arbitrary decisions for rest
response <- matrix(data=seq(1:15),nrow=3,ncol=5)
data.list <- list(response=response,dose=NULL,data.format="AP",
age1=25,per1=1955,coh1=NULL,
unit=5,per.zero=NULL,per.max=NULL,time.adjust=0)
apc.get.index(data.list)