Skip to content

EProportions · Guide test 055

One proportion score test

Tests a single proportion using its null based standard error and a normal approximation.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

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

60
0.38
0.50
0.050

Alternative

Your data

Edit the counts

Successes 19 of 60

If H₀ were true

z = −2.84
  1. The reference: how z varies across samples when H₀ is true.
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .005).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

z=p^−p0p0(1−p0)/nz = \dfrac{\hat p-p_0}{\sqrt{p_0(1-p_0)/n}}

With your numbers

z=0.32−0.500.50(1−0.50)/60=(−2.84)z = \dfrac{0.32-0.50}{\sqrt{0.50(1-0.50)/60}} = (-2.84)
p^\hat p
sample proportion
p0p_0
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 H0.

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

z=p^−p0p0(1−p0)/nz=\frac{\widehat p-p_0}{\sqrt{p_0(1-p_0)/n}}

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.

Python · native

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
R

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

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.