plot.insilico {InSilicoVA} | R Documentation |
plot CSMF from a "insilico" object
Description
Produce a bar plot of the CSMFs for a fitted "insilico"
object.
Usage
## 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 |
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
|
which.sub |
Specification of which sub-population to plot if there are
multiple and |
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 |
fill |
The color to fill the bars when |
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 |
bw |
Logical indicator for setting the theme of the plots to be black and white. |
... |
Not used. |
Details
To-do
Author(s)
Zehang Li, Tyler McCormick, Sam Clark
Maintainer: Zehang Li <lizehang@uw.edu>
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.
See Also
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 plot
plot(fit1)
# basic bar plot
plot(fit1, type = "bar")
# line plot with customized look
plot(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-populations
plot(fit2, type = "compare", main = "Top 5 causes comparison")
# basic line plot for specific sub-population
plot(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 same
some_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)