Z Tests

One Proportion Z Test: Formula, Example, Calculator, SPSS, R, Python and Excel improvement Guide 1

One Proportion Z Test formula example with observed proportion, hypothesized proportion, z statistic, p-value, SPSS, R, Python and Excel workflow
Advertisement
Google AdSense Top placement reserved here

Single Proportion Hypothesis Test

One Proportion Z Test is used when you want to test whether one observed sample proportion is significantly different from, greater than, or less than a hypothesized population proportion. This guide explains the formula, hypotheses, assumptions, p-value, calculator logic, SPSS output, R workflow, Python validation and Excel method using the student-por.csv dataset. The worked example tests whether the proportion of students who want higher education is greater than 80%.

Advertisement
Google AdSense top placement reserved here

Quick Answer: One Proportion Z Test Result

The One Proportion Z Test was applied to the binary variable higher, where yes means the student wants higher education. Out of 649 students, 580 answered yes. The observed sample proportion was p-hat = 0.8937, or 89.4%. The test compared this observed proportion against the hypothesized value p0 = 0.80.

Sample size649
Success count580
Observed p-hat89.4%
Z statistic5.967

Final result: A one-proportion z test showed that the proportion of students who wanted higher education was significantly greater than 80%, z = 5.967, p < .001, p-hat = .894. Therefore, the null hypothesis was rejected.

SPSS reporting note: SPSS displays very small p-values as .000000 or .000. In formal writing, report this as p < .001, not p = .000.

Quick Navigation

Use this guide to understand the test, reproduce the analysis and write the result correctly.

What Is a One Proportion Z Test?

A One Proportion Z Test is a hypothesis test for a single population proportion. It is used when the outcome has two categories, such as yes/no, pass/fail, success/failure, present/absent or support/not support. The test asks whether the observed sample proportion is far enough away from a hypothesized value to reject the null hypothesis.

In this example, the binary response is higher. Students answered whether they wanted higher education. The success category is yes. The statistical question is: Is the proportion of students who want higher education greater than 80%?

The test is called a z test because it converts the difference between the observed proportion and the hypothesized proportion into a standard normal z statistic. When the sample is large enough, the sampling distribution of the sample proportion can be approximated by the normal distribution. That is why the test uses the standard normal curve to calculate the p-value.

Plain-language meaning: The observed proportion was 89.4%, while the benchmark claim was 80%. The one proportion z test checks whether this 9.4 percentage-point difference is large enough to be statistically meaningful rather than just random sampling variation.

When Should You Use a One Proportion Z Test?

Use a One Proportion Z Test when you have one sample, one binary outcome and one hypothesized population proportion. It is common in education, public health, market research, survey analysis, election polling, quality control and website conversion analysis.

Research situation Use One Proportion Z Test? Reason
Testing whether more than 80% of students want higher education Yes One binary outcome and one benchmark proportion.
Testing whether website conversion rate is greater than 5% Yes Conversion is a success/failure outcome.
Testing whether exactly half of customers prefer a product Yes Preference can be coded as yes/no against p0 = .50.
Comparing two independent proportions No Use a two-proportion z test instead.
Testing a numeric mean such as average score No Use a one-sample t test or z test for a mean, depending on the situation.

One Proportion Z Test Hypotheses and Formula

The One Proportion Z Test formula compares the observed sample proportion to the hypothesized null proportion. The formula is:

z = (p-hat - p0) / sqrt[p0(1 - p0) / n]

Here, p-hat is the observed sample proportion, p0 is the hypothesized population proportion under the null hypothesis, and n is the sample size. The denominator is the standard error under the null hypothesis.

Symbol Meaning Value in this example
x Number of successes 580 students answered yes
n Total valid sample size 649
p-hat Observed sample proportion 580 / 649 = .893683
p0 Hypothesized proportion .800000
SE under H0 sqrt[p0(1 − p0) / n] .015701
z Standardized test statistic 5.966522

Hypotheses for This Worked Example

Hypothesis Statement Meaning
H0 p = .80 The population proportion of students who want higher education is 80%.
H1 p > .80 The population proportion of students who want higher education is greater than 80%.

Conditions for One Proportion Z Test

The conditions for One Proportion Z Test must be checked before relying on the normal approximation. The outcome should be binary, the observations should be independent, and the expected success and failure counts under the null hypothesis should usually be at least 10.

