Implement Skewness Calculation with Edge Case Handling#91
Merged
montanaflynn merged 4 commits intomontanaflynn:masterfrom Mar 24, 2026
Merged
Implement Skewness Calculation with Edge Case Handling#91montanaflynn merged 4 commits intomontanaflynn:masterfrom
montanaflynn merged 4 commits intomontanaflynn:masterfrom
Conversation
Contributor
Author
|
Hi @montanaflynn added the functional logic to calculate the Skewness |
- Fix skewness formula (was off by factor of n) - Add PopulationSkewness and SampleSkewness to match library pattern - Use package error variables (ErrEmptyInput) instead of errors.New - Return math.NaN() on error to match other functions - Unexport helper functions (Differences, PowerofN) and inline logic - Use package stats_test and table-driven tests with scipy reference values - Add doc comments on exported functions
Owner
|
Thanks for adding skewness — great addition to the library! I pushed a commit with some adjustments to align with the existing codebase conventions: Formula fix:
Added population/sample variants:
This follows the same pattern as Convention fixes:
All tests pass against scipy reference values for both population and sample skewness across 5 datasets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a Skewness function for float64 datasets, calculating the third central moment normalized by standard deviation cubed. It handles zero-variance datasets and validates minimum input length. Unit tests cover symmetric, right-skewed, and left-skewed distributions, complementing the library’s existing descriptive statistics.