Overview
One-sample tests compare a single sample of data against a known standard, a theoretical value, or a specific probability distribution. They answer questions like: - “Is the mean height of this group equal to the national average?” - “Does this data follow a normal distribution?” - “Is the median income significantly different from $50,000?”
These tests are the starting point for statistical inference, establishing whether a dataset deviates significantly from an expected baseline.
Tests for Normality
Many statistical procedures (like ANOVA and linear regression) assume data is normally distributed. Normality tests verify this assumption.
- SHAPIRO: Shapiro-Wilk test. The most powerful test for normality. Small p-values indicate the data is not normal.
- NORMALTEST: D’Agostino’s K^2 test. Combines skewness and kurtosis to detect departures from normality.
- JARQUE_BERA: A test based on sample skewness and kurtosis, often used in econometrics.
<>:21: SyntaxWarning: invalid escape sequence '\m'
<>:21: SyntaxWarning: invalid escape sequence '\s'
<>:21: SyntaxWarning: invalid escape sequence '\m'
<>:21: SyntaxWarning: invalid escape sequence '\s'
C:\Users\brent\AppData\Local\Temp\ipykernel_23344\1143163372.py:21: SyntaxWarning: invalid escape sequence '\m'
ax.plot(x, p, 'k--', linewidth=2, label=f'Normal Fit ($\mu$={mu:.2f}, $\sigma$={std:.2f})')
C:\Users\brent\AppData\Local\Temp\ipykernel_23344\1143163372.py:21: SyntaxWarning: invalid escape sequence '\s'
ax.plot(x, p, 'k--', linewidth=2, label=f'Normal Fit ($\mu$={mu:.2f}, $\sigma$={std:.2f})')
Distribution Tests
- KSTEST: Kolmogorov-Smirnov test. Compares the sample’s cumulative distribution function (CDF) against a reference CDF (e.g., uniform, exponential). Good for checking general goodness-of-fit.
Native Excel Capabilities
Excel has limited support for one-sample tests:
- Mean Testing:
T.TEST (and the older TTEST) generally requires two arrays. To do a one-sample test, users often have to create a “dummy” column of the target value \mu_0, which is cumbersome. Z.TEST exists but assumes known population variance, which is rarely the case.
- No Normality Tests: Excel has no built-in function for Shapiro-Wilk, Anderson-Darling, or Jarque-Bera tests. Users typically rely on visual inspection of histograms or Q-Q plots, which is subjective.
- Limited Non-Parametrics: No native function for the one-sample Wilcoxon signed-rank test.
The Python functions provided here fill these critical gaps, offering industry-standard normality tests and robust non-parametric options directly in the grid.