InstrumentProbabilityResult
iv.InstrumentProbabilityResult(
coefficients: pl.DataFrame,
instrument: ColumnName | None = None,
formula: FormulaRhs | None = None,
n_obs: int | None = None,
df_model: int | None = None,
df_resid: int | None = None,
converged: bool | None = None,
cov_type: str | None = None,
method: str | None = None,
log_likelihood: float | None = None,
log_likelihood_null: float | None = None,
pseudo_r_squared: float | None = None,
llr: float | None = None,
llr_p_value: float | None = None,
aic: float | None = None,
bic: float | None = None,
)
Coefficient estimates from the logit model for the instrument probability.
Use tabulate, summarize or get_as_dataframe to present the estimates. Instances are attached to the IV results as instrument_probability.
Attributes
| coefficients |
polars.DataFrame |
One row per model term with the estimate, standard error, z value and p value. |
| instrument |
ColumnName or None |
Instrument the model was estimated for. |
| formula |
FormulaRhs or None |
Right-hand side of the logit model. None for the intercept-only constant-probability model. |
| n_obs |
int or None |
Number of observations used to fit the model. |
| df_model |
int or None |
Model degrees of freedom, excluding the intercept. |
| df_resid |
int or None |
Residual degrees of freedom. |
| converged |
bool or None |
Whether the fitting algorithm converged. |
| cov_type |
str or None |
Covariance estimator used for the standard errors. |
| method |
str or None |
Fitting method reported by statsmodels. |
| log_likelihood |
float or None |
Maximized log-likelihood. |
| log_likelihood_null |
float or None |
Log-likelihood of the intercept-only model. |
| pseudo_r_squared |
float or None |
McFadden pseudo R-squared. |
| llr |
float or None |
Likelihood-ratio statistic against the intercept-only model. |
| llr_p_value |
float or None |
p value of the likelihood-ratio test. |
| aic |
float or None |
Akaike information criterion. |
| bic |
float or None |
Bayesian information criterion. |
Methods
| from_statsmodels |
Collect coefficients and fit statistics from a fitted statsmodels model. |
| get_as_dataframe |
Return the coefficient estimates with confidence interval columns. |
| summarize |
Render a rich text summary of the coefficient estimates. |
| tabulate |
Build a Great Tables table of the coefficient estimates. |
from_statsmodels
iv.InstrumentProbabilityResult.from_statsmodels(
result: GLMResultsWrapper,
*,
instrument: ColumnName | None = None,
formula: FormulaRhs | None = None,
)
Collect coefficients and fit statistics from a fitted statsmodels model.
get_as_dataframe
iv.InstrumentProbabilityResult.get_as_dataframe(alpha: float = 0.95)
Return the coefficient estimates with confidence interval columns.
Parameters
| alpha |
float |
Confidence level of the intervals. |
0.95 |
Returns
|
polars.DataFrame |
Coefficient estimates with ci_lb and ci_ub columns. |
summarize
iv.InstrumentProbabilityResult.summarize(alpha: float = 0.95)
Render a rich text summary of the coefficient estimates.
Parameters
| alpha |
float |
Confidence level of the intervals. |
0.95 |
Returns
|
rich.console.Group |
Rich renderable for terminals and notebooks. |
tabulate
iv.InstrumentProbabilityResult.tabulate(alpha: float = 0.95)
Build a Great Tables table of the coefficient estimates.
Parameters
| alpha |
float |
Confidence level of the intervals. |
0.95 |
Returns
|
great_tables.GT |
Formatted table of the instrument probability model. |