Hypothesis Testing
STA1505 - Statistics for Beginners · Inferential Statistics
Hypothesis Testing
Hypothesis testing is a statistical method used to make decisions based on data. It helps you determine whether to accept or reject a statement about a population parameter based on sample data. This process involves several steps, including formulating hypotheses, selecting a significance level, calculating a test statistic, and making a decision.
Formulating Hypotheses
In hypothesis testing, you start with two competing hypotheses:
- Null Hypothesis (H0): This is the hypothesis that there is no effect or no difference. It is the hypothesis you aim to test against.
- Alternative Hypothesis (H1 or Ha): This is the hypothesis that indicates the presence of an effect or a difference. It is what you might believe to be true if you reject the null hypothesis.
For example, suppose a company claims that their light bulbs last an average of 1,000 hours. You want to test this claim. Your hypotheses would be:
- H0: μ = 1000 (The average lifespan of the light bulbs is 1,000 hours)
- H1: μ ≠ 1000 (The average lifespan of the light bulbs is not 1,000 hours)
Remember: Always state your hypotheses clearly before collecting data.
Selecting a Significance Level
The significance level (α) is the probability of rejecting the null hypothesis when it is actually true. Common significance levels are 0.05, 0.01, and 0.10. A significance level of 0.05 means there is a 5% risk of concluding that a difference exists when there is no actual difference.
For our example, if we choose a significance level of α = 0.05, we are willing to accept a 5% chance of making an error in our conclusion.
Calculating the Test Statistic
The test statistic is a standardized value that is calculated from sample data during a hypothesis test. It helps determine how far the sample statistic is from the null hypothesis value, measured in terms of standard errors.
For a one-sample Z-test, the test statistic (Z) is calculated using the formula:
Z = (X̄ - μ) / (σ / √n)
Where:
- X̄ = sample mean
- μ = population mean under the null hypothesis
- σ = population standard deviation
- n = sample size
Let’s say you take a sample of 30 light bulbs, and you find that the sample mean lifespan is 980 hours, with a population standard deviation of 100 hours. You can calculate the Z value as follows:
Given: X̄ = 980, μ = 1000, σ = 100, n = 30Z = (980 - 1000) / (100 / √30)Z = -20 / (100 / 5.477) // √30 ≈ 5.477Z = -20 / 18.257 = -1.095Making a Decision
Once you have calculated the test statistic, you compare it to critical values from the Z-table based on your chosen significance level. For a two-tailed test at α = 0.05, the critical Z values are approximately ±1.96.
If the absolute value of your test statistic is greater than the critical value, you reject the null hypothesis. If it is less, you fail to reject the null hypothesis.
In our case, since -1.095 is between -1.96 and 1.96, we fail to reject the null hypothesis. This means there is not enough evidence to conclude that the average lifespan of the light bulbs is different from 1,000 hours.
Watch out: Do not confuse failing to reject the null hypothesis with accepting it. Failing to reject means there is not enough evidence against it, but it does not prove it is true.
Types of Errors in Hypothesis Testing
There are two types of errors that can occur in hypothesis testing:
- Type I Error: This occurs when you reject the null hypothesis when it is actually true. The probability of making a Type I error is equal to the significance level (α).
- Type II Error: This occurs when you fail to reject the null hypothesis when it is false. The probability of making a Type II error is denoted by β.
Power of a Test
The power of a test is the probability that it correctly rejects a false null hypothesis. It is calculated as:
Power = 1 - β
A higher power means a better chance of detecting an effect when one exists. You can increase the power of a test by increasing the sample size or using a higher significance level.
Conclusion
Hypothesis testing is a systematic way to evaluate claims about population parameters. By following the steps of formulating hypotheses, selecting a significance level, calculating a test statistic, and making a decision, you can make informed conclusions based on sample data.
Remember: Always report your findings clearly, stating whether you rejected or failed to reject the null hypothesis and what that means in the context of your research.
Summary
- Hypothesis testing involves a null hypothesis and an alternative hypothesis.
- The significance level (α) determines the threshold for rejecting the null hypothesis.
- The test statistic helps assess how far the sample data is from the null hypothesis.
- Type I and Type II errors are important considerations in hypothesis testing.
- The power of a test indicates its ability to detect an effect when it exists.
Check your understanding
- What are the null and alternative hypotheses in a hypothesis test?
- What does a significance level of 0.01 imply?
- How do you calculate the test statistic for a one-sample Z-test?
- What is the difference between Type I and Type II errors?