cat2cat.summary
Functions
|
Adjust regression summaries fitted on replicated cat2cat data. |
Module Contents
- cat2cat.summary.summary_c2c(model: Any, df_old: float, df_new: float | None = None) pandas.DataFrame
Adjust regression summaries fitted on replicated cat2cat data.
- Parameters:
model – A fitted statsmodels-like result object with
params,bse, andtvaluesattributes.df_old – Residual degrees of freedom on the original observation scale.
df_new – Residual degrees of freedom on the replicated data scale. Defaults to
model.df_resid.
- Returns:
coefficient table with corrected standard errors, corrected statistics, corrected p-values, and reference distribution.
- Return type:
pandas.DataFrame
Examples
>>> from pandas import DataFrame, concat >>> import statsmodels.api as sm >>> from cat2cat import summary_c2c >>> data = DataFrame({ ... "y": [2.0, 3.0, 5.0, 7.0, 11.0, 13.0, 17.0, 19.0], ... "x1": [1.0, 1.5, 2.0, 2.7, 3.2, 4.1, 4.8, 5.2], ... "x2": [0, 1, 0, 1, 0, 1, 0, 1], ... }) >>> model = sm.OLS.from_formula("y ~ x1 + x2", data=data).fit() >>> model_rep = sm.OLS.from_formula( ... "y ~ x1 + x2", data=concat([data, data]) ... ).fit() >>> out = summary_c2c(model_rep, df_old=model.df_resid, df_new=model_rep.df_resid) >>> all(col in out.columns for col in ["std.error_c", "statistic_c", "p.value_c"]) True