EProportions · Guide test 055
One proportion score test
Tests a single proportion using its null based standard error and a normal approximation.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- One proportion (exact binomial / score test) — Does the share of an outcome differ from a reference proportion?
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 · One proportion score test
Alternative
Your data
Edit the countsSuccesses 19 of 60
If H₀ were true
- The reference: how z varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .005).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- sample proportion
- the null proportion (also used in the SE)
The verdict
z = −2.84, p = .005, p̂ = 0.32
p ≤ α = .050: reject H₀
Effect size: sample proportion p̂ = 0.317
Uses the null value in the standard error, which keeps its error rate better than the Wald z. Exact binomial is safer for small n.
- Statistic
- −2.840
- p-value
- 0.0045
One proportion score test on 19 successes in 60 trials: z = −2.84, p = .005, p̂ = 0.32. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: p=p0.
Assumptions
Independent Bernoulli trials with a common probability; enough expected successes and failures for normal calibration.
Formula
Parameters and notation
p̂=x/n; p0 is the null proportion; n is trial count.
Structure of the method
Count successes and trials, subtract the prespecified null probability, and divide by the null-based binomial standard error. The resulting signed z statistic uses a normal reference; its square is the one-degree-of-freedom score chi-square statistic reported by some software.
Estimated and nuisance parameters
The descriptive estimate is x/n. For this null, the denominator contains p0, which is specified rather than fitted. There are no neural weights, latent layers, or optimization epochs. Trial count and the success definition come from the sampling design.
Settings and design choices
Prespecify p0, the one- or two-sided alternative, alpha, and whether a continuity correction is used. Changing the null standard error to the estimated-proportion standard error creates a Wald procedure. Choose the confidence-interval construction separately and name it.
Fitting and adaptation
Recompute the count and score for a new independent sample; fine-tuning is inapplicable. If sample collection is sequential, use a prespecified sequential design rather than repeatedly applying the fixed-sample cutoff. A parametric null check simulates Bernoulli observations with probability p0.
Sensitivity and robustness
Inspect expected successes np0 and failures n(1-p0), especially for extreme p0. Clustering or unequal success probabilities can invalidate binomial variance. Report the observed proportion and its uncertainty even when the p-value is small; a large n can detect negligible differences.
How to use and calibrate
Use the standard normal reference, optionally a stated continuity correction. Inverting the score test yields the Wilson interval.
Example application
Assess whether a defect proportion exceeds a specified target.
Interpretation and pitfalls
Watch out
This is a score denominator evaluated at p0, not the Wald denominator evaluated at p̂. Sparse samples favor exact inference.
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
Uncorrected score test; R reports the squared z statistic as chi-square with one degree of freedom.
Validated — Executed successfully in the validation environment · needs numpy, scipy
import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
z=(18/30-.5)/np.sqrt(.5*.5/30)
print(z,2*stats.norm.sf(abs(z)))
Output
1.0954451150103321 0.27332167829229814
Validated — Executed successfully in the validation environment · needs Base/standard library
print(prop.test(18,30,p=.5,correct=FALSE))
Output
1-sample proportions test without continuity correction data: 18 out of 30, null probability 0.5 X-squared = 1.2, df = 1, p-value = 0.2733 alternative hypothesis: true p is not equal to 0.5 95 percent confidence interval: 0.4232036 0.7540937 sample estimates: p 0.6
Sources
- statsmodels — statsmodels · stats.proportion.proportions_zteststatsmodels.org
- statsmodels.stats.proportion.proportions_zteststatsmodels.org
- Statistics guide v4 (historical):
- R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 055, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT055.