Skip to contents

Generates a ggplot visualization of outcomes across running variable values, including standard LOESS fits and upper/lower bounds. Intended for use with partial‑identification analyses to illustrate treatment and outcome probabilities around the cutoff.

Usage

outcomes_plot(
  prop,
  xl,
  Yl,
  xr,
  Yr,
  upperWeights,
  lowerWeights,
  ylab,
  xlab,
  title,
  order,
  hist,
  trueCounts,
  cutoff
)

Arguments

prop

Data.frame with columns x_value, avg.prop.

xl

Numeric vector of x-values for left-side LOESS.

Yl

Numeric vector of y-values for left-side LOESS.

xr

Numeric vector of x-values for right-side LOESS.

Yr

Numeric vector of y-values for right-side LOESS.

upperWeights

Numeric vector of weights for the upper bound LOESS.

lowerWeights

Numeric vector of weights for the lower bound LOESS.

ylab

Character. Label for the y-axis.

xlab

Character. Label for the x-axis.

title

Character. Plot title.

order

Integer. Degree of LOESS polynomial (1 = linear, 2 = quadratic).

hist

Data.frame with histogram counts (x_value, Freq).

trueCounts

Data.frame with non-manipulated observation counts (x_value, n_true).

cutoff

Numeric. Running variable cutoff value.

Value

A ggplot object representing the outcomes plot.

Required Inputs

  • prop – data.frame with columns x_value and avg.prop.

  • hist – data.frame with histogram counts (x_value, Freq).

  • true_counts – data.frame with columns x_value, n_true.

  • xl, Yl – numeric vectors for left‑side LOESS regression.

  • xr, Yr – numeric vectors for right‑side LOESS regression.

Examples

if (FALSE) { # \dontrun{
outcomes_plot(prop_df, xl, Yl, xr, Yr,
              upperWeights, lowerWeights,
              ylab = "Treatment Probability",
              title = "Treatment by Running Variable",
              order = 1, hist_df, counts_df, cutoff = 12)
} # }