Condition Requirement Result in this example
Binary outcome The variable has two categories. Yes. The response is higher = yes or no.
Independence Each observation should represent a separate student. Treated as satisfied for this dataset workflow.
Large-sample success condition n × p0 should be at least 10. 649 × .80 = 519.2, satisfied.
Large-sample failure condition n × (1 − p0) should be at least 10. 649 × .20 = 129.8, satisfied.

Condition decision: The large-sample normal approximation condition is satisfied because both expected counts are much larger than 10. This supports using the one-proportion z test.

Advertisement
Google AdSense middle placement reserved here

Dataset and Variable Used

This tutorial uses the student-por.csv student performance dataset. The main variable for the one proportion z test is higher. The response yes is coded as the success category, meaning the student wants higher education.

Item Value used Explanation
Dataset student-por.csv Student performance dataset used for R, Python and SPSS verification.
Main variable higher Indicates whether the student wants higher education.
Success category yes Student wants higher education.
Failure category no Student does not report wanting higher education.
Hypothesized proportion p0 = .80 Benchmark claim used in the null hypothesis.
Alternative hypothesis p > .80 Right-tailed one proportion z test.

External dataset source: UCI Machine Learning Repository: Student Performance dataset.

Verified R, Python and SPSS Results

The One Proportion Z Test was reproduced in R, Python and SPSS. The fixed SPSS output confirms the same result as the R and Python workflows.

Main One Proportion Z Test Result

Statistic Verified value Interpretation
n 649 Total valid cases.
x 580 Students who answered higher = yes.
Failure count 69 Students who answered higher = no.
Observed p-hat .893683 Observed proportion is 89.4%.
Hypothesized p0 .800000 Null benchmark is 80%.
Standard error under H0 .015701 Used to calculate the z statistic.
Z statistic 5.966522 The observed proportion is far above p0.
Right-tailed p-value < .001 Reject H0; evidence supports p > .80.

Confidence Intervals

Interval Lower bound Upper bound Interpretation
Wald 95% CI .869968 .917397 Simple large-sample confidence interval for the observed proportion.
Wilson 95% CI .867608 .915124 More stable confidence interval for a proportion; used in this explanation.

Descriptive Group Context

Group Success count / total Proportion yes Interpretation
GP school 391 / 423 92.4% Higher education aspiration is very high in the GP school group.
MS school 189 / 226 83.6% Still above 80%, but lower than GP in this descriptive comparison.
Female students 348 / 383 90.9% Female students show a high yes proportion.
Male students 232 / 266 87.2% Male students also show a high yes proportion.

Important: The school and sex tables are descriptive context only. The main hypothesis test in this article is the overall one-proportion z test for higher = yes against p0 = .80.

R Charts for One Proportion Z Test

The R workflow produced visual explanations of the observed proportion, hypothesized proportion, success/failure counts, confidence interval, z statistic, large-sample condition and p-value.

1. Observed vs Hypothesized Proportion

Observed versus hypothesized proportion for one proportion z test
R chart comparing observed p-hat = 89.4% with hypothesized p0 = 80%.

This chart gives the simplest interpretation of the test. The observed sample proportion is clearly higher than the hypothesized 80% benchmark. The statistical test then asks whether this difference is large enough after considering sample size and standard error.

2. Success and Failure Counts

Observed success and failure counts for one proportion z test
R chart showing 580 yes responses and 69 no responses for higher education aspiration.

The count chart shows that most students answered yes. Since 580 out of 649 students selected yes, the observed sample proportion is 580 / 649 = .8937.

3. Confidence Interval vs Null Proportion

Confidence interval compared with null proportion in one proportion z test
R chart showing the observed proportion and its 95% confidence interval.

The confidence interval is above the 80% benchmark. This supports the same conclusion as the z test: the population proportion is likely greater than .80.

4. Z Statistic Normal Curve

Normal curve and z statistic for one proportion z test
R normal curve showing the z statistic far in the right tail.

The z statistic is 5.967, which is far to the right of the standard normal center. This creates a very small right-tailed p-value. Therefore, the result is reported as p < .001.

5. Large-Sample Condition Check

Large sample condition check for one proportion z test
R chart showing n × p0 = 519.2 and n × (1 − p0) = 129.8.

