
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.
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)
matrix (or vector). Numbers of responses.
matrix (or NULL). Numbers of doses.
"trapezoid"
Numeric.
Numeric.
Numeric.
Numeric.
Numeric.
Numeric.
List. See apc.data.list
for a description of the format.
Optional. Numeric. Specifies how many age groups to cut at lower end. Default is zero.
Optional. Numeric. Specifies how many period groups to cut at lower end. Default is zero.
Optional. Numeric. Specifies how many cohort groups to cut at lower end. Default is zero.
Optional. Numeric. Specifies how many age groups to cut at upper end. Default is zero.
Optional. Numeric. Specifies how many period groups to cut at upper end. Default is zero.
Optional. Numeric. Specifies how many cohort groups to cut at upper end. Default is zero.
Optional. List. See apc.get.index
for a description of the format. If not provided this is computed internally.
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.
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
.
Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 4 Dec 2013 recoded 26 Apr 2017
The below example uses artificial data. For an example using
data.asbestos
see
apc.plot.fit
.
###############
# 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)
Run the code above in your browser using DataLab