apc.get.index: Get indices for mapping data into trapezoid formation

Description Usage Arguments Value Author(s) References Examples

View source: R/apc_get_index.R

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

1

Arguments

apc.data.list

See apc.data.list for a description of the format

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.format.

data.ylab

Character. Label for column index of response matrix. Derived from data.format.

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 n.datax2. Index pairs for observations in the original coordinate system as given by data.format. Same order as in index.trap.

index.trap

Matrix of dimension n.datax2. Index pairs for observations in an age/cohort system. Hence the coordinates of a trapezoid matrix. Same order as in index.data.

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.zero+1.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
################
#	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)

apc documentation built on Oct. 23, 2020, 6:17 p.m.