📊 Week 6: Confidence Intervals and T-Tests

Master T-Distribution and Group Comparisons 🎯

Welcome to Week 6! This week, we explore confidence intervals and t-tests - essential skills for comparing means between groups in agricultural research. Learn to construct confidence intervals, use t-distribution, and interpret statistical comparisons!

🎯 What You'll Learn This Week

🖨️ R Output Functions - Master print(), cat(), and paste() functions
📐 T-Distribution - Apply t-distribution when population variance is unknown
🎯 Confidence Intervals - Build confidence intervals for population means
🌸 Group Comparisons - Compare means between different treatment groups
📊 Data Filtering - Separate datasets by groups using dplyr
🔍 Statistical Inference - Interpret overlapping vs non-overlapping intervals

🚀 Getting Started: Step-by-Step Guide

Step 1: Launch Week 6 Binder Environment 🌐

Click the "Launch Week 6" button above to start your R environment. This will take 2-5 minutes to load with all necessary packages for confidence intervals and t-tests.

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 6 Lab Notebook 📖

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

Step 4: Explore Confidence Intervals 📊

This week we'll work with the iris dataset and confidence intervals! The notebook will guide you through:

🎯 Interactive Learning Tools

Practice with Confidence Intervals and T-Tests

Use these interactive tools to understand confidence interval concepts before working with R code:

💡 Tip: Use these tools to visualize confidence intervals and t-distribution before applying them in your R notebook!

🧮 Key R Functions This Week

Output Functions

print(x) # Standard printing
cat("The value is:", x) # Concatenated output
paste("Result:", x, "units") # String combination
x # Basic display

T-Distribution Functions

qt(1-alpha/2, df = n-1) # Critical t-value
DoF <- n-1 # Degrees of freedom
t_score <- qt(0.975, 49) # 95% confidence, n=50

Confidence Intervals

SE <- sd/sqrt(n) # Standard error
ME <- t_score * SE # Margin of error
CI <- c(mean - ME, mean, mean + ME) # Confidence interval
data %>% filter(Group == "Treatment") # Data filtering

📝 Assignment 6: Wheat Fertilizer Experiment

Step 1: Access Assignment Folder 📋

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

Step 2: Open Assignment 6 Notebook 📄

Double-click on Assignment6.ipynb to open your assignment on confidence intervals for agricultural data.

Assignment Overview (20 points total)

📊

Part 1: Overall Analysis (9 points)

Load data, calculate overall statistics, and construct confidence intervals

🌾

Part 2: Treatment Comparison (11 points)

Compare fertilizer treatments using confidence intervals

Step 3: Analyze Wheat Fertilizer Data 🌾

The assignment focuses on agricultural research applications:

Learn to make evidence-based agricultural decisions using statistical methods!

🌾 Why This Matters in Agriculture

🌱 Fertilizer Effectiveness - Compare crop yields between treated and control plots
🌾 Variety Trials - Determine if new crop varieties perform significantly better
🔬 Quality Control - Establish confidence intervals for product specifications
🐛 Pesticide Efficacy - Compare pest control between different treatments
💧 Irrigation Studies - Compare water use efficiency between methods

Confidence Interval 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 6, 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:

Understand different R printing methods (print, cat, paste)
Construct confidence intervals using t-distribution
Compare group means using confidence intervals
Filter and manipulate data using dplyr functions
Interpret overlapping vs non-overlapping confidence intervals
Apply statistical inference to agricultural research problems

❓ 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 6!

Happy confidence interval building! 📊🌾