The large-sample condition is strongly satisfied. Both expected counts are much greater than the usual minimum rule of 10, so the normal approximation is appropriate.

6. Higher Education Aspiration by School

Higher education aspiration by school for one proportion z test context
R chart comparing yes proportions by school.

The school chart provides descriptive context. GP has 391 yes responses out of 423 students, while MS has 189 yes responses out of 226 students. This is not the main z test, but it helps readers understand how the yes responses are distributed across groups.

7. Higher Education Aspiration by Sex

Higher education aspiration by sex for one proportion z test context
R chart comparing yes proportions by sex.

The sex chart shows that both female and male students have high yes proportions. Female students show 348/383 = 90.9%, while male students show 232/266 = 87.2%.

8. P-Value Summary

P-value summary for one proportion z test
R chart comparing alpha = .05 with the one-sided and two-sided p-values.

The main one-sided p-value is below .001, which is far smaller than alpha = .05. This supports rejecting the null hypothesis.

9. Formula Summary Panel

Formula summary for one proportion z test
R formula panel showing x, n, p-hat, p0, standard error, z and p-value.

The formula panel is useful for students because it shows the calculation in one place. It connects the raw count, sample size, observed proportion and null proportion to the final z statistic.

Python Validation Charts for One Proportion Z Test

The Python workflow independently validates the same result. It reproduces the observed proportion, confidence interval, z statistic, p-value summary, group context and formula calculation.

1. Python Observed vs Hypothesized Proportion

Python observed versus hypothesized proportion for one proportion z test
Python chart confirming observed p-hat = 89.4% and p0 = 80%.

The Python chart confirms that the observed sample proportion is clearly above the hypothesized proportion. This is the visual reason the right-tailed test becomes significant.

2. Python Success and Failure Counts

Python success and failure counts for one proportion z test
Python chart showing 580 yes responses and 69 no responses.

The Python count chart confirms the same raw frequency table used in SPSS and R: 580 yes responses and 69 no responses.

3. Python Confidence Interval

Python confidence interval for one proportion z test
Python chart showing the observed proportion with Wilson 95% confidence interval.

The Wilson 95% confidence interval is approximately [.8676, .9151]. Since the whole interval is above .80, it supports the conclusion that the proportion is greater than the hypothesized value.

4. Python Z Statistic Normal Curve

Python normal curve and z statistic for one proportion z test
Python normal curve showing z = 5.967 in the right tail.

The z statistic is far into the right tail of the standard normal curve. This explains why the right-tailed p-value is below .001.

5. Python Candidate Binary Variables

Python candidate binary variable proportions in the student performance dataset
Python chart showing yes proportions for several binary variables in the dataset.

This chart shows why higher is a strong example for a one proportion z test. It has the highest yes proportion among the binary variables examined, with 89.4% yes responses.

6. Python Large-Sample Condition Check

Python large sample condition check for one proportion z test
Python chart confirming n × p0 and n × (1 − p0) are both above 10.

The large-sample chart confirms that the normal approximation is safe. The expected success count is 519.2 and the expected failure count is 129.8.

7. Python Higher Education Aspiration by School

Python higher education aspiration by school
Python chart showing GP and MS school proportions.

The Python school chart confirms the same descriptive group values: GP = 92.4% and MS = 83.6%.

8. Python Higher Education Aspiration by Sex

Python higher education aspiration by sex
Python chart showing female and male yes proportions.

The Python sex chart confirms female students at 90.9% and male students at 87.2%. Both are high, but these group values are descriptive rather than the main hypothesis test.

9. Python P-Value Summary

Python p value summary for one proportion z test
Python chart showing alpha = .05 and p-values below .001.

The p-value chart shows that the p-value is much smaller than the alpha level. This makes the decision to reject H0 straightforward.

10. Python Formula Summary

Python formula summary for one proportion z test
Python formula summary panel showing x, n, p-hat, p0, standard error, z and p-value.

The Python formula panel confirms every numerical component of the test. The key values are x = 580, n = 649, p-hat = .8937, p0 = .8000, SE = .01570 and z = 5.967.

How to Run One Proportion Z Test in SPSS, R, Python and Excel

One Proportion Z Test in SPSS

SPSS does not always provide a direct menu-based one proportion z test table in the same way that R or Python can calculate it manually. The clean approach is to create a binary success variable, aggregate the success count and sample size, and calculate p-hat, standard error, z statistic and p-value using SPSS syntax.

