NonlinearDidResult

nonlinear_did.NonlinearDidResult(
    qtt: pl.DataFrame,
    att: pl.DataFrame,
    outcome: ColumnName,
    group: tuple[str, ...] | None,
    base_period: BasePeriod,
    control_group: ControlGroup,
    sampling_scheme: SamplingScheme,
    counterfactual_model: CounterfactualModel,
)

Result for one aggregation of a nonlinear difference-in-differences estimation.

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

Attributes

Name Type Description
qtt polars.DataFrame Quantile-specific effects.
att polars.DataFrame Average treatment effects.
outcome ColumnName Outcome variable the effect was estimated for.
group tuple[str, …] or None Columns the estimates are grouped by.
base_period BasePeriod Base period used for the comparisons.
control_group ControlGroup Comparison group used for the counterfactual.
sampling_scheme SamplingScheme Sampling scheme of the input data.
counterfactual_model CounterfactualModel Model used to construct the counterfactual distribution.

Methods

Name Description
get_as_dataframe Return the quantile effects with confidence interval columns.
plot Plot the quantile and average effects with confidence intervals.
summarize Render a rich text summary of the estimates.
tabulate Build a Great Tables table of the estimates.

get_as_dataframe

nonlinear_did.NonlinearDidResult.get_as_dataframe(alpha: float = 0.95)

Return the quantile effects with confidence interval columns.

Parameters

Name Type Description Default
alpha float Confidence level of the intervals. 0.95

Returns

Name Type Description
polars.DataFrame Quantile effects with ci_lb and ci_ub columns.

plot

nonlinear_did.NonlinearDidResult.plot(alpha: float = 0.95)

Plot the quantile and average effects with confidence intervals.

Parameters

Name Type Description Default
alpha float Confidence level of the intervals. 0.95

Returns

Name Type Description
altair.Chart Altair chart of the estimates.

summarize

nonlinear_did.NonlinearDidResult.summarize(alpha: float = 0.95)

Render a rich text summary of the estimates.

Parameters

Name Type Description Default
alpha float Confidence level of the intervals. 0.95

Returns

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

tabulate

nonlinear_did.NonlinearDidResult.tabulate(alpha: float = 0.95)

Build a Great Tables table of the estimates.

Parameters

Name Type Description Default
alpha float Confidence level of the intervals. 0.95

Returns

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