plot_rdd_treatment

rdd.plot_rdd_treatment(
    ds: pl.DataFrame,
    treatment: ColumnName,
    running: RunningVariableConfig,
    *,
    n_bins: int = 30,
    local_polynomial_config: LocalPolynomialConfig | None = None,
    show_fit: bool = True,
)

Plot the treatment probability against the running variable.

This is the first-stage plot of the RD design. It shows binned treatment rates on either side of the cutoff and, optionally, local-linear fits.

Parameters

Name Type Description Default
ds polars.DataFrame Input data. required
treatment ColumnName Name of the binary treatment column. required
running RunningVariableConfig Running variable and cutoff. required
n_bins int Number of bins on each side of the cutoff. 30
local_polynomial_config LocalPolynomialConfig Bandwidth and kernel for the local-linear fits. When omitted, the fits use the full support on each side and no bandwidth is shaded. None
show_fit bool Whether to draw the local-linear fits. True

Returns

Name Type Description
altair.Chart First-stage plot of the treatment probability against the running variable.