* One Proportion Z Test in SPSS.

GET DATA
 /TYPE=TXT
 /FILE='D:\low kda score priority basis posts\first post\One Proportion Z Test\student-por.csv'
 /ENCODING='UTF8'
 /DELCASE=LINE
 /DELIMITERS=","
 /QUALIFIER='"'
 /ARRANGEMENT=DELIMITED
 /FIRSTCASE=2
 /VARIABLES=
 school A40 sex A20 age F8.0 address A20 famsize A20 Pstatus A20
 Medu F8.0 Fedu F8.0 Mjob A40 Fjob A40 reason A40 guardian A40
 traveltime F8.0 studytime F8.0 failures F8.0 schoolsup A40 famsup A40
 paid A40 activities A40 nursery A40 higher A40 internet A40 romantic A40
 famrel F8.0 freetime F8.0 goout F8.0 Dalc F8.0 Walc F8.0
 health F8.0 absences F8.0 G1 F8.0 G2 F8.0 G3 F8.0.
EXECUTE.

STRING higher_clean (A40).
COMPUTE higher_clean = RTRIM(LTRIM(higher)).
COMPUTE success = 0.
IF (higher_clean = "yes") success = 1.
IF (higher_clean = "no") success = 0.
EXECUTE.

AGGREGATE
 /OUTFILE=* MODE=ADDVARIABLES
 /BREAK=
 /n_valid = N(success)
 /x_success = SUM(success).

COMPUTE p0 = .80.
COMPUTE p_hat = x_success / n_valid.
COMPUTE se_h0 = SQRT((p0 * (1 - p0)) / n_valid).
COMPUTE z_stat = (p_hat - p0) / se_h0.
COMPUTE p_value_right_tailed = 1 - CDF.NORMAL(z_stat, 0, 1).
COMPUTE p_value_two_sided = 2 * (1 - CDF.NORMAL(ABS(z_stat), 0, 1)).
EXECUTE.

TEMPORARY.
SELECT IF ($CASENUM = 1).
LIST VARIABLES=n_valid x_success p_hat p0 se_h0 z_stat p_value_right_tailed p_value_two_sided
 /CASES=FROM 1 TO 1.

One Proportion Z Test in R

In R, the calculation can be done manually using the formula. This gives full control over one-sided and two-sided p-values.

student <- read.csv("student-por.csv")

success <- ifelse(trimws(tolower(student$higher)) == "yes", 1, 0)

n <- length(success)
x <- sum(success)
p_hat <- x / n
p0 <- 0.80

se_h0 <- sqrt(p0 * (1 - p0) / n)
z_value <- (p_hat - p0) / se_h0

p_value_right <- pnorm(z_value, lower.tail = FALSE)
p_value_two_sided <- 2 * pnorm(-abs(z_value))

n
x
p_hat
z_value
p_value_right
p_value_two_sided

One Proportion Z Test in Python

Python can reproduce the same test using pandas for data handling and SciPy for the standard normal p-value.

import pandas as pd
import math
from scipy.stats import norm

student = pd.read_csv("student-por.csv")

success = (student["higher"].str.strip().str.lower() == "yes").astype(int)

n = len(success)
x = success.sum()
p_hat = x / n
p0 = 0.80

se_h0 = math.sqrt(p0 * (1 - p0) / n)
z_value = (p_hat - p0) / se_h0

p_value_right = norm.sf(z_value)
p_value_two_sided = 2 * norm.sf(abs(z_value))

print(n, x, p_hat, se_h0, z_value, p_value_right, p_value_two_sided)

One Proportion Z Test in Excel

Excel is useful for students who want to understand the calculator logic behind the test. Suppose column A contains the higher responses from row 2 to row 650.

Excel task Formula Meaning
Count yes responses =COUNTIF(A2:A650,"yes") Returns x = 580.
Count total responses =COUNTA(A2:A650) Returns n = 649.
Observed p-hat =COUNTIF(A2:A650,"yes")/COUNTA(A2:A650) Returns .893683.
Standard error under H0 =SQRT(0.8*(1-0.8)/649) Returns .015701.
Z statistic =(0.893683-0.8)/SQRT(0.8*(1-0.8)/649) Returns about 5.967.
Right-tailed p-value =1-NORM.S.DIST(5.966522,TRUE) Returns a very small p-value, reported as p < .001.

