plot.bartcs {bartcs} | R Documentation |
bartcs
objectTwo options are available: posterior inclusion probability (PIP) plot and trace plot.
## S3 method for class 'bartcs'
plot(x, method = NULL, parameter = NULL, ...)
x |
A |
method |
" |
parameter |
Parameter for traceplot. |
... |
Additional arguments for PIP plot.
Check |
When a posterior sample is sampled during training,
separate_bart()
or single_bart()
also counts
which variables are included in the model and
compute PIP for each variable.
For bartcs
object x
,
this is stored in x$var_count
and x$var_prob
respectively.
plot(method = "pip")
uses this information and
draws plot using ggcharts::bar_chart()
.
Parameters are recorded for each MCMC iterations.
Parameters include "ATE
", "Y1
", "Y0
", "dir_alpha
",
and either "sigma2_out
" from single_bart()
or "sigma2_out1
" and "sigma2_out0
" from
separate_bart()
.
Vertical line indicates burn-in.
A ggplot
object of either PIP plot or trace plot.
data(ihdp, package = "bartcs")
x <- single_bart(
Y = ihdp$y_factual,
trt = ihdp$treatment,
X = ihdp[, 6:30],
num_tree = 10,
num_chain = 2,
num_post_sample = 20,
num_burn_in = 10,
verbose = FALSE
)
# PIP plot
plot(x, method = "pip")
plot(x, method = "pip", top_n = 10)
plot(x, method = "pip", threshold = 0.5)
# Check `?ggcharts::bar_chart` for other possible arguments.
# trace plot
plot(x, method = "trace")
plot(x, method = "trace", "Y1")
plot(x, method = "trace", "dir_alpha")