Skip to content

Commit c7020f8

Browse files
committed
Week 09
1 parent cb64da4 commit c7020f8

20 files changed

+7146
-283
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"hash": "c1fc9d9cd82534cb0cf0e5b58d643f42",
3+
"result": {
4+
"engine": "knitr",
5+
"markdown": "---\ntitle: \"Lecture 09: ANOVA Recap and Factorial Designs\"\nsubtitle: \"A potent tool\"\ndate: \"12/02/2024\"\nimage: \"lecture.png\"\nauthor: \n - name: \"Dr. Gordon Wright\"\n orcid: 0000-0001-9424-5743\n email: g.wright@gold.ac.uk\n\ndate-format: \"ddd DD MMM, YYYY\"\nlogo: \"../images/LMLLOGO.png\"\nlicense: \"CC BY-NC-SA\"\n# footer: \ncitations-hover: true\n\n\nformat: \n revealjs: \n mainfont: \"Atkinson Hyperlegible\"\n title-slide-attributes: \n data-background-color: \"#3d0158\" # Plum\n header: \"Research Methods Lecture 09\" # Replace it\n hide-from-titleSlide: \"text\"\n # pdf: default\n # pptx: default\n # html: default\n # docx: default \nexecute:\n echo: false\n freeze: auto\n---\n\n\n\n## Situating ANOVA Within the GLM\n\n## What is the General Linear Model (GLM)?\n\n- **GLM** is a framework that describes a broad set of statistical models.\n- Includes techniques like:\n - ANOVA (Analysis of Variance)\n - Multiple Regression\n - ANCOVA (Analysis of Covariance)\n - MANOVA (Multivariate ANOVA)\n \n## What is the General Linear Model (GLM)?\n\n- Unified by the equation:\n\n$$\nY = X\\beta + \\epsilon\n$$\n\n---\n\n## Visualizing the General Linear Model (GLM)\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![Graphical Representation of the General Linear Model with Intercept(5) and Slope(2).](lecture_files/figure-revealjs/fig-glm-visual-1.png){#fig-glm-visual width=100%}\n:::\n:::\n\n\n\n\n\n## Key Elements of the GLM Equation 1/2\n\n1. **Outcome Variable** (*Y*):\n - The dependent variable being predicted or explained.\n - Usually continuous in both regression and ANOVA models.\n\n2. **Predictors** (*X*):\n - Independent variables in regression (e.g., continuous variables).\n - Grouping variables in ANOVA (e.g., categorical variables).\n \n## Key Elements of the GLM Equation 1/2\n\n3. **Coefficients** (*β*):\n - Represent the estimated weights or effects of predictors (*X*) on the outcome (*Y*).\n\n4. **Error Term** (*ε*):\n - Captures the variation in *Y* that is not explained by the predictors.\n\n---\n\n## ANOVA as a Special Case of GLM\n\n- ANOVA compares means across groups by partitioning variance:\n - **Total Variance = Variance Between Groups + Variance Within Groups**\n- In GLM terms:\n - **X**: Encodes group membership using dummy variables.\n - **β**: Represents group mean effects.\n - **ε**: Residual error capturing unexplained variance.\n\n## Extending to Factorial Designs: Main Effects\n\n- Factorial designs include multiple predictors (e.g., **A** and **B**).\n- Each predictor contributes to the outcome variable (**Y**) through:\n - **Main Effects**:\n - Effect of **A** (e.g., differences across levels of factor A).\n - Effect of **B** (e.g., differences across levels of factor B).\n - **Residual Error**: Variation unexplained by predictors.\n\n---\n\n\n## Extending to Factorial Designs: Interaction Effects\n\n- Interaction effects occur when the effect of one predictor (**A**) depends on the level of the other predictor (**B**).\n- Combined model for a factorial design:\n$$\nY = \\beta_0 + \\beta_1 X_A + \\beta_2 X_B + \\beta_3 (X_A \\times X_B) + \\epsilon\n$$\n- Partitioned Variance in Factorial ANOVA:\n - Main effects of **A** and **B**.\n - Interaction effect (**A × B**).\n - Residual error.\n## ANOVA vs. Multiple Regression\n\n### How They Are Related\n\n- **ANOVA**:\n - Focuses on group differences (categorical predictors).\n - Example: Comparing means of 3 groups.\n\n- **Multiple Regression**:\n - Allows continuous and categorical predictors.\n - Example: Predicting an outcome using test scores and group membership.\n\n- **Connection**:\n - ANOVA is a regression model with categorical predictors encoded as dummy variables.\n\n---\n\n## Example: One-Way ANOVA as Regression\n\n- Regression model for a one-way ANOVA:\n\n**Y = β₀ + β₁X₁ + β₂X₂ + ε**\n\n### Components:\n- **X₁, X₂**: Dummy variables for groups.\n- **β₁**: Difference between group 1 and the reference group.\n- **β₂**: Difference between group 2 and the reference group.\n\n## Visualizing the Relationship\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![ANOVA as regression: Group means represented by dummy variables.](lecture_files/figure-revealjs/fig-anova-regression-1.png){#fig-anova-regression width=100%}\n:::\n:::\n\n\n\n---\n\n## Key Takeaways\n\n### GLM Framework\n\n- ANOVA and Regression are special cases of GLM.\n- Both share the same foundation:\n- **Y = Xβ + ε**:\n - Represents the General Linear Model (GLM).\n - \\(Y\\): Outcome variable (dependent variable).\n - \\(X\\): Predictors (independent variables).\n - \\(β\\): Coefficients for predictors.\n - \\(ε\\): Residual error term.\n\n### Practical Differences\n\n- ANOVA emphasizes group comparisons.\n- Regression allows for both continuous and categorical predictors.\n\n---\n\n## Recap on Factorial Designs\n\n## What Are Factorial Designs?\n\n- Factorial designs involve multiple independent variables (IVs).\n- Common in psychology research for testing complex interactions.\n- Goal: To interpret **main effects** and **interactions**.\n\n---\n\n## Why Focus on 2x2 Designs this year?\n\n- Simplest factorial design with:\n - 2 Independent Variables (IVs).\n - Each IV has 2 levels.\n- Patterns in data can show:\n - Main Effects: Influence of each IV independently.\n - Interactions: Combined influence of IVs.\n\n---\n\n## Understanding the 8 Possible Patterns\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![Bar graphs: 8 possible outcomes in 2x2 design.](lecture_files/figure-revealjs/fig-10bar22-1.png){#fig-10bar22 width=100%}\n:::\n:::\n\n\n\n\n---\n\n## Exploring Main Effects and Interactions\n\n## Interpreting Main Effects\n\n- Main effects represent the **consistent influence** of an IV.\n- Example: **Coffee and wakefulness**:\n - More coffee = Higher alertness, regardless of location.\n\n## Interaction Effects\n\n- Interaction occurs when one IV’s effect depends on the level of another.\n- Example: Coffee may affect wakefulness differently **in the morning** vs. **at night**.\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![Bar chart example of main effect with interaction.](lecture_files/figure-revealjs/fig-main-effect-bar-1.png){#fig-main-effect-bar width=100%}\n:::\n:::\n\n\n---\n\n## Best Practices for Factorial Designs\n\n- Keep designs **simple**: Fewer IVs and levels make interpretation easier.\n- Ensure **sufficient data** for all combinations of IV levels.\n- Always visualize data before analysis to understand patterns.\n\n---\n\n\n## Summary\n\n- **2x2 designs** are foundational in understanding factorial experiments.\n- Interactions complicate main effects but reveal critical relationships.\n- Use clear visualizations to enhance interpretation.\n\n---\n\n## Citation and Acknowledgments\n\n::: {.callout-note collapse=\"true\"}\nThis content is inspired by Matt Crump's *Asking Questions with Data*, CC-BY-NC-SA 4.0.\n\nCrump, M. J. C., Navarro, D. J., & Suzuki, J. (2019, June 5). *Answering Questions with Data (Textbook)*: Introductory Statistics for Psychology Students. https://doi.org/10.17605/OSF.IO/JZE52\n:::\n",
6+
"supporting": [
7+
"lecture_files"
8+
],
9+
"filters": [
10+
"rmarkdown/pagebreak.lua"
11+
],
12+
"includes": {
13+
"include-after-body": [
14+
"\n<script>\n // htmlwidgets need to know to resize themselves when slides are shown/hidden.\n // Fire the \"slideenter\" event (handled by htmlwidgets.js) when the current\n // slide changes (different for each slide format).\n (function () {\n // dispatch for htmlwidgets\n function fireSlideEnter() {\n const event = window.document.createEvent(\"Event\");\n event.initEvent(\"slideenter\", true, true);\n window.document.dispatchEvent(event);\n }\n\n function fireSlideChanged(previousSlide, currentSlide) {\n fireSlideEnter();\n\n // dispatch for shiny\n if (window.jQuery) {\n if (previousSlide) {\n window.jQuery(previousSlide).trigger(\"hidden\");\n }\n if (currentSlide) {\n window.jQuery(currentSlide).trigger(\"shown\");\n }\n }\n }\n\n // hookup for slidy\n if (window.w3c_slidy) {\n window.w3c_slidy.add_observer(function (slide_num) {\n // slide_num starts at position 1\n fireSlideChanged(null, w3c_slidy.slides[slide_num - 1]);\n });\n }\n\n })();\n</script>\n\n"
15+
]
16+
},
17+
"engineDependencies": {},
18+
"preserve": {},
19+
"postProcess": true
20+
}
21+
}
73.1 KB
Loading
63.9 KB
Loading
107 KB
Loading
70.2 KB
Loading
64 KB
Loading

_freeze/week99/ExperimentalDesign/execute-results/tex.json

Lines changed: 17 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)