Overview

This section focuses on advanced statistical analysis using R. You'll learn hypothesis testing, regression analysis, ANOVA, and model diagnostics.

Learning Objectives

By the end of this section, you will be able to: - Understand probability distributions in R - Perform various hypothesis tests (t-tests, chi-square, non-parametric) - Build and interpret linear regression models - Conduct ANOVA (one-way, two-way, repeated measures) - Perform post-hoc analyses - Evaluate model assumptions and diagnostics - Select and compare models - Apply statistical methods to real research problems

Prerequisites

  • Completed Intermediate Level
  • Solid understanding of data manipulation and visualization
  • Basic statistical knowledge (recommended)
  • Familiarity with exploratory data analysis

Required Packages

  • car - regression diagnostics
  • lmtest - testing linear models
  • MASS - statistical methods
  • multcomp - multiple comparisons
  • effects - effect displays
  • nortest - normality tests

Course Materials

1. Probability Distributions

File: 01-probability-distributions.Rmd - Normal distribution - t-distribution - Chi-square distribution - F-distribution - Generating random numbers - Density, cumulative, and quantile functions

2. Hypothesis Testing

File: 02-hypothesis-testing.Rmd - One-sample and two-sample t-tests - Paired t-tests - Chi-square tests - Non-parametric tests (Mann-Whitney, Wilcoxon) - Interpreting p-values and confidence intervals - Effect sizes

3. Linear Regression

File: 03-linear-regression.Rmd - Simple linear regression - Multiple linear regression - Model assumptions - Diagnostics (residuals, leverage, Cook's distance) - Interpreting coefficients - Model validation

4. Advanced ANOVA

File: 04-advanced-anova.R - One-way ANOVA - Two-way ANOVA - Interaction effects - Repeated measures ANOVA - ANCOVA - Post-hoc tests (Tukey HSD, Bonferroni)

5. Model Selection

File: 05-model-selection.R - Variable selection methods - Model comparison (AIC, BIC) - Cross-validation - Overfitting and generalization - Stepwise regression (use with caution)

Exercises

Complete exercises/advanced-exercises.R - statistical analysis case studies requiring full reports.

Solutions in solutions/advanced-solutions.R show complete statistical workflows.

How to Use This Section

  1. Understand the statistical theory behind each method
  2. Run all examples with provided data
  3. Pay attention to assumptions and diagnostics
  4. Practice interpreting results
  5. Complete case study exercises
  6. Create your own analyses

Estimated Time

  • Week 1: Distributions and Hypothesis Testing (10 hours)
  • Week 2: Linear Regression and Diagnostics (12 hours)
  • Week 3: ANOVA and Post-hoc Tests (12 hours)
  • Week 4: Model Selection and Case Studies (12 hours)
  • Week 5: Review and Capstone Project (10 hours)

Total: 56 hours

Tips for Success

  • Always check model assumptions
  • Don't ignore diagnostics
  • Understand the hypotheses being tested
  • Learn to interpret statistical output
  • Know when to use each test
  • Practice with diverse datasets
  • Think critically about results

Key Statistical Concepts

  • Null hypothesis: Statement of no effect
  • Alternative hypothesis: Statement of effect
  • Type I and Type II errors: False positive and false negative
  • Effect size: Practical significance, not just statistical
  • Model assumptions: Conditions under which methods are valid
  • Diagnostics: Tools to check assumptions

Important Notes

  • Statistical significance ≠ Practical significance
  • Always check assumptions before using tests
  • Visual inspection complements numerical tests
  • Report effect sizes along with p-values
  • Use appropriate tests for your data type
  • Consider multiple testing correction when needed

Next Steps

After completing this section, you'll be ready for: - Research projects using R - Statistical consulting work - Advanced modeling techniques - Machine learning with R

Additional Resources

  • R for Data Science by Hadley Wickham
  • An Introduction to Statistical Learning
  • The Elements of Statistical Learning