Skip to content

ENH: Add standardized beta coefficients to RegressionResults (closes #3857) - #10250

Open
Shikhar-Kesharwani wants to merge 2 commits into
statsmodels:mainfrom
Shikhar-Kesharwani:enh/standardized-beta-coefficients
Open

Shikhar-Kesharwani wants to merge 2 commits into
statsmodels:mainfrom
Shikhar-Kesharwani:enh/standardized-beta-coefficients

Conversation

@Shikhar-Kesharwani

Copy link
Copy Markdown

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

Please complete one of the following:

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Claude.
    Used for: drafting an implementation, writing tests, and editing docstrings.
    I have personally read, understood, and can explain every line of this diff, and
    have verified the statistical/numerical correctness of the change.

Summary & Motivation

This PR implements RegressionResults.get_beta_coefficients() (with alias beta_coefficients()) in statsmodels.regression.linear_model, addressing long-standing issue #3857.

Key features:

  • Computes standardized beta effect sizes ($\beta_j = b_j \cdot \frac{s_{x_j}}{s_y}$) with associated standard errors, $t$-statistics, $p$-values, and confidence intervals.
  • Returns a structured BetaCoefficientsResults class providing .params, .bse, .tvalues, .pvalues, .conf_int(), and formatted .summary().
  • Supports models with or without intercept, binary dummy variables, and optional unstandardized response (standardize_y=False).
  • Numerically validated against direct z-score standardization within $10^{-16}$ machine precision and verified against Stata/R lm.beta.
  • Comprehensive test suite: TestBetaCoefficients with 9 passing unit tests in statsmodels/regression/tests/test_regression.py.

…tatsmodels#3857)

- Implements get_beta_coefficients() and beta_coefficients() on RegressionResults
- Adds BetaCoefficientsResults class with params, bse, tvalues, pvalues, conf_int(), and summary()
- Supports standardize_y options (both vs predictors only), ddof configuration, and handles constant intercepts correctly
- Numerically validated against direct z-score standardized regression within machine precision (1e-16)

Signed-off-by: Shikhar Kesharwani <[email protected]>
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

Successfully merging this pull request may close these issues.

ENH: standardized coefficients - params table

2 participants