Skip to content

BUG: Support single-variable input in test_mvmean - #11303

Open
xihaian251 wants to merge 1 commit into
statsmodels:mainfrom
xihaian251:sprint3-final/H
Open

xihaian251 wants to merge 1 commit into
statsmodels:mainfrom
xihaian251:sprint3-final/H

Conversation

@xihaian251

Copy link
Copy Markdown
Contributor

Problem

  • np.cov returns a zero-dimensional array for single-variable input.
  • The subsequent call to np.linalg.solve raises LinAlgError.

Changes

  • Use np.atleast_2d to preserve the covariance matrix structure.
  • Retain existing multivariate and singular covariance behavior.

Validation

  • Single-variable Hotelling's T² statistic agrees with the squared one-sample t-statistic.
  • Cross-validation against scipy.stats.ttest_1samp.
  • Existing multivariate cases remain unchanged.
  • test_multivariate.py: 13 passed.

AI Disclosure

Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the <...> placeholders in the second option with the tool name(s) and how the tool's output was used.

  • No AI tools were used to develop this pull request.
  • AI tools were used. Tool(s): WorkBuddy, Wolfram. Used for: implementation, regression testing, debugging and independent validation (WorkBuddy); independent mathematical and numerical cross-checks (Wolfram). I have personally read, understood, and can explain every line of this diff, and have verified the statistical/numerical correctness of the change.

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.

1 participant