DPredict · Guide test 233
Standard normal homogeneity test
Tests a mean shift in a standardized series under its normal reference model.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Change-point tests (level shifts) — Did the level of the series jump at some point — and if so, when, and by how much?
In Change-point tests (level shifts), choose Test = Standard normal homogeneity (SNHT).
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Standard normal homogeneity test
Each error carries φ × the previous one; 1 is a random walk.
Your data
Simulated with a known ρIf H₀ were true
- The reference: how T₀ varies across samples when H₀ is true, simulated: 4,999 N(0, 1) series of 40 (Monte Carlo under independent normal errors).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .069).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- mean of the standardized series before and after k
- the search over every split, paid for by simulating the maximum
The verdict
T₀ = 7.50, p = .069
p > α = .050: compatible with H₀
Built for independent normal data around one level; serial correlation or a trend also inflate T0. The located k is an estimate, not a date known in advance.
- Statistic
- 7.501
- p-value
- 0.0688
Standard normal homogeneity test on 40 (x, y) pairs: T₀ = 7.50, p = .069. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: one constant normal mean; H1: one unknown mean shift.
Assumptions
Independent normal errors with common variance; a stable reference or standardized series when used for climate homogeneity.
Formula
Parameters and notation
zi=(xi−x̄)/s; subset means use the global mean and SD standardization.
Structure of the method
Standardize the entire record with a pooled mean and standard deviation, calculate the two segment-mean contrast at every candidate split, and maximize the resulting score. The computational structure is an unknown-break scan under a normal homogeneity null; the maximum needs search-adjusted reference values.
Estimated and nuisance parameters
Estimate full-sample location/scale and the candidate segment means; the maximizing position is a data-derived location estimate. When applying SNHT to differences or ratios against reference series, those constructed data and any reference-model estimates define a new analysis pipeline and must be described.
Settings and design choices
Choose the record/reference construction, eligible splits or minimum segment sizes, standardization convention, and Monte Carlo precision. Fixing a break date independently changes the problem to a fixed-break comparison. The cited function’s m controls simulated reference precision, not the strength or smoothness of a fitted shift.
Fitting and adaptation
Recompute global standardization and the full split search in each normal-null simulation. If adapting to environmental records with seasonality or serial dependence, justify preprocessing and calibrate its effect; simply using the word standardized does not make residuals independent Gaussian observations.
Sensitivity and robustness
Inspect endpoint behavior, autocorrelation, inhomogeneous variance, heavy tails, and differences between a step and a gradual trend. Comparing against a fixed-split chi-square threshold overstates evidence. Report the estimated break with uncertainty and substantive metadata rather than treating the argmax as a precisely known event time.
How to use and calibrate
Use SNHT critical values or normal-null simulation; the maximizing split estimates the candidate break.
Example application
Detect a station record discontinuity after relocation.
Interpretation and pitfalls
Watch out
The maximum requires search-adjusted calibration; ordinary fixed-split χ² values are invalid.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Keep observations in temporal order. Serial correlation and seasonality can invalidate the default independent-error calibration; do not treat the selected change point as known in advance.
Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: trend
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
x<-seq_len(60)*.02+rnorm(60)
print(trend::snh.test(x))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Not run — Syntax checked; runtime not verified in the final environment · needs trend
set.seed(2026)
x<-seq_len(60)*.02+rnorm(60)
print(trend::snh.test(x))
Sources
- trend — trend · snh.testAuthor documentation/source reviewed: trend 1.1.10.search.r-project.org
- snh.testsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 233, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT233.