apc.plot.data.sums {apc} | R Documentation |
This plot shows sums of data matrix by age, period or cohort.
Description
Produces plots showing age, period and cohort sums. As a default this is done both for responses and dose, giving a total of six plots.
Usage
apc.plot.data.sums(apc.data.list,data.type="a",
average=FALSE,keep.incomplete=TRUE,apc.index=NULL,
type="o",log="",main.outer=NULL,main.sub=NULL)
Arguments
apc.data.list |
List. See |
data.type |
Optional. Character. "r","d","m","a" if sums are computed for responses, dose, (mortality rates), all. Rates are computed as responses/doses. Default is "a". |
average |
Optional. Logical. Sums are reported if FALSE, Averages are reported if TRUE. Default is FALSE. |
keep.incomplete |
Optional. Logical. If true perform calculation for incomplete sequences by removing NA.
If false incomplete sequences are NA. See example in |
apc.index |
Optional. List. See |
type |
Optional |
log |
Optional |
main.outer |
Optional. Character. Main title for plot, to be shown in outer margin. Default is NULL, in which case a title is generated internally. |
main.sub |
Optional. Titles for sub plots. Use with data.type "r","d","m". For data.type "a" use default. Default is NULL, in which case a title is generated internally. |
Details
The data sums are computed using apc.data.sums
. Then plotted as requested.
Note
Use apc.data.sums
if numerical values needed.
Author(s)
Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 15 Aug 2018 (15 Dec 2013)
References
Martinez Miranda, M.D., Nielsen, B. and Nielsen, J.P. (2015) Inference and forecasting in the age-period-cohort model with unknown exposure with an application to mesothelioma mortality. Journal of the Royal Statistical Society A 178, 29-55. Download: Article, Nuffield DP.
See Also
The example below uses Japanese breast cancer data, see data.Japanese.breast.cancer
Examples
#####################
# EXAMPLE with artificial data
# Generate a 3x4 matrix in "AP" data.format with the numbers 1..12
# Then make a data list
# Then plot data sums.
# Note only 3 plots are made as there are no doses
m.data <- matrix(data=seq(length.out=12),nrow=3,ncol=4)
m.data
data.list <- apc.data.list(m.data,"AP")
apc.plot.data.sums(data.list)
apc.plot.data.sums(data.list,average=TRUE)
apc.plot.data.sums(data.list,keep.incomplete=FALSE)
#####################
# EXAMPLE with Japanese breast cancer data
# Make a data list
# Then plot data sums for both responses and doses.
data.list <- data.Japanese.breast.cancer()
apc.plot.data.sums(data.list)
# Or plot data sums for responses only
apc.plot.data.sums(data.list,data.type="r")
#####################
# EXAMPLE with asbestos data
# Miranda Martinex, Nielsen and Nielsen (2013).
# This is Figure 1,a-c
data.list <- data.asbestos()
apc.plot.data.sums(data.list,type="l")