In order to do a 1-sample z-test, we first need to provide our single (one) sample that we will be analysing. Below you can choose pre-uploaded data to analyse, or you can manually enter data.
What data source will you be using?
Enter data into the text box below.
Warning: You must have at least two unique values in your manually specified data.
In order to proceed, you must select some data to act as your sample.
We start by using the box model to represent our null hypothesis.
An assumption for the 1-sample z-test is that the standard deviation of the population (denoted \(\sigma\)) from which our sample is drawn is
known. For example, a prior research paper may have estimated the population standard deviation, and you could use the value they discovered.
In Mr. Han’s case study, \(\sigma = 7.5\) was known from years of exam results, and that is the value loaded below.
If you switch to one of the other data sets, no such value exists, and that is the realistic situation — most of the time \(\sigma\) is simply
unknown. The button below lets you plug in the sample standard deviation so you can keep exploring, but it is only a stand-in for a value this
test assumes we already know. When \(\sigma\) is genuinely unknown, the right tool is the
1-sample t-test, which is built to handle exactly that.
\(\sigma = \)
Next we need to specify the 'null' hypothesis. In this test we are focusing on the mean, so the null hypothesis is that the population mean is equal to some value which we set below. Note that this is the mean of the population our sample was drawn from — a quantity we cannot observe — and not the mean of the sample itself, which we can simply calculate.
Given \(\mu \), where \(\mu \) is the population mean of the variable being analysed:
\( H_0: \) \(\mu = \)
Specify what type of alternate hypothesis you will be using below. This starts on one sided (greater than) to match Mr. Han’s case study, where the question was specifically whether his students average above 140. Choose the two-sided option when the question is whether the mean differs from the null value in either direction, which is the more common situation.
Null Hypothesis
Alternate Hypothesis
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 from the population we want to draw a conclusion about. This is what licenses us to treat the sample mean as evidence about the population mean at all.
How do we check? We check by investigating the experimental setup. There is no plot or number on this
page that can tell us whether this assumption holds — it is a question about how the data was collected, so we have to look at how the study was
run.
In Mr. Han’s case study the assumption is satisfied, and it is worth seeing why. The board handed him 25 papers drawn at random from
across the country, so every student who sat the exam was equally likely to be in his pile, and one paper landing in it tells us nothing about which
others did. That is exactly what the box model assumes: 25 independent draws from the box.
Contrast this with what would happen if Mr. Han had instead marked the 25 papers from his own class. That is also 25 marks, and the arithmetic on
this page would run just the same, but they would be one class taught by one teacher, quite possibly streamed by ability. Nothing in the calculation
would warn us; the conclusion would simply not be about the country’s students any more. When you work with real data, you would read the methodology
section of the accompanying publication and ask exactly this question of it.
The second assumption is that the sample mean follows a normal distribution — that is, if we kept drawing fresh samples of this size from the box and recorded each sample mean, those means would form a normal curve. This is what lets us read the p-value off a normal curve further down the page. Note that the assumption is about the sample mean, not about the individual values.
There are two separate routes to it, and it is worth knowing which one you are relying on.
How do we check?
Idea 1: Large n
Idea 2: QQ-plot, Boxplot and Histogram
The other route is the shape of the data itself. The central limit theorem is what rescues us when the values in the box are not normal. If
they are already normal, we do not need it at all: the sample mean is then exactly normal for any sample size, even a very small one. So the
closer our data looks to normal, the less we are leaning on a large n.
Be careful about the direction of this reasoning: these plots show us the shape of the sample, and we are using that as a clue about the shape of the box. A small sample can look non-normal by chance even when the box is normal, and vice versa.
As mentioned previously in "The NULL Hypothesis - Setting up the Box" section, it is assumed that the population standard deviation is known. This is the assumption that makes this a z-test: because \(\sigma\) is treated as a known constant, the test statistic sits on a standard normal curve and there are no degrees of freedom to worry about.
How do we check? Like Assumption 1, this is not something the data can answer. We ask where the value of \(\sigma\) came from. A value established from a large body of prior results satisfies the assumption, and Mr. Han’s case study is a rare example of this genuinely holding: the exam has run for years, so the spread of marks across the country is already known to be 7.5, and Mr. Han is marking papers from that same population. A value computed from the sample we are about to test does not satisfy the assumption — in that case it is violated, and the 1-sample t-test is the appropriate test instead.
Step 1) Calculate Expected Value (EV) and Standard Error (SE)
Step 2) Test Statistic Calculation
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
A confidence interval gives us a second route to the same decision. It is built around our observed sample mean and gives a plausible range for the unknown population mean. If the null hypothesis value 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.
So if the two conclusions ever disagreed, that would be a sign we had described two different tests, not a genuine statistical puzzle.
Step 2) Final Conclusion