One Proportion Z Test Calculator Logic

A One Proportion Z Test calculator usually asks for four inputs: success count, sample size, hypothesized proportion and alternative direction. For this example, the inputs are:

Calculator input Value Explanation
Success count x 580 Students who answered yes.
Sample size n 649 Total valid students.
Null proportion p0 .80 Benchmark claim.
Alternative Greater than Right-tailed test: p > .80.

The calculator should return approximately p-hat = .8937, SE = .01570, z = 5.967 and p < .001.

How to Report One Proportion Z Test

A good report includes the test name, sample size, success count, observed proportion, hypothesized proportion, z statistic, p-value and decision.

APA-style reporting: A one-proportion z test showed that the proportion of students who wanted higher education was significantly greater than 80%, z = 5.967, p < .001, p-hat = .894, Wilson 95% CI [.868, .915]. Therefore, the null hypothesis was rejected.

Plain-language reporting: In this sample, 580 out of 649 students wanted higher education. This equals 89.4%, which is significantly greater than the 80% benchmark.

Common Mistakes in One Proportion Z Test

1. Using the test for numeric means

The One Proportion Z Test is for binary outcomes, not continuous variables. For numeric means, use a one-sample t test or z test for a mean.

2. Forgetting the large-sample condition

The normal approximation should be used only when the expected success and failure counts are large enough. In this example, n × p0 and n × (1 − p0) are both much larger than 10.

3. Mixing up p-hat and p0

p-hat is the observed sample proportion. p0 is the hypothesized proportion under the null hypothesis.

4. Reporting p = .000

Statistical software may print .000 for very small p-values. Report it as p < .001.

5. Using a two-sided p-value when the hypothesis is one-sided

If the research question is specifically whether the proportion is greater than p0, the right-tailed p-value is the main p-value. In this article, the main alternative is p > .80.

Download SPSS Output and Verification Files

The fixed SPSS output verifies the correct success count, observed proportion, one-proportion z statistic, p-value, confidence intervals and descriptive crosstab context.

External References

This guide uses verified R, Python and SPSS outputs together with standard statistical documentation and software references. These resources help readers understand proportion testing, z statistics, p-values and confidence intervals.

FAQs About One Proportion Z Test

What is a One Proportion Z Test?

A One Proportion Z Test is a hypothesis test used to compare one observed sample proportion with a hypothesized population proportion.

When should I use a One Proportion Z Test?

Use it when you have one sample, one binary outcome and one hypothesized benchmark proportion.

What was the result in this example?

The result was n = 649, x = 580, p-hat = .893683, z = 5.966522 and p < .001. The null hypothesis was rejected.

What is p-hat in a One Proportion Z Test?

p-hat is the observed sample proportion. In this example, p-hat = 580 / 649 = .893683.

What is p0 in a One Proportion Z Test?

p0 is the hypothesized population proportion under the null hypothesis. In this example, p0 = .80.

What is the formula for a One Proportion Z Test?

The formula is z = (p-hat − p0) / sqrt[p0(1 − p0) / n].

What are the conditions for a One Proportion Z Test?

The outcome should be binary, observations should be independent, and the expected counts n × p0 and n × (1 − p0) should usually be at least 10.

How do I report p-value when SPSS shows .000?

Report it as p < .001, not p = .000.

Can I run a One Proportion Z Test in Excel?

Yes. Excel can calculate x, n, p-hat, standard error, z statistic and p-value using COUNTIF, COUNTA, SQRT and NORM.S.DIST.

Is One Proportion Z Test the same as a binomial test?

No. The one proportion z test uses a normal approximation, while the binomial test uses the exact binomial distribution. With a large sample like this one, both support the same conclusion.

What confidence interval was found in this example?

The Wilson 95% confidence interval was approximately [.8676, .9151].

What does the result mean in plain language?

It means the proportion of students who want higher education is significantly greater than 80% in this sample.

Advertisement
Google AdSense bottom placement reserved here

Advertisement
Google AdSense Bottom placement reserved here

Need Data Analysis Help?

Send your project details and get ethical tutoring, interpretation or dashboard support.

Request Data Analysis Help

About the author

Online Internet Cafe publishes practical guides for statistics, research methods, data analysis tools and ethical project support.

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Request QuoteWhatsApp