Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend summary2.summary_col features #8996

Open
EBoisseauSierra opened this issue Sep 8, 2023 · 0 comments
Open

Extend summary2.summary_col features #8996

EBoisseauSierra opened this issue Sep 8, 2023 · 0 comments

Comments

@EBoisseauSierra
Copy link

Is your feature request related to a problem? Please describe

I report results of my models via statsmodels.iolib.summary2.summary_col.
However, I have to work around the default implementation to fit my own requirements. These include:

  1. Report t-stat instead of standard error under the coefficient,
  2. Add the adjusted R² and number of observations,
  3. Have a different float level for coefficient and t-stats ('%.4f' vs. `'%.2f').

Describe the solution you'd like

I would like to modify summary_col along the lines of something like this:

  def summary_col(
      results,
+     parentheses: str | None = "std_err",
-     float_format: str ='%.4f',
+     float_format: str | dict[str, str] ='%.4f',
      model_names=(),
      stars=False,
      info_dict=None,
      regressor_order=(),
      drop_omitted=False,
-     include_r2=True,
+     include_r2: bool =True, # adds R^2 only
+     include_adj_r2: bool =True,
+     include_n: bool =False,
  ):

Concretely, this means:

  1. parentheses: str | None = "std_err": Choose whether to add stats below the coefficient (cf. None). If so, which one (something along the line of assert parentheses in ["std_err", "t_stat", "z_stat", "proba"]).
  2. float_format: str | dict[str, str] ='%.4f',: Pass either one format (current behaviour) that apply to all fields, or something like {"coefficient": "%.4f", "parentheses": "%.5f", "N": "%d"}
  3. include_*: Split include_r2 into two flags (one for R², and another for adjusted R²), and add new ones for N (and other fields?)

The features listed above a independent of each other. I'd be happy to raise a PR for each, but I'd prefer to check beforehand whether these would fit your roadmap — and if you have a better way to tackle my issues.

Describe alternatives you have considered

Regarding including adj-R² only and N, I am aware I can use info_dict (what I'm currently doing).
I know as well that I can write my own aggregator method, based on statsmodels.iolib.summary.Summary attributes.

However, I believe the features outlined above could be beneficial to others than me.

Additional context

Currently using statsmodels==0.14.0, and using OLS only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant