Proportion Test (z-test)


The 'NULL' Hypothesis - Setting up the Box

We start by using the box model to represent our null hypothesis.

  • First, we need to specify the 'null' hypothesis for our proportion test. As it is a proportion, the value must be between 0 and 1.
  • This is the proportion we are assuming our null hypothesis is equal to.
  • The null hypothesis changes the tickets in our box that we are drawing from.

Given \( p \), where \( p \) is the proportion of some event:

\( H_0: \) \( p = \)

Error: The value must be strictly between 0 and 1 (a box of all "1"s or all "0"s has no variability, so the test statistic would be undefined). Kept the previous value.

  • Specify how large your sample will be in the text box below.
  • You can think of this as how many tickets we are drawing from the box with replacement.
  • You will enter how many of those draws landed on your event of interest later.

\( n = \)

Error: The value for n must be a whole number greater than 0. Kept the previous value.




The Alternate Hypothesis

Specify what type of alternate hypothesis you will be using below:


Null Hypothesis

Alternate Hypothesis




Assumptions

For the hypothesis test to be valid, we need to check the following assumptions:

The first assumption is that our sample is independent and randomly chosen.

How do we check? We check by investigating the experimental setup.

For example, consider we were investigating data for a proportion test involving human participants. We could read the accompanying scientific publication to understand the methodology they used to gather the people in the sample.

The second assumption is the constant proportion assumption: every member of our sample has the same chance \( p \) of falling in our event of interest.

For example, say we are trialling a new drug, and our event of interest is that a patient's symptoms improve. Here the assumption is that each patient in the trial is just as likely to improve as any other.

How do we check? We check by investigating the experimental setup.






Test Statistic

Step 1) Observed Value (OV)

\( x = \)

Error: The count must be a whole number between 0 and \( n \). Kept the previous value.

Step 2) Calculate Expected Value (EV) and Standard Error (SE)

Step 3) Test Statistic Calculation




p-value



Conclusion (p-value)

One way to tell whether we reject the null hypothesis is to observe whether our p-value is below or above the significance level.

Step 1) What is your significance level?

\( \alpha = \)

Error: The value for α must be strictly between 0 and 1. Reverted to 0.05.

Step 2) Final Conclusion




Conclusion (Confidence Interval)

A confidence interval gives us a second route to the same decision. It gives a plausible range for the unknown population proportion \( p \). If the null proportion falls outside that range, the null value is not among the plausible ones, and we reject the null hypothesis.

Step 1) Where does the confidence level come from?

There is nothing to set here. The confidence level is not a free choice alongside \(\alpha\) — it is determined by it:

\( \text{confidence level} = 1 - \alpha \)

This matters. The confidence interval and the p-value are two ways of reading the same calculation, so they always reach the same verdict — but only when they are set up to describe the same test. That means using \(1 - \alpha\) as the level, and matching the interval to the alternate hypothesis: a two-sided interval for a two-sided test, and a one-sided interval for a one-sided test. Both are done for you below. If you change \(\alpha\) or the alternate hypothesis above, the interval here follows.

A note on the formula: there is more than one way to build a confidence interval for a proportion. The one used here is chosen because it always stays inside the range 0 to 1 — as any proportion must — and because it agrees exactly with the p-value conclusion above. Simpler formulas you may have seen can do neither. You do not need to follow the algebra to use it.

Step 2) Final Conclusion