crunchers.statsmodels_helpers package¶
Submodules¶
crunchers.statsmodels_helpers.lazy_stats module¶
Functions for streamlining analysis.
-
crunchers.statsmodels_helpers.lazy_stats.
build_regression_models_grid
(X_hyps_dicts, ctrl_coefs_dicts, outcomes_dicts)[source]¶
-
crunchers.statsmodels_helpers.lazy_stats.
do_regression
(data, y_var, X_ctrls=None, X_hyp=None, kind='OLS', **kwargs)[source]¶ Provide a further abstracted way to build and run multiple types of regressions.
data (pd.DataFrame): data table to use when retrieving the column headers y_var (str): column header of the outcome variable X_ctrls (str): formula specification of the “boring” variables “column_header_1 + column_header_2”… X_hyp (str): formula specification of the “interesting” variables “column_header_1 + column_header_2”… kind (str): the type of regression to run kind in [‘GLM’,’OLS’,’RLM’] == True
-
crunchers.statsmodels_helpers.lazy_stats.
format_all_regression_models
(regs, total)[source]¶ Return tuple of string formated versions of all regression tables in the regs object.
Parameters: - (reg-tree (regs) – dict-like): tree-like dict containing the regression results objects as leaves and descriptors as nodes.
- total (int) – total number of results tables to format.
Returns: tuple
-
crunchers.statsmodels_helpers.lazy_stats.
identify_full_ctrl_names
(X_vars, orig_ctrl_names)[source]¶ Return set of variable names actually used in regression, tolerating mangling of categoricals.
-
crunchers.statsmodels_helpers.lazy_stats.
regression_grid_single
(grid_item, data, kind, **kwargs)[source]¶
-
crunchers.statsmodels_helpers.lazy_stats.
report_glm
(formula, data, verbose=True, **kwargs)[source]¶ Fit GLM, print a report, and return the fit object.
-
crunchers.statsmodels_helpers.lazy_stats.
report_logitreg
(formula, data, verbose=True, disp=1)[source]¶ Fit logistic regression, print a report, and return the fit object.
-
crunchers.statsmodels_helpers.lazy_stats.
report_ols
(formula, data, fit_regularized=False, L1_wt=1, refit=False, **kwargs)[source]¶ Fit OLS regression, print a report, and return the fit object.
-
crunchers.statsmodels_helpers.lazy_stats.
report_rlm
(formula, data, verbose=True, **kwargs)[source]¶ Fit RLM, print a report, and return the fit object.
-
crunchers.statsmodels_helpers.lazy_stats.
run_regressions_grid
(grid, data, kind, max_workers=None, **kwargs)[source]¶
-
crunchers.statsmodels_helpers.lazy_stats.
summarize_X_vars
(results, sig_thresh=0.05, X_ctrls=None, X_ignore=None)[source]¶
-
crunchers.statsmodels_helpers.lazy_stats.
summarize_grid_X_vars_OLS
(regs, reg_grid, sig_thresh=0.05)[source]¶
-
crunchers.statsmodels_helpers.lazy_stats.
summarize_multi_LOGIT
(results)[source]¶ Return dataframe aggregating over-all stats from a dictionary-like object containing LOGIT result objects.
-
crunchers.statsmodels_helpers.lazy_stats.
summarize_multi_OLS
(results)[source]¶ Return dataframe aggregating over-all stats from a dictionary-like object containing OLS result objects.