๐Ÿ“Š Week 8: Hypothesis Testing and Statistical Analysis

Master Advanced Statistical Testing Methods ๐ŸŽฏ

Welcome to Week 8! This week, we dive deep into hypothesis testing methods - essential skills for making statistical inferences in agricultural and biological research. Learn one-sample tests, paired t-tests, and chi-square analysis!

๐ŸŽฏ What You'll Learn This Week

๐Ÿ”ฌ One-Sample T-Tests - Compare sample means against known values
๐Ÿ“Š Two-Sample T-Tests - Compare means between independent groups
๐Ÿ”— Paired T-Tests - Analyze before/after or matched pair data
๐ŸŽฒ Chi-Square Tests - Test goodness of fit and independence
โš–๏ธ Critical Value Method - Manual hypothesis testing approach
๐Ÿ“ˆ P-Value Method - Modern statistical inference approach

๐Ÿš€ Getting Started: Step-by-Step Guide

Step 1: Launch Week 8 Binder Environment ๐ŸŒ

Click the "Launch Week 8" button above to start your R environment. This will take 2-5 minutes to load with all necessary packages for hypothesis testing.

Step 2: Navigate to Class Activity ๐Ÿ“š

Once Binder loads, you'll see the Jupyter Notebook interface. In the left panel, you'll see:

Click on the class_activity folder to access this week's content.

Step 3: Open the Week 8 Lab Notebook ๐Ÿ“–

Inside the class_activity folder, double-click on Week8_Correlation_Analysis.ipynb to open the interactive lab notebook.

Step 4: Explore Hypothesis Testing Methods ๐Ÿ“Š

This week we'll work with multiple datasets including iris and agricultural yield data! The notebook will guide you through:

๐ŸŽฏ Interactive Learning Tools

Practice with Hypothesis Testing Concepts

Use these interactive tools to understand hypothesis testing concepts before working with R code:

๐Ÿ’ก Tip: Use these tools to practice hypothesis formation and visualize statistical concepts before applying them in your R notebook!

๐Ÿงฎ Key R Functions This Week

One-Sample T-Tests

t.test(data, mu = 4, alternative = "two.sided") # Two-tailed test
t.test(data, mu = 4, alternative = "greater") # One-tailed (greater)
t.test(data, mu = 4, alternative = "less") # One-tailed (less)
qt(1 - alpha/2, df = n-1) # Critical t-value

Two-Sample and Paired T-Tests

t.test(group1, group2, paired = FALSE) # Independent samples
t.test(before, after, paired = TRUE) # Paired samples
t.test(group1, group2, var.equal = FALSE) # Welch's t-test
subset(data, Species == "setosa") # Data filtering

Chi-Square Tests

chisq.test(observed, p = expected/sum(expected)) # Goodness of fit
chisq.test(contingency_table) # Test of independence
matrix(c(data), nrow = 2, byrow = TRUE) # Create contingency table
pt(t_stat, df = n-1) # P-value calculation

๐Ÿ“ Assignment 8: Biodiversity Wildfire Analysis

Step 1: Access Assignment Folder ๐Ÿ“‹

From the main directory, click on the assignment folder to access Assignment 8.

Step 2: Open Assignment 8 Notebook ๐Ÿ“„

Double-click on Assignment8.ipynb to open your assignment on biodiversity analysis.

Assignment Overview (15 points total)

๐Ÿ“Š

Part 1: Data Import & Visualization (3 points)

Load biodiversity data and check distributions

๐Ÿ”ฌ

Part 2A: General Effect Test (3 points)

Test if wildfire significantly affected biodiversity

๐Ÿ“ˆ

Part 2B: Increase Test (3 points)

Test if wildfire significantly increased biodiversity

๐Ÿ“‰

Part 2C: Decrease Test (3 points)

Test if wildfire significantly reduced biodiversity

๐Ÿค”

Part 3: Analysis Limitations (3 points)

Discuss limitations of the statistical analysis

Step 3: Analyze Wildfire Impact Data ๐Ÿ”ฅ

The assignment focuses on environmental research applications:

Learn to make evidence-based environmental decisions using rigorous statistical testing!

๐ŸŒฟ Why This Matters in Environmental Science

๐Ÿ”ฅ Wildfire Impact - Assess ecological effects of natural disturbances
๐ŸŒฑ Treatment Effects - Test agricultural intervention effectiveness
๐Ÿฆ‹ Biodiversity Studies - Compare species richness across conditions
๐ŸŒก๏ธ Climate Research - Analyze environmental change impacts
๐Ÿงช Experimental Design - Choose appropriate statistical tests

Hypothesis Testing Skills Help You:

๐Ÿ’พ Saving Your Work

โš ๏ธ Important: Binder environments are temporary! Always save your work locally.

Download Your Notebook ๐Ÿ“ฅ

When you're done working, save your progress:

  1. Save your notebook: File โ†’ Save
  2. Download .ipynb file: File โ†’ Download
  3. Export HTML/PDF: File โ†’ Save and Export Notebook As โ†’ HTML

Continue Your Progress Later ๐Ÿ”„

To resume your work:

  1. Launch Binder again
  2. Click Upload button
  3. Upload your saved .ipynb file
  4. Continue where you left off!

๐Ÿ“ค Submission Requirements

For Assignment 8, submit TWO files to UC Davis Canvas:

๐Ÿ“„

HTML/PDF Report

Your completed assignment with all outputs and analysis

๐Ÿ’พ

.ipynb File

Your notebook code as backup

Due Date: Check Canvas for assignment deadline

๐ŸŽฏ Learning Objectives

By the end of this week, you will be able to:

โœ… Form appropriate null and alternative hypotheses
โœ… Perform one-sample t-tests using multiple methods
โœ… Conduct two-sample and paired t-tests appropriately
โœ… Apply chi-square tests for categorical data
โœ… Interpret statistical results and draw valid conclusions
โœ… Understand limitations of statistical analyses

โ“ Need Help?

๐Ÿ“ง Contact Information

Mohammadreza Narimani
๐Ÿ“ง mnarimani@ucdavis.edu
๐Ÿซ Department of Biological and Agricultural Engineering, UC Davis

๐Ÿ”ง Common Issues

๐Ÿ“š Additional Resources

๐ŸŒŸ Tips for Success

๐Ÿ’ก Best Practices

โšก Keyboard Shortcuts

Shift + Enter Run current cell and move to next
Ctrl + Enter Run current cell and stay in place
Tab Auto-complete function names
?function Get help for any R function

๐ŸŽ‰ Ready to Start?

Click the Binder badge below to launch Week 8!

Happy hypothesis testing! ๐Ÿ”ฌ๐Ÿ“Š