apc.data.list.subset {apc}R Documentation

Cut age, period and cohort groups from data set.

Description

For a recursive analysis it is useful to be able to cut age, period and cohort groups from a data set. Function returns an apc.data.list with data.format "trapezoid".

When used with default values the function turns an apc.data.list into a new apc.data.list with data.format "trapezoid" without reducing dataset.

Usage

apc.data.list.subset(apc.data.list,
							age.cut.lower=0,age.cut.upper=0,
							per.cut.lower=0,per.cut.upper=0,
							coh.cut.lower=0,coh.cut.upper=0,
							apc.index=NULL,
							suppress.warning=FALSE)

Arguments

apc.data.list

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

age.cut.lower

Optional. Numeric. Specifies how many age groups to cut at lower end. Default is zero.

per.cut.lower

Optional. Numeric. Specifies how many period groups to cut at lower end. Default is zero.

coh.cut.lower

Optional. Numeric. Specifies how many cohort groups to cut at lower end. Default is zero.

age.cut.upper

Optional. Numeric. Specifies how many age groups to cut at upper end. Default is zero.

per.cut.upper

Optional. Numeric. Specifies how many period groups to cut at upper end. Default is zero.

coh.cut.upper

Optional. Numeric. Specifies how many cohort groups to cut at upper end. Default is zero.

apc.index

Optional. List. See apc.get.index for a description of the format. If not provided this is computed internally.

suppress.warning

Optional. Logical. Suppresses warnings. This is useful when generating data sums using apc.data.sums but reducing the data set so much that models cannot be fitted.

Value

response

matrix (or vector). Numbers of responses.

dose

matrix (or NULL). Numbers of doses.

data.format

"trapezoid"

age1

Numeric.

per1

Numeric.

coh1

Numeric.

unit

Numeric.

per.zero

Numeric.

per.max

Numeric.

Arguments: Notes

If apc.index is supplied then the input can be simplified. It suffices to write apc.data.list = list(response=response,data.format=data.format,dose=dose), where dose could be dose=NULL. Likewise apc.index does not need to be a full apc.index list. It suffices to construct a list with entries age.max, per.max, coh.max, age1, per1, coh1, unit, per.zero, index.trap, index.data.

Author(s)

Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 4 Dec 2013 recoded 26 Apr 2017

See Also

The below example uses artificial data. For an example using data.asbestos see apc.plot.fit.

Examples

###############
#	Artificial data
#	Generate a 5x7 matrix and make arbitrary decisions for rest

response <- matrix(data=seq(1:35),nrow=5,ncol=7)
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)
data.list

apc.data.list.subset(data.list,1,1,0,0,0,0)



[Package apc version 2.0.0 Index]