Quick answer: The steps of hypothesis testing are: (1) state the null and alternative hypothesis, (2) choose the level of significance (alpha, usually 0.05) before seeing the data, (3) choose the right test and check its assumptions, (4) calculate the test statistic and its p-value, and (5) decide, by comparing the p-value with alpha or the test statistic with a critical value, then interpret the result with an effect size and confidence interval. Every t-test, z-test, chi-square test and ANOVA follows these same five steps.
Behind almost every statistical test lies the same logic. Once you understand the hypothesis testing steps, t-tests, ANOVA, chi-square and regression stop looking like separate techniques and start looking like variations on one theme: assume nothing is going on, work out how surprising your data would be under that assumption, and act only if the surprise is large enough.
This guide walks through the steps in statistical hypothesis testing in detail, shows both the critical value approach and the p-value approach to the decision, and then works two complete examples by hand: a one-sample t-test and a two-proportion z-test, with every line of arithmetic shown. It is written for scholars and researchers who must run a test correctly and explain it to a supervisor or reviewer. If your interest is experiments on websites and products, our guide to hypothesis testing in data science covers that context separately.
What Hypothesis Testing Actually Does
Hypothesis testing is a form of argument by contradiction. You cannot prove directly that a training programme raised scores, that two districts differ in sanitation coverage, or that a drug lowers blood pressure, because any sample you collect contains random noise. What you can do is assume the opposite (no effect, no difference) and ask how likely data like yours would be if that assumption were true. If the answer is "very unlikely", you have grounds to abandon the assumption.
Three ideas make this work: the hypothesis is about a population parameter (the true mean or proportion), never the sample you hold; under the null hypothesis the test statistic follows a known sampling distribution (normal, t, chi-square or F), which lets you put a probability on your result; and a decision rule is fixed in advance, so the data cannot move the goalposts.
Hypothesis testing is a branch of inferential statistics; see descriptive vs inferential statistics if the distinction is new.
The Steps of Hypothesis Testing at a Glance
Textbooks list anywhere from four to seven steps, splitting or merging the same content. This guide uses five:
| Step | What you do | Output | Done before or after seeing data? |
|---|---|---|---|
| 1. State hypotheses | Write H0 and H1 about a population parameter | Two mutually exclusive statements | Before |
| 2. Set the level of significance | Choose alpha and one- or two-tailed | Alpha (e.g. 0.05), tail direction | Before |
| 3. Choose the test | Match test to question, data type and design; check assumptions | Named test, plus any fallback | Before (assumption checks after) |
| 4. Compute the test statistic | Calculate t, z, chi-square or F, its degrees of freedom and p-value | A number and a probability | After |
| 5. Decide and interpret | Compare p with alpha (or statistic with critical value); report effect size and CI | Reject or fail to reject H0, in plain words | After |
Three of the five steps happen before any data are analysed. Doing them after looking at the results quietly turns a test into a search for something significant.
Step 1: State the Null and Alternative Hypothesis
Every test starts with two competing statements about the population:
- Null hypothesis (H0): there is no effect, no difference or no association. It always contains the equality: the mean equals 70, the two proportions are equal, the correlation is zero.
- Alternative hypothesis (H1 or Ha): there is an effect. It contains "not equal to", "greater than" or "less than", and it is usually what the researcher expects or hopes to find.
The two must be mutually exclusive and cover every possibility. Some examples:
| Research question | H0 | H1 | Type |
|---|---|---|---|
| Is the average mock test score different from the advertised 70? | mu = 70 | mu is not 70 | Two-tailed |
| Does the new fertiliser increase mean yield? | mu(new) - mu(old) is 0 or less | mu(new) - mu(old) > 0 | One-tailed (upper) |
| Do Block A and Block B differ in clean-fuel use? | p(A) = p(B) | p(A) is not p(B) | Two-tailed |
| Is job satisfaction associated with department? | Satisfaction and department are independent | They are associated | Chi-square (non-directional) |
Two rules prevent most problems here. Decide the direction from theory, not from the data: writing a one-sided H1 after seeing which way the data lean invalidates every p-value that follows. And translate the research question faithfully: a thesis objective such as "to study the impact of training on productivity" must become something testable, such as "mean daily output differs between trained and untrained workers".
You will never "accept" H0. The procedure only allows two outcomes: reject H0, or fail to reject it. Failing to reject means the data were not strong enough to rule out the null, which is not the same as showing the null is true.
Step 2: Choose the Level of Significance
The level of significance, written alpha, is the probability of rejecting H0 when H0 is actually true: the false-positive rate you are willing to accept. It must be fixed before the analysis. The common choices:
| Alpha | Typical use | Confidence level of matching CI |
|---|---|---|
| 0.10 | Pilot and exploratory studies, early screening | 90% |
| 0.05 | Most social science, management, health and thesis research | 95% |
| 0.01 | Clinical, regulatory or high-cost decisions | 99% |
The 0.05 convention is a habit, not a law of nature. A sensible alpha reflects what a false positive would cost compared with a missed effect. Lowering alpha reduces false positives but raises the chance of missing a real effect (a Type II error), unless you increase the sample size to compensate. The trade-off and its real-world consequences are covered in depth in Type I and Type II errors explained.
At this step you also choose one-tailed or two-tailed. With alpha = 0.05 two-tailed, 2.5% sits in each tail of the sampling distribution; one-tailed, the whole 5% sits in one tail. The choice is made here and never revisited.
Step 3: Choose the Test and Check Its Assumptions
The test follows from three things: the type of outcome variable (continuous, ordinal, categorical), the number of groups or variables being compared, and whether observations are independent or paired. The table below maps common research questions to tests. For a fuller decision guide, see how to choose the right statistical test.
| Research question | Outcome | Groups or design | Parametric test | Non-parametric alternative |
|---|---|---|---|---|
| Does one group's mean differ from a known value? | Continuous | One sample | One-sample t-test | Wilcoxon signed-rank (one sample) |
| Does one group's proportion differ from a known value? | Binary | One sample | One-proportion z-test | Exact binomial test |
| Do two independent groups differ in mean? | Continuous | Two independent | Independent-samples t-test (Welch) | Mann-Whitney U |
| Did the same people change from before to after? | Continuous | Two paired | Paired t-test | Wilcoxon signed-rank |
| Do three or more groups differ in mean? | Continuous | Three or more independent | One-way ANOVA | Kruskal-Wallis |
| Do two groups differ in proportion? | Binary | Two independent | Two-proportion z-test or chi-square | Fisher's exact test (small counts) |
| Are two categorical variables associated? | Categorical | Cross-tabulation | Chi-square test of independence | Fisher's exact test |
| Are two continuous variables related? | Continuous | Pairs of measurements | Pearson correlation | Spearman rank correlation |
| Does X predict Y, controlling for other factors? | Continuous or binary | Several predictors | Linear or logistic regression | Robust or rank-based regression |
When the choice is between comparing two groups and comparing several, ANOVA vs t-test explains why running many t-tests is not a substitute for ANOVA. For regression-based tests, see regression analysis explained. Likert items usually need ordinal or scale-level treatment, covered in how to analyse Likert scale data.
Every test carries assumptions, and checking them is part of this step:
- Independence. Repeated measurements on the same person, or households clustered within villages, need paired or multilevel methods.
- Distribution shape. t-tests and ANOVA assume roughly normal data within groups. Above about 30 per group the central limit theorem gives good protection; with small samples, inspect a Q-Q plot.
- Equal variances. Welch's t-test drops this assumption and is a safe default for two groups.
- Expected counts. Chi-square and proportion z-tests need expected counts of at least about 5 per cell; below that, use Fisher's exact test.
Name your fallback test in advance. If you only decide to switch to Mann-Whitney after the t-test came back non-significant, you have run two tests and reported the better one.
Step 4: Compute the Test Statistic
Almost every test statistic has the same structure:
test statistic = (what you observed - what H0 says) / standard error
The numerator measures how far the data sit from the null hypothesis. The denominator measures how much that distance would vary by chance alone. A test statistic of 3 means the observed result lies three standard errors away from what the null predicts. The common formulas:
| Test | Test statistic | Standard error | Degrees of freedom |
|---|---|---|---|
| One-sample t | t = (x-bar - mu0) / SE | s / sqrt(n) | n - 1 |
| Paired t | t = d-bar / SE | s(d) / sqrt(n) | n - 1 (pairs) |
| Welch two-sample t | t = (x-bar1 - x-bar2) / SE | sqrt(s1^2/n1 + s2^2/n2) | Welch-Satterthwaite formula |
| One-proportion z | z = (p-hat - p0) / SE | sqrt(p0(1 - p0)/n) | Not applicable |
| Two-proportion z | z = (p-hat1 - p-hat2) / SE | sqrt(p-pooled(1 - p-pooled)(1/n1 + 1/n2)) | Not applicable |
| Chi-square | chi-square = sum of (O - E)^2 / E | Built into the formula | (rows - 1)(columns - 1) |
Here x-bar is the sample mean, mu0 the null value, s the sample standard deviation and p-hat a sample proportion. Knowing the structure lets you sanity-check software output: a large statistic needs a big difference, a small spread, a large sample, or some combination.
From the test statistic and its sampling distribution, software also returns the p-value: the probability of a test statistic at least as extreme as yours if H0 were true. What it does and does not mean is the subject of the p-value explained, so it is not repeated in depth here.
Step 5: Make the Decision and Interpret It
There are two equivalent ways to make the decision. Both use the alpha you set at Step 2, and both always give the same answer.
The Critical Value Approach
A critical value is the point on the sampling distribution beyond which results are rare enough to reject H0. The region beyond it is the rejection region. For a two-tailed test, reject H0 if the absolute value of the test statistic exceeds the critical value; for a one-tailed test, reject if it lies beyond the critical value in the predicted direction.
| Distribution | Alpha = 0.05 one-tailed | Alpha = 0.05 two-tailed | Alpha = 0.01 two-tailed |
|---|---|---|---|
| z (normal) | 1.645 | 1.960 | 2.576 |
| t, df = 9 | 1.833 | 2.262 | 3.250 |
| t, df = 30 | 1.697 | 2.042 | 2.750 |
| t, df = 120 | 1.658 | 1.980 | 2.617 |
The t values shrink towards z as degrees of freedom increase, because larger samples estimate the standard deviation more precisely. This is the approach most examination papers expect.
The P-Value Approach
The p-value approach compares probabilities rather than statistics:
- If p is less than or equal to alpha, reject H0.
- If p is greater than alpha, fail to reject H0.
This is what you do when reading SPSS, R or Python output. Its advantage is that it tells you how far past the threshold you are: p = 0.049 and p = 0.0001 both reject at 0.05, but they carry very different weight. Report the exact p-value (p = 0.013, not "p < 0.05"), and write p < 0.001 when software prints 0.000.
Interpretation Is Part of the Step
A decision of "reject H0" is not a conclusion. Finish Step 5 by stating, in the language of the research question, the direction and size of the effect in real units, an effect size measure (Cohen's d, a risk difference, an odds ratio), a confidence interval, and whether the effect is large enough to matter in practice.
A statistically significant result can be practically trivial, especially in large samples, and a non-significant result in a small study can hide an important effect. Statistical power and effect size explains how to judge magnitude properly.
Hypothesis Testing Example 1: One-Sample t-Test
Illustrative data. A coaching institute advertises that its students average 70 marks on a standard mock test. A researcher evaluating the claim obtains the scores of 10 randomly selected students:
62, 71, 58, 66, 74, 60, 69, 63, 57, 65
Step 1: hypotheses. The question is whether the true mean differs from the advertised value, in either direction.
- H0: mu = 70
- H1: mu is not 70 (two-tailed)
Step 2: level of significance. Alpha = 0.05, two-tailed, fixed before calculating anything.
Step 3: choose the test. One continuous outcome, one sample, population standard deviation unknown: a one-sample t-test. Assumptions: the students were sampled independently; with n = 10, normality matters, and the scores range from 57 to 74 with no outliers or obvious skew, so a t-test is reasonable. The pre-named fallback would be a Wilcoxon signed-rank test.
Step 4: compute the test statistic.
First, the sample mean. The scores sum to 645, so:
x-bar = 645 / 10 = 64.5
Next, the sample standard deviation. Subtract the mean from each score, square the result and add up the squares:
| Score (x) | x - 64.5 | (x - 64.5)^2 |
|---|---|---|
| 62 | -2.5 | 6.25 |
| 71 | 6.5 | 42.25 |
| 58 | -6.5 | 42.25 |
| 66 | 1.5 | 2.25 |
| 74 | 9.5 | 90.25 |
| 60 | -4.5 | 20.25 |
| 69 | 4.5 | 20.25 |
| 63 | -1.5 | 2.25 |
| 57 | -7.5 | 56.25 |
| 65 | 0.5 | 0.25 |
| Total | 0.0 | 282.50 |
The deviations sum to zero, which is a useful arithmetic check.
s^2 = 282.50 / (10 - 1) = 282.50 / 9 = 31.389
s = sqrt(31.389) = 5.603
Standard error of the mean:
SE = s / sqrt(n) = 5.603 / sqrt(10) = 5.603 / 3.162 = 1.772
Test statistic:
t = (x-bar - mu0) / SE = (64.5 - 70) / 1.772 = -5.5 / 1.772 = -3.10
Degrees of freedom: df = n - 1 = 9.
Step 5: decide and interpret.
Critical value approach. For alpha = 0.05 two-tailed with df = 9, the critical value is 2.262. The absolute value of t is 3.10, which exceeds 2.262, so the statistic falls in the rejection region. Reject H0.
P-value approach. The two-tailed p-value for t = -3.10 with 9 degrees of freedom is 0.013. Since 0.013 is less than 0.05, reject H0. (It is not below 0.01: the 0.01 critical value is 3.250, which 3.10 does not reach.)
Confidence interval. The 95% CI for the true mean is:
64.5 plus or minus 2.262 x 1.772 = 64.5 plus or minus 4.01 = 60.5 to 68.5
The interval does not contain 70, which agrees with the test.
Effect size. Cohen's d = (64.5 - 70) / 5.603 = -0.98, a large effect by conventional benchmarks.
Write-up. "The sampled students' mean mock-test score (M = 64.5, SD = 5.60) was significantly lower than the advertised 70, t(9) = -3.10, p = 0.013, d = -0.98, 95% CI [60.5, 68.5]." The plain-language version: on this evidence, students average roughly 5.5 marks below the advertised figure, and the true average is likely between about 60 and 69.
One caution: with ten students the interval is wide, and a test answers only whether chance explains the gap; it cannot fix a biased sample.
Hypothesis Testing Example 2: Two-Proportion z-Test
Illustrative data. A household baseline survey in two development blocks records whether each household uses clean cooking fuel (LPG or biogas) as its main fuel. A programme team wants to know whether coverage genuinely differs between blocks before deciding where to target a scheme.
| Block | Households surveyed (n) | Using clean fuel (x) | Proportion (p-hat) |
|---|---|---|---|
| Block A | 240 | 132 | 132 / 240 = 0.550 |
| Block B | 220 | 98 | 98 / 220 = 0.4455 |
| Combined | 460 | 230 | 230 / 460 = 0.500 |
Step 1: hypotheses.
- H0: p(A) = p(B), the two blocks have the same true proportion
- H1: p(A) is not p(B) (two-tailed)
Step 2: level of significance. Alpha = 0.05, two-tailed.
Step 3: choose the test. Two independent groups, one binary outcome: a two-proportion z-test (equivalently, a 2 x 2 chi-square test). Assumptions: households were sampled independently in each block (if the survey used cluster sampling, the standard error would need a design-effect adjustment); expected counts are comfortably above 5, since the smallest is 220 x 0.5 = 110.
Step 4: compute the test statistic.
Observed difference:
p-hat(A) - p-hat(B) = 0.5500 - 0.4455 = 0.1045, about 10.5 percentage points
Under H0 the two blocks share one proportion, so we pool the data to estimate it:
p-pooled = (132 + 98) / (240 + 220) = 230 / 460 = 0.500
Standard error under H0:
1/n1 + 1/n2 = 1/240 + 1/220 = 0.004167 + 0.004545 = 0.008712
p-pooled x (1 - p-pooled) = 0.500 x 0.500 = 0.250
SE = sqrt(0.250 x 0.008712) = sqrt(0.002178) = 0.04667
Test statistic:
z = 0.1045 / 0.04667 = 2.24
Step 5: decide and interpret.
Critical value approach. For alpha = 0.05 two-tailed, the critical z is 1.960. Since 2.24 exceeds 1.960, reject H0.
P-value approach. The two-tailed p-value for z = 2.24 is 0.025. Since 0.025 is less than 0.05, reject H0.
Cross-check. A chi-square test on the same 2 x 2 table (without continuity correction) gives chi-square = 5.02 with 1 df and p = 0.025. That is no coincidence: for two proportions, chi-square equals z squared (2.24^2 = 5.02).
Confidence interval. For the interval we no longer assume H0, so the standard error uses each block's own proportion:
SE = sqrt(0.550 x 0.450 / 240 + 0.4455 x 0.5545 / 220)
= sqrt(0.001031 + 0.001123) = sqrt(0.002154) = 0.04641
95% CI = 0.1045 plus or minus 1.96 x 0.04641 = 0.1045 plus or minus 0.0910 = 0.014 to 0.196
Write-up. "Clean cooking fuel use was higher in Block A (55.0%, 132/240) than Block B (44.5%, 98/220), a difference of 10.5 percentage points, z = 2.24, p = 0.025, 95% CI [1.4, 19.6] percentage points."
The interval is the most useful line for the programme team: the true gap is very likely positive, but could be anywhere from about 1 to 20 points. For designing surveys that produce data like this, see what is a baseline survey.
Both examples illustrate a general rule: a two-tailed test at level alpha rejects H0 exactly when the (1 - alpha) confidence interval excludes the null value. The mock-test interval excluded 70; the clean-fuel interval excluded zero. (For proportions the match can be slightly imperfect near the boundary, because the test uses a pooled standard error and the interval an unpooled one.)
One-Tailed or Two-Tailed?
A two-tailed test asks "is there a difference?". A one-tailed test asks "is it bigger?" (or smaller) and treats any result in the other direction as a non-finding, however large.
Because a one-tailed test puts all of alpha in one tail, its critical value is lower (1.645 rather than 1.960 for z), so to reach 80% power it needs roughly 20% fewer observations. Use one only when a result in the opposite direction would genuinely be irrelevant to your decision, and declare it at Step 2. Switching to a one-tailed test after seeing which way the data leaned halves your p-value without justification, and reviewers look for it. Regulatory submissions are almost always two-tailed.
Power, Sample Size and Many Tests
The five steps tell you what to do with data you have. Power analysis, done before Step 1, tells you whether the data you are about to collect can answer the question at all. Power is the probability that a test detects an effect that really exists; the convention is 80%. For a two-group comparison at alpha = 0.05 two-tailed, a medium effect (d = 0.5) needs about 64 participants per group, and a small effect (d = 0.2) about 394.
Lowering alpha makes false positives rarer but missed effects more common; only a larger sample reduces both, which is why sample size calculation comes before data collection. A non-significant result from an underpowered study is close to evidence of nothing at all.
Running many tests creates the opposite problem. Test twenty true null hypotheses at alpha = 0.05 and you expect one false positive by chance. Corrections such as Holm (always at least as powerful as Bonferroni) or Benjamini-Hochberg (for exploratory work) help, but the strongest control is to name one or two primary comparisons before collecting data and label everything else exploratory.
Hypothesis Testing Steps in SPSS, R and Python
Software performs Step 4 instantly, but it cannot do Steps 1 to 3 for you, and it will happily run a test whose assumptions are violated. In SPSS, the one-sample test sits under Analyze, Compare Means, One-Sample T Test, and the output reports "Sig. (2-tailed)"; a one-tailed p-value is half of that only when the effect lies in the predicted direction. In R, t.test and prop.test take an alternative argument for the tail direction; note that prop.test applies a continuity correction by default, so its p-value for Example 2 is slightly larger than the hand calculation. In Python, SciPy's one-sample t-test and the statsmodels proportions z-test give the same figures as above. Our guides to SPSS data analysis for your thesis and getting started with R cover the software side, and common statistical mistakes in research lists the errors that software will not catch.
How to Report a Hypothesis Test
Journals, examiners and reviewers look for the same elements every time:
| Element | Example |
|---|---|
| Test used and why | "One-sample t-test; scores showed no outliers or marked skew" |
| Test statistic with df | t(9) = -3.10 |
| Exact p-value | p = 0.013 (not "p < 0.05") |
| Effect size | Cohen's d = -0.98 |
| Confidence interval | 95% CI [60.5, 68.5] |
| Direction, in plain words | "Students scored about 5.5 marks below the advertised average" |
For table layouts and APA-style wording, see how to present statistical results. The American Statistical Association's statement on statistical significance is six principles long and worth ten minutes, and the NIST/SEMATECH e-Handbook of Statistical Methods is a reliable reference to keep open while you work.
How DSTechnoverse Helps
DSTechnoverse provides statistical and research data analysis in SPSS, R, Python and Stata for PhD scholars, researchers, hospitals, NGOs and businesses. We help frame testable hypotheses, choose the right test and check its assumptions, calculate sample size and power, run the analysis and produce clear tables with effect sizes, confidence intervals and a plain-language explanation of every result. For projects that start in the field, our socio-economic and baseline survey team designs data collection that supports valid tests later. We deliver the analysis and explanation; authorship of any thesis stays with the researcher. Contact us to discuss your dataset.
Frequently Asked Questions
What are the 5 steps of hypothesis testing?
State the null and alternative hypotheses; choose the level of significance (usually 0.05) and the tail direction before seeing the data; select the appropriate test and check its assumptions; compute the test statistic and p-value; then decide, by comparing p with alpha or the statistic with a critical value, and interpret the result with an effect size and confidence interval.
What is the difference between the null and alternative hypothesis?
The null hypothesis (H0) states that there is no effect, difference or association, and always contains the equality, such as mu = 70. The alternative hypothesis (H1) states that an effect exists, using "not equal to", "greater than" or "less than". The test assumes H0 is true and asks whether the data contradict it strongly enough to reject it.
What is the level of significance in hypothesis testing?
The level of significance, alpha, is the probability of rejecting the null hypothesis when it is actually true, which is your accepted false-positive rate. It is chosen before the analysis, most often 0.05, sometimes 0.01 for high-stakes decisions or 0.10 for pilot work. It also sets the critical value and the confidence level of the matching interval.
What is a test statistic?
A test statistic is a single number that measures how far your sample result lies from what the null hypothesis predicts, in units of standard error. Examples are t, z, F and chi-square. Its known sampling distribution under H0 lets you find either a p-value or a critical value, and so decide whether the result is too extreme to put down to chance.
What is the difference between the critical value and p-value approach?
The critical value approach compares your test statistic with a cut-off from a table, such as 1.96 for a two-tailed z-test at 0.05. The p-value approach compares the probability of your result under H0 with alpha. They always reach the same decision. The p-value approach additionally shows how strong the evidence is, which is why it is standard in published work.
Can you accept the null hypothesis?
No. You either reject H0 or fail to reject it. Failing to reject means the data did not provide enough evidence against H0, not that H0 is true; a small or noisy sample can easily miss a real effect. If you genuinely need to show that two treatments are practically equivalent, use an equivalence test designed for that purpose.
When should I use a t-test instead of a z-test?
Use a t-test for means when the population standard deviation is unknown and estimated from the sample, which is almost always the case in practice. The t-distribution has heavier tails to allow for that extra uncertainty. A z-test is appropriate for proportions with adequate sample sizes, or for means when sigma is genuinely known. With large samples the two give nearly identical results.
How large should my sample be for hypothesis testing?
It depends on the smallest effect worth detecting, the variability of the data and the power you want. For two groups at alpha = 0.05 and 80% power, a medium effect (d = 0.5) needs about 64 per group and a small effect (d = 0.2) about 394. Clustered survey designs need more. Our sample size guide works through the calculation.
Do I need a statistician to run a hypothesis test?
Not for a simple two-group comparison with clean data. Help is worthwhile when the design involves clustering, repeated measurements, many covariates, multiple outcomes or a submission where the analysis will be scrutinised by examiners or regulators. Our statistical and research data analysis service covers these cases, from analysis plan to reported tables.
Need help turning your data into defensible results? DSTechnoverse offers statistical and research data analysis services in SPSS, R, and Python — survey analysis, thesis and dissertation support, and business statistics. Get in touch to discuss your dataset.