RddDistributionResult

rdd.RddDistributionResult(
    qtt: pl.DataFrame,
    att: pl.DataFrame,
    outcome: ColumnName,
    group: tuple[str, ...] | None,
    treatment: ColumnName,
    running: ColumnName,
    cutoff: float,
    local_polynomial_config: LocalPolynomialConfig,
    outcome_grid_size: int,
    first_stage: float,
    n_obs: int,
    inference: RddInference = RddInference.BOOTSTRAP,
    uniform_sup_draws: NDArray[np.float64] | None = None,
    uniform_sup_t_draws: NDArray[np.float64] | None = None,
)

Result of a local distribution-regression RD estimation.

Use plot, tabulate, summarize or get_as_dataframe to present the estimates. Instances are returned by estimate_rdd_distribution_effects; the constructor is not part of the public API.

The quantile effects are the differences between the complier quantiles of the treated and untreated potential outcomes at the cutoff. The average effect is the local average treatment effect for the same compliers.

Attributes

Name Type Description
qtt polars.DataFrame Quantile-specific effects, one row per quantile.
att polars.DataFrame Local average treatment effect for compliers.
outcome ColumnName Outcome variable the effect was estimated for.
group tuple[str, …] or None Columns the estimates are grouped by. Always None for this estimator.
treatment ColumnName Treatment variable the effect was estimated for.
running ColumnName Running (forcing) variable.
cutoff float Value of the running variable at which treatment status jumps.
local_polynomial_config LocalPolynomialConfig Bandwidth and kernel used for the local-linear distribution regressions.
outcome_grid_size int Number of outcome-grid points used for the distribution regressions.
first_stage float Estimated jump in the treatment probability at the cutoff. In a fuzzy design this is the local complier share.
n_obs int Number of observations used to estimate the effects.
inference RddInference Inference engine used for the standard errors.
uniform_sup_draws numpy.ndarray or None Multiplier draws of the supremum of the QTE process, i.e. the CHS/Stata-style constant-width uniform half-width. None for case-bootstrap inference.
uniform_sup_t_draws numpy.ndarray or None Studentised multiplier draws of the supremum of the QTE process. None for case-bootstrap inference.

Methods

Name Description
get_as_dataframe Return the quantile effects with confidence-bound columns.
plot Plot the quantile and average effects with confidence bounds.
plot_design Plot the outcome against the running variable around the cutoff.
plot_treatment Plot the treatment probability against the running variable.
summarize Render a rich text summary of the estimates.
tabulate Build a Great Tables table of the estimates.
uniform_critical_value Alias for uniform_half_width.
uniform_half_width Return the CHS/Stata-style constant half-width of the uniform band.
uniform_sup_t_critical_value Return the studentised sup-t critical value.
uniform_sup_t_half_width Return the quantile-specific studentised sup-t half-widths.

get_as_dataframe

rdd.RddDistributionResult.get_as_dataframe(
    alpha: float = 0.95,
    *,
    band: str = 'pointwise',
)

Return the quantile effects with confidence-bound columns.

plot

rdd.RddDistributionResult.plot(
    alpha: float = 0.95,
    quantiles: ArrayLike | None = None,
    highlight_quantiles: Sequence[float] | None = None,
    *,
    band: str = 'pointwise',
)

Plot the quantile and average effects with confidence bounds.

plot_design

rdd.RddDistributionResult.plot_design(ds: pl.DataFrame, *, n_bins: int = 30)

Plot the outcome against the running variable around the cutoff.

Parameters

Name Type Description Default
ds polars.DataFrame Data the model was estimated on. required
n_bins int Number of bins on each side of the cutoff. 30

Returns

Name Type Description
altair.Chart Binned outcomes and local-linear fits around the cutoff.

plot_treatment

rdd.RddDistributionResult.plot_treatment(ds: pl.DataFrame, *, n_bins: int = 30)

Plot the treatment probability against the running variable.

Parameters

Name Type Description Default
ds polars.DataFrame Data the model was estimated on. required
n_bins int Number of bins on each side of the cutoff. 30

Returns

Name Type Description
altair.Chart Binned treatment rates and local-linear fits around the cutoff.

summarize

rdd.RddDistributionResult.summarize(
    alpha: float = 0.95,
    quantiles: ArrayLike | None = None,
)

Render a rich text summary of the estimates.

Parameters

Name Type Description Default
alpha float Confidence level of the intervals. 0.95
quantiles array_like Quantiles to display. None shows all of them. None

Returns

Name Type Description
rich.console.Group Rich renderable for terminals and notebooks.

tabulate

rdd.RddDistributionResult.tabulate(
    alpha: float = 0.95,
    quantiles: ArrayLike | None = None,
)

Build a Great Tables table of the estimates.

Parameters

Name Type Description Default
alpha float Confidence level of the intervals. 0.95
quantiles array_like Quantiles to display. None shows all of them. None

Returns

Name Type Description
great_tables.GT Formatted table of the estimates.

uniform_critical_value

rdd.RddDistributionResult.uniform_critical_value(alpha: float = 0.95)

Alias for uniform_half_width.

uniform_half_width

rdd.RddDistributionResult.uniform_half_width(alpha: float = 0.95)

Return the CHS/Stata-style constant half-width of the uniform band.

uniform_sup_t_critical_value

rdd.RddDistributionResult.uniform_sup_t_critical_value(alpha: float = 0.95)

Return the studentised sup-t critical value.

uniform_sup_t_half_width

rdd.RddDistributionResult.uniform_sup_t_half_width(alpha: float = 0.95)

Return the quantile-specific studentised sup-t half-widths.