Skip to content

5: Hypothesis Testing

Students formulate null and alternative hypotheses, interpret p-values and significance levels, and perform t-tests and ANOVA.

Calculating p-value for Two-Sample t-Test

Click to show Calculating p-value for Two-Sample t-Test example problem

Two-Sample T-Test Scenario
Previously, you compared newborn weights at Joe's Hospital of Fried Foods to the national average (7.5 lbs) using a one-sample t-test. Now, Joe faces a challenge from Alex, CEO of Green Veggies Health Center, who believes her babies are just as heavy as Joe's fried-food babies.
Joe's Hospital of Fried Foods (n=37) and Green Veggies Health Center (n=32) each recorded the weights of newborns this month. Joe believes his hospital's babies weigh more on average than those from Green Veggies.
Use a one tailed two sample t test for H1: μJoe > μVeggies.
Assume unequal variances (Welch's t test).

Joe's Hospital (lbs):
8.3
8.2
8.9
6.9
8.3
8.2
6.3
8.0
6.7
6.5
10.3
6.6
7.4
5.7
8.1
5.1
7.2
5.9
8.4
5.9
9.3
8.0
5.6
7.7
8.8
7.5
9.8
6.8
9.3
6.2
8.5
5.6
8.8
4.8
5.3
8.3
8.6
Green Veggies (lbs):
4.1
7.2
7.5
6.5
7.1
8.5
6.3
8.8
7.1
8.3
7.0
5.6
7.4
10.2
8.0
4.4
7.6
6.5
7.6
8.6
7.6
7.2
6.7
5.5
8.1
5.2
6.1
7.0
8.7
5.7
5.8
7.2

Compute the p value in Google Sheets using the tutorial: link here.
Enter your result as a decimal between 0 and 1 (for example, 0.084, not 8.4%).

 

Determining Differences in Diversity Using ANOVA

Click to show Determining Differences in Diversity Using ANOVA example problem

ANOVA of Shannon Diversity: 1994, 2004, 2009, 2014, 2024
Compare microbial diversity across five years using one way ANOVA.
Sample Data Table:
Copy table rows and use regular paste (Ctrl-V or ⌘-V) into Google Sheets.

Sample
Location
1994
Shannon
Index
2004
Shannon
Index
2009
Shannon
Index
2014
Shannon
Index
2024
Shannon
Index
Andrews Park 4.58 4.42
Beisner Road Entrance 4.54 3.62 3.17 3.78 3.72
Boat Launch Area 4.51 3.71 3.80
Busse Lake 4.08
Debra Park 3.46 3.40
Elk Pasture 4.63 4.31 3.42
Forest Central Grove 4.71 3.92 3.26 3.89 3.31
Forest North Grove 3.95 3.43 4.63 4.35 3.47
Forest South Grove 4.73 2.77 4.61
Forest West Grove 4.31 3.76 4.71 4.00
Lake Boating Center 3.44
Large Event Area 3.66 3.90 4.73 3.67 3.07
Main Dam 4.68 4.44 3.99 4.24
Main Pool 4.99 4.15 2.97 4.50 4.15
Marshall Park 3.36 4.97 3.81 4.18 3.79
Model Airplane Field 3.69 3.79
Nature Preserve 4.11
Ned Brown Meadow 3.87 3.37
North Pool 4.48 2.55 5.02 3.88 3.92
Osborn Park 4.47 5.65 4.12 3.78 3.90
Salt Creek Trail 3.48 3.07 3.56 4.19
South Pool 4.47 4.70
Wildlife Refuge 4.15 4.20 3.70
Woodland Meadow 3.92

Alternate Copyable Format:
Copy this text and use Data → Split text to columns → Comma in Google Sheets.
Sample Location,1994 Shannon Index,2004 Shannon Index,2009 Shannon Index,2014 Shannon Index,2024 Shannon Index
Andrews Park,,,,4.58,4.42
Beisner Road Entrance,4.54,3.62,3.17,3.78,3.72
Boat Launch Area,,,4.51,3.71,3.80
Busse Lake,,,,,4.08
Debra Park,,,,3.46,3.40
Elk Pasture,,,4.63,4.31,3.42
Forest Central Grove,4.71,3.92,3.26,3.89,3.31
Forest North Grove,3.95,3.43,4.63,4.35,3.47
Forest South Grove,,,4.73,2.77,4.61
Forest West Grove,,4.31,3.76,4.71,4.00
Lake Boating Center,,,,,3.44
Large Event Area,3.66,3.90,4.73,3.67,3.07
Main Dam,,4.68,4.44,3.99,4.24
Main Pool,4.99,4.15,2.97,4.50,4.15
Marshall Park,3.36,4.97,3.81,4.18,3.79
Model Airplane Field,,,,3.69,3.79
Nature Preserve,,,,,4.11
Ned Brown Meadow,,,,3.87,3.37
North Pool,4.48,2.55,5.02,3.88,3.92
Osborn Park,4.47,5.65,4.12,3.78,3.90
Salt Creek Trail,,3.48,3.07,3.56,4.19
South Pool,,,,4.47,4.70
Wildlife Refuge,,,4.15,4.20,3.70
Woodland Meadow,,,,,3.92

Enter the ANOVA p value as a decimal between 0 and 1.
Workflow: link here.

 

Determining Statistical Significance Using Two-Sample F-Test

Click to show Determining Statistical Significance Using Two-Sample F-Test example problem

F-Test of Variances: 2014 vs 2024
Use a one tailed F test for H1: variance_2024 < variance_2014.
Sample Data Table:
Copy the table rows and use regular paste (Ctrl-V or ⌘-V) into Google Sheets.

Sample
Location
2014
Shannon
Index
2024
Shannon
Index
Andrews Park 5.20 5.21
Beisner Road Entrance 3.05 3.45
Boat Launch Area 3.92 4.60
Busse Lake 4.78 3.97
Debra Park 3.93 3.73
Elk Pasture 3.10 3.79
Forest Central Grove 4.06 3.18
Forest North Grove 4.61 3.84
Forest South Grove 4.05 4.27
Forest West Grove 3.61 4.39
Lake Boating Center 4.13 3.45
Large Event Area 3.33 3.45
Main Dam 4.17 3.89
Main Pool 4.14 3.52
Marshall Park 3.75 3.27
Model Airplane Field 4.46 3.28
Nature Preserve 3.70 3.29
Ned Brown Meadow 3.68 3.53
North Pool 3.65 4.22
Osborn Park 3.90 3.68
Salt Creek Trail 3.57 4.37
South Pool 4.20 4.27
Wildlife Refuge 4.44 3.62
Woodland Meadow 3.59 3.72

Alternate Copyable Format:
Copy this text and use Data → Split text to columns → Comma in Google Sheets.
Sample Location,2014 Shannon Index,2024 Shannon Index
Andrews Park,5.20,5.21
Beisner Road Entrance,3.05,3.45
Boat Launch Area,3.92,4.60
Busse Lake,4.78,3.97
Debra Park,3.93,3.73
Elk Pasture,3.10,3.79
Forest Central Grove,4.06,3.18
Forest North Grove,4.61,3.84
Forest South Grove,4.05,4.27
Forest West Grove,3.61,4.39
Lake Boating Center,4.13,3.45
Large Event Area,3.33,3.45
Main Dam,4.17,3.89
Main Pool,4.14,3.52
Marshall Park,3.75,3.27
Model Airplane Field,4.46,3.28
Nature Preserve,3.70,3.29
Ned Brown Meadow,3.68,3.53
North Pool,3.65,4.22
Osborn Park,3.90,3.68
Salt Creek Trail,3.57,4.37
South Pool,4.20,4.27
Wildlife Refuge,4.44,3.62
Woodland Meadow,3.59,3.72

Enter the p value as a decimal between 0 and 1.
Workflow: link here.

 

Determining Significance Using Two-Sample T-Test

Click to show Determining Significance Using Two-Sample T-Test example problem

Two-Sample Test of Shannon Diversity: 2014 vs 2024
Use a one tailed Welch two sample t test for H1: mean_2024 < mean_2014.
Assume unequal variances.
Sample Data Table:
Copy the table rows and use regular paste (Ctrl-V or ⌘-V) into Google Sheets.

Sample
Location
2014
Shannon
Index
2024
Shannon
Index
Andrews Park 3.78 3.87
Beisner Road Entrance 3.53 4.46
Boat Launch Area 4.62 3.32
Forest Central Grove 4.73 3.47
Forest North Grove 3.07 4.13
Main Pool 4.29 3.35
Marshall Park 4.51 4.08
Model Airplane Field 4.84 3.80
North Pool 3.84 3.93
Osborn Park 4.49 4.71
Salt Creek Trail 4.18 4.08
South Pool 4.46 4.20
Wildlife Refuge 4.00 3.23
Woodland Meadow 3.96 3.93

Alternate Copyable Format:
Copy this text and use Data → Split text to columns → Comma in Google Sheets.
Sample Location,2014 Shannon Index,2024 Shannon Index
Andrews Park,3.78,3.87
Beisner Road Entrance,3.53,4.46
Boat Launch Area,4.62,3.32
Forest Central Grove,4.73,3.47
Forest North Grove,3.07,4.13
Main Pool,4.29,3.35
Marshall Park,4.51,4.08
Model Airplane Field,4.84,3.80
North Pool,3.84,3.93
Osborn Park,4.49,4.71
Salt Creek Trail,4.18,4.08
South Pool,4.46,4.20
Wildlife Refuge,4.00,3.23
Woodland Meadow,3.96,3.93

Compute the p value in Google Sheets using the tutorial: link here.
Enter the p value as a decimal between 0 and 1.

 

Calculating Chi-Square Value for Phenotype Ratios

Click to show Calculating Chi-Square Value for Phenotype Ratios example problem
Data Table
Phenotype Expected Observed Calculation Statistic
 Yellow Round (Y–R–) 90 87 __ __
 Yellow Wrinkled (Y–rr) 30 27 __ __
 Green Round (yyR–) 30 34 __ __
 Green Wrinkled (yyrr) 10 12 __ __
(sum) χ2 =  __


Complete the table and calculate the chi-squared (χ2) value.
Even though not part of the question, ask yourself whether you would reject or fail to reject the null hypothesis
Note: answers need to be within 3% of the correct number to be correct.

 

Determining Hypothesis Acceptance Using Chi-Squared Test

Click to show Determining Hypothesis Acceptance Using Chi-Squared Test example problem
Table of Chi-Squared (χ²) Critical Values
Degrees of Freedom Probability
0.95 0.90 0.75 0.50 0.25 0.10 0.05 0.01
1 0.00 0.02 0.10 0.45 1.32 2.71 3.84 6.63
2 0.10 0.21 0.58 1.39 2.77 4.61 5.99 9.21
3 0.35 0.58 1.21 2.37 4.11 6.25 7.81 11.34
4 0.71 1.06 1.92 3.36 5.39 7.78 9.49 13.28

Table 1
Phenotype Expected Observed Calculation Statistic
 Yellow Round (Y–R–) 90 80 (80-90)²⁄ 90 1.111
 Yellow Wrinkled (Y–rr) 30 24 (24-30)²⁄ 30 1.200
 Green Round (yyR–) 30 40 (40-30)²⁄ 30 3.333
 Green Wrinkled (yyrr) 10 16 (16-10)²⁄ 10 3.600
(sum) χ² =  9.244

Table 2
Phenotype Expected Observed Calculation Statistic
 Yellow Round (Y–R–) 90 80 (80-90)²⁄ 80 1.250
 Yellow Wrinkled (Y–rr) 30 24 (24-30)²⁄ 24 1.500
 Green Round (yyR–) 30 40 (40-30)²⁄ 40 2.500
 Green Wrinkled (yyrr) 10 16 (16-10)²⁄ 16 2.250
(sum) χ² =  7.500

Table 3
Phenotype Expected Observed Calculation Statistic
 Yellow Round (Y–R–) 90 80 (80-90)⁄ 90 -0.111
 Yellow Wrinkled (Y–rr) 30 24 (24-30)⁄ 30 -0.200
 Green Round (yyR–) 30 40 (40-30)⁄ 30 0.333
 Green Wrinkled (yyrr) 10 16 (16-10)⁄ 10 0.600
(sum) χ² =  0.622


Your lab partner is trying again (eye roll) and did another a chi-squared (χ²) test on the F2 generation in a dihybid cross based on your lab data (above). They wanted to know if the results confirm the expected phenotype ratios.
You helped them set up the null hypothesis, so you know that part is correct, but they got confused and were unsure about how to calculate the chi-squared (χ²) value. So much so that they did it three (3) different ways.
Before you ask your instructor for a new lab partner, tell them which table is correct AND whether they can reject or fail to reject the null hypothesis using the information provided.

 

Flaws in Statistical Hypothesis Testing

Click to show Flaws in Statistical Hypothesis Testing example problem

Your lab partner is trying again (eye roll).
Scenario: Two-sample mean test (Shannon diversity 2014 vs 2024)
Ecologists compare Shannon Diversity Index measurements taken at the same set of sites in 2014 and 2024.
Research question: Is the 2024 value larger than the 2014 value?


They wrote the hypotheses below:
H0: μ2024 (mu_2024) > μ2014 (mu_2014)
In words: The mean Shannon Diversity Index value in 2024 is greater than the value in 2014.
HA: μ2024 (mu_2024) ≤ μ2014 (mu_2014)
In words: The mean Shannon Diversity Index value in 2024 is less than or equal to the value in 2014.
What is the main problem with their hypotheses?

 

Population Z-Test Using Google Sheets Data

Click to show Population Z-Test Using Google Sheets Data example problem

Joe's Hospital of Fried Foods vs National Average
Use a one tailed Z test for H1: mu_hospital > mu.
Fixed population values: μ = 7.5 lbs, σ = 1.5 lbs.
Sample weights (lbs), enter into a single column in Google Sheets:
9.4
9.4
6.3
8.7
7.8
10.6
7.8
7.8
8.0
7.1
7.8
8.3
10.8
5.8
6.5
5.4
8.5
5.4
6.0
6.3
7.5
7.0
7.7
8.5
8.3
8.5
8.3
5.7
8.0
6.9
5.3

Compute the one-tailed p-value using the tutorial workflow from last week: link here.
Enter your result as a decimal between 0 and 1 (for example, 0.084, not 8.4%).

Â