CrucibleBench.Stats.NormalityTests (CrucibleBench v0.3.1)
View SourceStatistical tests for normality of data distributions.
Tests the null hypothesis that data comes from a normal distribution. Used to validate assumptions for parametric statistical tests.
References
- Shapiro, S. S., & Wilk, M. B. (1965). "An analysis of variance test for normality"
- Royston, P. (1992). "Approximating the Shapiro-Wilk W-Test for non-normality"
Summary
Functions
Comprehensive normality assessment combining multiple approaches.
Quick normality check using skewness and kurtosis thresholds.
Shapiro-Wilk test for normality.
Functions
Comprehensive normality assessment combining multiple approaches.
Returns a map with:
- Shapiro-Wilk test result
- Skewness and kurtosis
- Overall recommendation
Examples
iex> data = [5.0, 5.1, 4.9, 5.2, 4.8, 5.0, 5.1, 4.9, 5.0, 5.1]
iex> assessment = CrucibleBench.Stats.NormalityTests.assess_normality(data)
iex> is_map(assessment)
true
Quick normality check using skewness and kurtosis thresholds.
Faster than Shapiro-Wilk but less reliable. Use for quick screening.
Examples
iex> data = [5.0, 5.1, 4.9, 5.2, 4.8]
iex> result = CrucibleBench.Stats.NormalityTests.quick_check(data)
iex> is_boolean(result.is_normal)
true
Shapiro-Wilk test for normality.
Most powerful omnibus test for normality. Tests null hypothesis that data comes from a normal distribution.
Returns:
:statistic- W statistic (0 to 1, closer to 1 indicates more normal):p_value- Probability of observing this data if truly normal:is_normal- true if p-value > 0.05:interpretation- Human-readable result
Limitations:
- Requires 3 ≤ n ≤ 5000
- Sensitive to ties in small samples
Examples
iex> # Approximately normal data
iex> data = [5.0, 5.2, 4.8, 5.1, 4.9, 5.3, 4.7, 5.0, 5.1, 4.9]
iex> result = CrucibleBench.Stats.NormalityTests.shapiro_wilk(data)
iex> result.statistic > 0.3
true
iex> # Clearly non-normal (uniform-like)
iex> data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
iex> result = CrucibleBench.Stats.NormalityTests.shapiro_wilk(data)
iex> is_float(result.statistic)
true