plot: Plot methods for 'bartc'

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Visual exploratory data analysis and model fitting diagnostics for causal inference models fit using the bartc function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
plot_sigma(x, main = "Traceplot sigma", 
           xlab = "iteration", ylab = "sigma",
           lty = 1:x$n.chains,
           ...)

plot_est(x, main = paste("Traceplot", x$estimand),
         xlab = "iteration", ylab = x$estimand,
         lty = 1:x$n.chains, col = NULL,
         ...)

plot_indiv(x, main = "Histogram Individual Effects",
           xlab = "treatment effect",
           breaks = 20,
           ...)

plot_support(x, main = "Common Support Scatterplot",
             xvar = "tree.1", yvar = "tree.2",
             xlab = NULL, ylab = NULL,
             pch.trt = 21, bg.trt = "black",
             pch.ctl = pch.trt, bg.ctl = NA,
             pch.sup = pch.trt, bg.sup = NA, col.sup = "red", cex.sup = 1.5,
             legend.x = "topleft", legend.y = NULL,
             ...)

Arguments

x

Object of class bartcFit.

main

Character title of plot.

xlab

Character label of x axis. For plot_support, if NULL a default will be used.

ylab

Character label of y axis. For plot_support, if NULL a default will be used.

lty

For line plots (plot.sigma, plot.est), models use the values of lty to visually distinguish each chain.

lty

For plot.est, use the values of col to visually distinguish each group, if there are any.

breaks

Argument to codehist.

xvar

Variable for use on x axis. Can be one of "tree.XX", "pca.XX", "css", "p.score", "y", "y0", "y1", "indiv.diff", "p.score", "p.weights", the number of name of a column used to fit the response model, or a given vector. See below for details.

yvar

Variable for use on the y axis, of the same form as xvar.

pch.trt

pch point value used when plotting treatment observations.

bg.trt

bg background value used when plotting treatment observations.

pch.ctl

pch point value used when plotting control observations.

bg.ctl

bg background value used when plotting treatment observations.

pch.sup

pch point value used when plotting suppressed observations.

bg.sup

bg background value used when plotting suppressed observations.

col.sup

col color value used when plotting suppressed observations.

cex.sup

cex size value used when plotting suppressed observations.

legend.x

x value passed to legend. If NULL, legend plotting is skipped.

legend.y

Optional y value passed to legend

...

Optional graphical parameters.

Details

Produces various plots using objects fit by bartc. plot_sigma and plot_est are traditional parameter trace plots that can be used to diagnose the convergence of the posterior sampler. If the bartc model is fit with n.chains greater than one, by default each chain will be plotted with its own line type.

plot_indiv produces a simple histogram of the distribution of the estimates of the individual effects, taken as the average of their posterior samples.

plot_support is used to visualize the common support diagnostic in the form of a scatterplot. Points that the diagnostic excludes are outlined in red. The contents of the x and y axes are controlled by the xvar and yvar arguments respectively and can be of the form:

Value

None, although plotting occurs as a side-effect.

Author(s)

Vincent Dorie: vdorie@gmail.com.

See Also

bartc

Examples

1
2
3
4
5
6
7
8
## Not run: 
fit <- bartc(...)

plot_sigma(fit)

plot_support(fit, xvar = "tree.1", yvar = "css", legend.x = NULL)

## End(Not run)

lurui0421/BartCause documentation built on July 4, 2019, 1:02 p.m.