Produce a bar plot of the CSMFs for a fitted "insilico" object.
## S3 method for class 'insilico'plot( x, type = c("errorbar","bar","compare")[1], top =10, causelist =NULL, which.sub =NULL, xlab ="Causes", ylab ="CSMF", title ="Top CSMF Distribution", horiz =TRUE, angle =60, fill ="lightblue", err_width =0.4, err_size =0.6, point_size =2, border ="black", bw =TRUE,...)
Arguments
x: fitted "insilico" object
type: An indicator of the type of chart to plot. "errorbar" for line plots of only the error bars on single population; "bar" for bar chart with error bars on single population; "compare" for line charts on multiple sub-populations.
top: The number of top causes to plot. If multiple sub-populations are to be plotted, it will plot the union of the top causes in all sub-populations.
causelist: The list of causes to plot. It could be a numeric vector indicating the position of the causes in the InterVA cause list (see causetext), or a vector of character string of the cause names. The argument supports partial matching of the cause names. e.g., "HIV/AIDS related death" could be abbreviated into "HIV"; "Other and unspecified infect dis" could be abbreviated into "Other and unspecified infect".
which.sub: Specification of which sub-population to plot if there are multiple and type is set to "bar".
xlab: Labels for the causes.
ylab: Labels for the CSMF values.
title: Title of the plot.
horiz: Logical indicator indicating if the bars are plotted horizontally.
angle: Angle of rotation for the texts on x axis when horiz is set to FALSE
fill: The color to fill the bars when type is set to "bar".
err_width: Size of the error bars.
err_size: Thickness of the error bar lines.
point_size: Size of the points.
border: The color to color the borders of bars when type is set to "bar".
bw: Logical indicator for setting the theme of the plots to be black and white.
...: Not used.
Details
To-do
Examples
## Not run:data(RandomVA1)#### Scenario 1: without sub-population specification##fit1<- insilico(RandomVA1, subpop =NULL, Nsim =1000, burnin =500, thin =10, seed =1, auto.length =FALSE)# basic line plotplot(fit1)# basic bar plotplot(fit1, type ="bar")# line plot with customized lookplot(fit1, top =15, horiz =FALSE, fill ="gold", bw =TRUE, title ="Top 15 CSMFs", angle =70, err_width =.2, err_size =.6, point_size =2)#### Scenario 2: with sub-population specification##data(RandomVA2)fit2<- insilico(RandomVA2, subpop = list("sex"), Nsim =1000, burnin =500, thin =10, seed =1, auto.length =FALSE)summary(fit2)# basic side-by-side line plot for all sub-populationsplot(fit2, type ="compare", main ="Top 5 causes comparison")# basic line plot for specific sub-populationplot(fit2, which.sub ="Women", main ="Top 5 causes for women")# customized plot with only specified causes# the cause names need not be exact as InterVA cause list# substrings in InterVA cause list is enough for specification# e.g. the following two specifications are the samesome_causes_1 <- c("HIV/AIDS related death","Pulmonary tuberculosis")some_causes_2 <- c("HIV","Pulmonary")plot(fit2, type ="compare", horiz =FALSE, causelist = some_causes_1, title ="HIV and TB fractions in two sub-populations", angle =20)## End(Not run)
References
Tyler H. McCormick, Zehang R. Li, Clara Calvert, Amelia C. Crampin, Kathleen Kahn and Samuel J. Clark Probabilistic cause-of-death assignment using verbal autopsies, Journal of the American Statistical Association (2016), 111(515):1036-1049.