lab5
lab5
Hypothesis testing is a core concept in statistics used to analyze whether a claim about a
population holds true based on sample data. It involves testing two opposing statements:
the null hypothesis (H₀) and the alternative hypothesis (H₁).
Example:
Suppose a company launches a new teaching method and claims it improves students'
math scores. The null hypothesis would state: "The new teaching method does not
improve students' math scores."
Mathematical Representation:
- For population means: H₀: μ₁ = μ₂ (no difference between the mean scores of students
taught with the new method and the traditional method).
Example:
Continuing the teaching method study, the alternative hypothesis would state: "The new
teaching method improves students' math scores."
Mathematical Representation:
- One-sided test: H₁: μ₁ > μ₂ (new method results in higher scores).
- Two-sided test: H₁: μ₁ ≠ μ₂ (new method results in scores that are either higher or
lower than the traditional method).
The Z-test is used when the population standard deviation (σ) is known and the sample
size is large (n > 30).
Steps:
1. Set Hypotheses:
- H₀: μ₁ = μ₀ (no difference).
- H₁: μ₁ ≠ μ₀ (difference exists).
4. Decision Rule:
- Reject H₀ if the z-statistic falls outside the critical range.
Example:
A school claims the average test score of its students is 75. You collect a sample and test
whether the true mean differs from 75.
T-Test (When Population Standard Deviation is Unknown):
The T-test is applied when the sample size is small (n ≤ 30) and σ is unknown. Instead,
the sample standard deviation (s) is used.
Steps:
1. Set Hypotheses:
- H₀: μ₁ = μ₀
- H₁: μ₁ ≠ μ₀
4. Decision Rule:
- Compare the t-statistic with the critical values.
Example:
A restaurant claims their average delivery time is 30 minutes. You take a small sample of
delivery times and test whether the mean is significantly different.
Why It Matters
Hypothesis testing ensures that decisions are based on evidence rather than random
variability. Whether testing a new drug, comparing teaching strategies, or evaluating
production processes, it provides a systematic way to validate claims.
Example: One-Tailed Z-Test
Problem: A manufacturer claims that the average lifetime of a light bulb is 1000 hours.
A sample of 36 bulbs is tested, and the sample mean lifetime is found to be 980 hours
with a population standard deviation of 80 hours. We want to test if the average lifetime
of the bulbs is less than 1000 hours at a significance level of α = 0.05.
Source Code:
Source Code
Source code
Discussion
In this lab, we got hands-on with hypothesis testing using Z-tests and T-tests to make
sense of sample data. We ran both one-tailed and two-tailed tests, which let us check for
specific effects or general differences. For big samples where we knew the population
variance, we used Z-tests to calculate Z-scores and p-values, helping us figure out if we
should reject the null hypothesis. For smaller samples or when we didn’t know the
population variance, T-tests came to the rescue, providing T-scores and p-values. These
tests helped us see if the sample mean was significantly different from the population
mean, whether in a specific direction or not. This lab emphasized how crucial hypothesis
testing is for making decisions based on data and illustrated when to use Z-tests versus T-
tests.
Conclusion
This lab gave us practical experience with Z-tests and T-tests, essential for hypothesis
testing. By crunching Z-scores, T-scores, and p-values, we learned to gauge the
significance of our data. Running both one-tailed and two-tailed tests showed us the
importance of considering the direction of effects in our analyses. The hands-on approach
strengthened our grasp of statistical concepts and their real-world applications. These
skills are key for conducting solid research and making informed decisions based on
stats. All in all, this lab provided a strong foundation in hypothesis testing, gearing us up
for more advanced data analysis in various fields.