Introduce to Hypothesis Testing
CMSC 320
2026
Fardina F Alam
(PART01)
Topics we will cover
CMSC320 Textbook Chapter: Chapter 8
“Data alone is not interesting.
It is the interpretation of the data that we are really interested in.”
Hypothesis Testing (Making Informed Decisions with Data)
Hypothesis Testing
Hypothesis testing is a statistical method used to make informed decisions or draw conclusions about a population based on a sample of data.
RECAP:
Population: The entire group that you are interested in studying.
Sample: A subset of the population used for analysis.
Main Steps of Hypothesis Testing
Collect Data
Obtain a representative sample from the population.
Remember the importance of recognizing whether data is collected through an experimental design or observational study.
Sampling Method
Random sampling� • Every unit has equal chance of selection.
A sampling method is a process by which individual items/event (observational units) are selected from the population to be included in the sample. Common sampling methods:
Stratified sampling� • Population divided into meaningful groups (strata).� • Random samples taken from each group.
Cluster sampling� • Population divided into clusters (e.g., locations).� • Randomly select clusters and include all units inside.
Systematic sampling� • Random start → select every kth unit.
Convenience sampling (non-probability)� • Select easiest or most available participants.� • Fast but may introduce bias.
Sampling Methods: Examples
Two hypotheses involved in hypothesis testing
Hypothesis: a claim we test using data (about a population).
Null hypothesis (H₀): no effect / no difference (current assumption)�Alternative hypothesis (Hₐ): real effect / difference (opposite of H₀)
Possible Outcomes of a Test
(We never “prove” H₀ true.)
Example:� H₀: average stay = 5 days� Hₐ: average stay ≠ 5 days
Let’s say, It is believed that a candy making machine makes chocolate bars that are on average 5 gram in weight. A worker claims that the machine after maintenance no longer makes 5 gram bar. Write down H0 and Ha.
H0 and Ha. are mathematical opposite (mutually exclusive)
Practice: Doctors believe that the average teen sleeps on average of no longer than 10 hours per day. A researcher believes that teens on average sleep longer. Write down H0 and Ha.
Significance Level (α) & Decision
Significance level (α): Probability of rejecting a true null hypothesis (Type I error)
Common choices:� • α = 0.05� • α = 0.01
Set before collecting or analyzing data
Smaller α → stronger evidence required to reject H₀
Significance Level: Example
Let's say you're testing a new treatment for headaches.
Your null hypothesis (H0) : the treatment has no effect, and
Your alternative hypothesis (H1) : the treatment reduces headaches.
Collect Data, Choose a Statistical Test & Compute Test Statistic
Choose a Statistical Test Based on research question, data type, and number of groups:
Compute the Test Statistic From sample data, calculate a number that measures how far the sample result is from what H₀ predicts
Common statistics: z, t
Interpretation: Large magnitude → sample is far from H₀ → stronger more evidence against H₀
Example: Compare two means → compute a t-value
Decision Methods in Hypothesis Testing
After computing the test statistic, decide whether to reject H₀. Two equivalent ways to make a decision:
1. Critical Value Approach
Compare test statistic to critical value (cutoff).
2. p-value Approach
Compare p-value to significance level α.
Both methods give the same conclusion.
Decision: Is the Result Extreme Enough?
(LATER TOPIC) Decision Methods in Hypothesis Testing
Rejection Region (Critical Value Approach)
P-value Approach
Probability of observing results this extreme if H₀ is true.
Key Idea
More extreme result → stronger evidence against H₀
Q: How confident you are with your decision?
Ho: μ = 5 gram. ; Ha : μ ≠ 5 gram.
Possible Outcomes of this test: Reject the null hypothesis or Fail to Reject the null hypothesis
Example: We sample 50 chocolate bars and get average value of mass of the bar.
Let’s say:
Monday → Received average value of mass of the bar 5.12 gram
Wednesday → Received average value of mass of the bar 5.75 gram
Friday → Received average value of mass of the bar 7.82 gram
How much I am confident that I should reject the Ho or not! → we need a CONCRETE WAY to look at the Ho
Confidence Level (C) & Significance Level (α)
How confident are we in our decision?
Remember: Significance Level (α): risk of being wrong (rejecting a true H₀)
Confidence Level (C)
Relationship: α=1−C
Example: 95% confidence → α = 0.05
Interpretation
How to decide C or Alpha value? depends on several factors, including the nature of the research, the consequences of making Type I and Type II errors, and the standard practices in the field. A general guide for choosing the value:
Type I and Type II Errors
Mistakes we can make in hypothesis testing:
Type I Error (False Positive) Reject H₀ when it is actually true
Type II Error (False Negative) Fail to reject H₀ when it is actually false
These errors are important to consider because they affect the validity of the conclusions drawn from hypothesis testing.
Practice: A company stated that their straw machine makes straws that are 4mm in diameter. But a worker believes that the machine no longer makes straws of this size and samples 100 straws to perform a hypothesis test with 99% confidence . Write down H0, H, N, C, alpha.
Example: What is Type I and II error?
Collect data from a sample of patients and conduct a statistical test.
Let's say you're testing whether a new drug is effective in reducing blood pressure.
Your null hypothesis (H0) : the drug has no effect on blood pressure, and
Your alternative hypothesis (H1) : the drug reduces blood pressure on avg.
Type I error → concluding that the drug is effective at reducing blood pressure when, in reality, it has no effect. (a false positive result, indicating the drug works when it doesn't.)
Type II error → failing to detect that the drug is effective at reducing blood pressure when, in fact, it does reduce blood pressure (a false negative result, indicating the drug doesn't work when it actually does.)