IvqrResult

iv.IvqrResult(
    qtt: pl.DataFrame,
    att: pl.DataFrame,
    outcome: ColumnName,
    group: tuple[str, ...] | None,
    covariate_coefficients: pl.DataFrame,
    treatment: ColumnName,
    instruments: tuple[str, ...],
    covariates: FormulaRhs,
    n_obs: int,
    tsls: tuple[float, float],
)

Result of an instrumental-variable quantile regression.

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

Attributes

Name Type Description
qtt polars.DataFrame Quantile-specific structural treatment effects, one row per quantile.
att polars.DataFrame Average of the IVQR quantile effects over the requested quantiles, with its analytical standard error.
outcome ColumnName Outcome variable the model was estimated for.
group tuple[str, …] or None Columns the estimates are grouped by. Always None for IVQR.
covariate_coefficients polars.DataFrame Intercept and covariate coefficients, one row per term and quantile.
treatment ColumnName Endogenous treatment variable the model was estimated for.
instruments tuple of str Instrument names.
covariates FormulaRhs Right-hand side of the covariate formula.
n_obs int Number of observations used to fit the model.
tsls tuple of float Separate 2SLS average IV effect and its standard error, reported as (estimate, standard_error).

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

iv.IvqrResult.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

iv.IvqrResult.plot(
    alpha: float = 0.95,
    quantiles: ArrayLike | None = None,
    highlight_quantiles: Sequence[float] | None = None,
)

Plot the quantile and average effects with confidence intervals.

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
highlight_quantiles array_like Quantiles at which to draw point markers on the full quantile line. None draws markers at every displayed quantile. None

Returns

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

summarize

iv.IvqrResult.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

iv.IvqrResult.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.