plot.SumStat: Plot the distribution of propensity scores and balance...

View source: R/plot_SumStat.R

plot.SumStatR Documentation

Plot the distribution of propensity scores and balance statistics

Description

Summarize the SumStat object, generate histogram or density of estimated propensity scores and plot the balance statistics under weighting versus no weighting.

Usage

## S3 method for class 'SumStat'
plot(
  x,
  type = "balance",
  weighted.var = TRUE,
  threshold = 0.1,
  metric = "ASD",
  breaks = 50,
  ...
)

Arguments

x

a SumStat object obtained with SumStat function.

type

a character indicating the type of plot to produce, including histogram of estimated propensity scores ("hist"), density of estimated propensity scores ("density"), and plot of balance statistics ("balance").

weighted.var

logical. Indicating whether weighted variance should be used in calculating the balance statistics. Default is TRUE.

threshold

an optional numeric value indicating the balance threshold for the balance plot. Default is 0.1. Only valid when type = "balance".

metric

a character indicating the type of metric used in balance plot. Only "ASD" or "PSD" is allowed. If not specified, the default is "ASD". See summary.SumStat for additional details on balance metrics.

breaks

a single number giving the number of cells for the histogram. Default is 50.

...

further arguments passed to or from other methods.

Details

For the balance plot, a vertical line at threshold is used to define balance on covariates. The default value is threshold = 0.1 following Austin and Stuart (2015). If more than 2 treatments are considered, only density of the estimated generalized propensity scores will be produced, regardless of whether type = "density" or type = "hist".

Value

Plot of the indicated type.

References

Austin, P.C. and Stuart, E.A. (2015). Moving towards best practice when using inverse probability of treatment weighting (IPTW) using the propensity score to estimate causal treatment effects in observational studies. Statistics in Medicine, 34(28), 3661-3679.

Examples

data("psdata")
ps.formula<-trt~cov1+cov2+cov3+cov4+cov5+cov6
msstat <- SumStat(ps.formula, trtgrp="2", data=subset(psdata,trt>1),
   weight=c("IPW","overlap","treated","entropy","matching"))

plot(msstat, type="hist")
plot(msstat, type="balance", weighted.var=TRUE, threshold=0.1, metric="ASD")


PSweight documentation built on May 29, 2024, 3:55 a.m.