Skip to contents

Visualizes results from trajectory balancing.

Usage

# S3 method for tjbal
plot(x, type = "gap", xlim = NULL, ylim = NULL,
    xlab = NULL, ylab = NULL, count = TRUE, legendOff = FALSE, 
    legend.pos = "bottom", legend.ncol = NULL, legend.labs = NULL, 
    main = NULL, raw = "none", stat = "mean", trim = TRUE, trim.wtot = 0.9, 
    theme.bw = TRUE, cex.main = NULL, cex.axis = NULL, cex.lab = NULL, 
    cex.legend = NULL, cex.text = NULL, log.weights = FALSE, wmin = NULL, 
    axis.adjust = FALSE, ...)

Arguments

x

a tjbal object.

type

a string that specifies the type of the plot. Must be one of the following: "gap" (plotting the average treatment effect on the treated; "counterfactual" or "ct" for short (plotting predicted average Y(0)'s); "balance" (plotting balance of covariates and pre-treatment outcomes before and after reweighting); "weights" (plotting the distribution of weights of the control units -- weights added up to the number of the treated units).

subgroup

a numeric value indicating the subgroup for which the results will be plotted.

xlim

a two-element numeric vector specifying the range of x-axis. When class of time varible is string, must specify not original value but a counting number e.g. xlim=c(1,30).

ylim

a two-element numeric vector specifying the range of y-axis.

xlab

a string indicating the label of the x-axis.

ylab

a string indicating the label of the y-axis.

count

a logical flag indicating whether a bar plot of the number of treated units will be shown at the bottom of the plot. The default is TRUE. Ignored if type = "balance" or type = "weights".

legendOff

a logical flag controlling whether to show the legends.

legend.pos

a character controlling the position of the legends. The default is "bottom".

legend.ncol

a numeric value controlling the number of columns of the legends.

legend.labs

a vector of characters specifying the labels of the legends.

main

a string that controls the title of the plot. If not supplied, no title will be shown.

raw

a string indicating whether or how raw data for the outcome variable will be shown in the "counterfactual" plot. Ignored if type is not "counterfactual" or treatment timing is different. Must be one of the following: "none" (not showing the raw data); "band" (showing the middle 90 percentiles of the raw data); and "all" (showing the raw data as they are).

stat

a string that specifies the statistics in the balance plot, either "mean" (showing the difference in means of covariates between the treatment and control groups before and after reweighting, normalized by the standard deviation of the corresponding covariates among the treated units, default) or "sd" (showing the difference in standard deviations of covariates between the treatment and control groups before and after reweighting, normalized by the standard deviation of the corresponding covariates among the treated units). Ignored if type is not "balance".

trim

a logical flag controlling whether to trim the control group data in a counterfactual plot when raw = "all" or raw = "band". The default is TRUE.

trim.wtot

a numeric value controlling the total sum of weights of the most heavily weighted controls to remain in the plot. The default is 0.9.

theme.bw

a logical flag controlling whether a black-white theme will be used. The default is TRUE.

cex.main

a numeric value controlling the font size of the title.

cex.axis

a numeric value controlling the font size of the axis labels.

cex.lab

a numeric value controlling the font size of the axis titles.

cex.legend

a numeric value controlling the font size of the legends.

cex.text

a numeric value controlling the font size of the text in the figure (such as Ntr = 47).

log.weights

a logical flag controlling whether to take a common logarithmic transformation of the weights. The default is FALSE. Ignored if type is not"weights".

wmin

a numeric number specifying the minimum weight (in common logarithmic). Ignored if type is not"weights".

axis.adjust

a logic flag indicating whether to adjust labels on x-axis. Useful when class of time variable is string and data magnitude is large.

...

other argv.

Details

plot.tjbal visualizes the results of trajectory balancing.

Author

Chad Hazlett <chazlett@ucla.edu>, UCLA

Yiqing Xu (Maintainer) <yiqingxu@stanford.edu>, Stanford

References

Hazlett, Chad and Yiqing Xu, 2020. ``Trajectory Balancing: A General Reweighting Approach to Causal Inference with Time-Series Cross-Sectional Data.'' Working Paper, UCLA and Stanford.

See also