From 4aa78003560e56e9caa213e46e11064e9707c149 Mon Sep 17 00:00:00 2001 From: Harpreet Kaur Date: Wed, 24 Jul 2024 16:17:39 -0700 Subject: [PATCH] background-formatting changes --- chapters/background.qmd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/chapters/background.qmd b/chapters/background.qmd index 4900a97..4396dea 100644 --- a/chapters/background.qmd +++ b/chapters/background.qmd @@ -2,6 +2,9 @@ Mixed-effects models are called “mixed” because they simultaneously model fixed and random effects. Fixed effects (e.g. treatments) represent population-level (i.e., average) effects that should persist across experiments. Fixed effects are similar to the parameters found in “traditional” regression techniques like ordinary least squares. Random effects are discrete units sampled from some population (e.g. plots, pariticipants), they are inherently categorical (Winter, 2019). + +#### Model + Recall simple linear regression with intercept (β~0~) and slope (β~1~) effect for subject *i*. The (β~0~) and (β~1~) are chosen in a way so that the residual sum of squares is as small as possible. $$ Y = \beta_0 + \beta_1(X) + 𝜺$$ @@ -14,7 +17,7 @@ $$ Y = \beta_0 + b_i + \beta_1(X) + 𝜺$$ In this model, predictions would vary depending on each subject’s random intercept term, but slopes would be the same: -![Example mixed model with random intercepts but identical slopes.](/img/random_intercept_same_slope.png){width="840"} +![Example mixed model with random intercepts but identical slopes.](/img/random_intercept_same_slope.png){width="501"} In second case, we can have a fixed intercept and a random slope. The model will be: @@ -22,7 +25,7 @@ $$ Y = \beta_0 + (\beta_1 + b_i)(X) + 𝜺$$ In this model, the *bi* is a random effect for subject *i* applied to the slope. Predictions would vary with random slope term, but the intercept will be the same: -![Mixed model with random slopes but identical intercepts.](/img/fixed_intercept_random_slope.png){width="840"} +![Mixed model with random slopes but identical intercepts.](/img/fixed_intercept_random_slope.png){width="501"} Third case would be the mixed model with random slope and intercept: @@ -30,9 +33,9 @@ $$ Y = (\beta_0 + ai) + (\beta_1 + b_i)(X) + 𝜺$$ In this model, a*i* and b*i* are random effects for subject *i* applied to the intercept and slope, respectively. Predictions would vary depending on each subject’s slope and intercept terms: -![Mixed Model with random intercept and slope](/img/random_intercept_and_slope.png) +![Mixed Model with random intercept and slope](/img/random_intercept_and_slope.png){width="526"} -### Random-effect syntax +#### Random-effect syntax - (1\| group): Random intercept with fixed mean.