One Sample Tests

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 Location (Mean/Median)

When comparing a sample’s central tendency to a hypothetical value \mu_0:

  • TTEST_1SAMP: One-sample t-test. Used when the data is normally distributed (or sample size is large). Tests if the population mean equals \mu_0.
  • WILCOXON: Wilcoxon signed-rank test. A non-parametric alternative to the t-test. Tests if the median of a symmetric distribution equals m_0. Robust to outliers.
  • QUANTILE_TEST: Tests if a specific quantile (e.g., the 90th percentile) equals a given value.

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})')
Figure 1: Assessing Normality: A histogram of skewed data compared to a theoretical normal curve. The Shapiro-Wilk test (p < 0.05) would formally reject the null hypothesis that this data is normal.

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.

Tools

Tool Description
BINOMTEST Perform a binomial test for the probability of success in a Bernoulli experiment.
JARQUE_BERA Perform the Jarque-Bera goodness of fit test for normality.
KSTEST Performs the one-sample Kolmogorov-Smirnov test for goodness of fit.
KURTOSISTEST Test whether the kurtosis of a sample is different from that of a normal distribution.
NORMALTEST Test whether a sample differs from a normal distribution (omnibus test).
QUANTILE_TEST Perform a quantile test to determine if a population quantile equals a hypothesized value.
SHAPIRO Perform the Shapiro-Wilk test for normality.
SKEWTEST Test whether the skewness of a sample is different from that of a normal distribution.
TTEST_1SAMP Perform a one-sample t-test for the mean of a group of scores.