| """ |
| normality_checks.py |
| |
| Module for normality check heuristics. |
| """ |
|
|
| from typing import Tuple |
|
|
|
|
| def iqr_tail_heaviness(iqr: float, sd: float) -> float: |
| """Return ratio R = IQR/SD for tail heaviness checking.""" |
| return iqr / sd if sd != 0 else float("nan") |
|
|
|
|
| def quartile_z_scores( |
| mean: float, |
| sd: float, |
| q1: float, |
| q3: float, |
| ) -> Tuple[float, float]: |
| """Return observed z-scores for Q1 and Q3.""" |
| if sd == 0: |
| return (float("nan"), float("nan")) |
| q1_z = (q1 - mean) / sd |
| q3_z = (q3 - mean) / sd |
| return q1_z, q3_z |
|
|
|
|
| def pearson_skewness(mean: float, median: float, sd: float) -> float: |
| """Return Pearson's moment coefficient of skewness.""" |
| return 3 * (mean - median) / sd if sd != 0 else float("nan") |
|
|