Add exercise and clean up code for example
This commit is contained in:
Binary file not shown.
+10
-8
@@ -78,7 +78,9 @@
|
||||
\item I will explain the general concepts with the slides
|
||||
\item We will switch to R and use the lme4 package to fit the models
|
||||
\item You will use R to fit an extension of the model
|
||||
\item We will discuss the results\\~\\
|
||||
\item We will discuss the results
|
||||
\item All the materials are here: \url{https://gitea.iwm-tuebingen.de/nwickelmaier/lead_lmm}
|
||||
\\~\\
|
||||
\item[$\to$] Try to go along in R! Ask as many questions as possible, also
|
||||
the ones you usually do not dare to ask (because you are supposed to know
|
||||
them already or something\dots)
|
||||
@@ -162,7 +164,7 @@
|
||||
\begin{column}{.6\textwidth}
|
||||
Model equation
|
||||
\begin{align*}
|
||||
\text{(Level 1)} \quad y_{ij} &= b_{0i} + \varepsilon_{ij}\\
|
||||
\text{(Level 1)} ~\quad y_{ij} &= b_{0i} + \varepsilon_{ij}\\
|
||||
\text{(Level 2)} \quad b_{0i} &= \beta_0 + \upsilon_{0i}\\
|
||||
\text{(2) in (1)} \quad y_{ij} &= \beta_0 + \upsilon_{0i} + \varepsilon_{ij}
|
||||
\end{align*}
|
||||
@@ -236,7 +238,7 @@
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}{Regression with random school effects}
|
||||
\begin{frame}{Adding socioeconomic status as a predictor}
|
||||
\begin{itemize}
|
||||
\item How strong is the relationship between students' socioeconomic status
|
||||
and their math achievement on average?
|
||||
@@ -267,7 +269,7 @@
|
||||
\begin{column}{.6\textwidth}
|
||||
Model equation
|
||||
\begin{align*}
|
||||
\text{(Level 1)} \quad y_{ij} &= b_{0i} + b_{1i}\,x_{ij} + \varepsilon_{ij}\\
|
||||
\text{(Level 1)} ~\quad y_{ij} &= b_{0i} + b_{1i}\,x_{ij} + \varepsilon_{ij}\\
|
||||
\text{(Level 2)} \quad b_{0i} &= \beta_0 + \upsilon_{0i}\\
|
||||
\quad b_{1i} &= \beta_1\\
|
||||
\text{(2) in (1)} \quad y_{ij} &= \beta_0 + \beta_1\,x_{ij} +
|
||||
@@ -322,7 +324,7 @@
|
||||
\end{itemize}\pause
|
||||
\item How can we interpret the random slopes for this model?\pause
|
||||
\item How do we add random slopes to a random intercept model using
|
||||
\texttt{lme4::lmer()}?
|
||||
\texttt{lme4::lmer()}?\pause
|
||||
\item Fit a model with random slopes for socioeconomic status in R
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
@@ -381,12 +383,12 @@
|
||||
\begin{frame}{Hierarchical regression model}
|
||||
Model equation
|
||||
\begin{align*}
|
||||
\text{(Level 1)} \quad y_{ij} =&~b_{0i} + b_{1i}\,cses_{ij} + \varepsilon_{ij}\\
|
||||
\text{(Level 1)} ~\quad y_{ij} =&~b_{0i} + b_{1i}\,cses_{ij} + \varepsilon_{ij}\\
|
||||
\text{(Level 2)} \quad b_{0i} =&~\beta_0 + \beta_2 meanses_i + \beta_4 sector_i + \upsilon_{0i}\\
|
||||
\quad b_{1i} =&~\beta_1 + \beta_3 meanses_i + \beta_5 sector_i + \upsilon_{1i}\\
|
||||
\text{(2) in (1)} \quad y_{ij} =&~\beta_0 + \beta_1\,cses_{ij} + \beta_2 meanses_i + \beta_4 sector_i\\
|
||||
& + \beta_3 (cses_{ij} \times meanses_i) + \beta_5 (cses_{ij} \times sector_i) \\
|
||||
& + \upsilon_{0i} + cses_{ij}\upsilon_{1i} + \varepsilon_{ij}
|
||||
& + \upsilon_{0i} + \upsilon_{1i}cses_{ij} + \varepsilon_{ij}
|
||||
\end{align*}
|
||||
with
|
||||
\begin{align*}
|
||||
@@ -424,7 +426,7 @@ with
|
||||
\item Compute the model in R using \texttt{lme4::lmer()}
|
||||
{\scriptsize
|
||||
\begin{align*}
|
||||
\text{(Level 1)} \quad y_{ij} =&~b_{0i} + b_{1i}\,cses_{ij} + \varepsilon_{ij}\\
|
||||
\text{(Level 1)} ~\quad y_{ij} =&~b_{0i} + b_{1i}\,cses_{ij} + \varepsilon_{ij}\\
|
||||
\text{(Level 2)} \quad b_{0i} =&~\beta_0 + \beta_2 meanses_i + \beta_4 sector_i + \upsilon_{0i}\\
|
||||
\quad b_{1i} =&~\beta_1 + \beta_3 meanses_i + \beta_5 sector_i + \upsilon_{1i}\\
|
||||
\text{(2) in (1)} \quad y_{ij} =&~\beta_0 + \beta_1\,cses_{ij} + \beta_2 meanses_i + \beta_4 sector_i
|
||||
|
||||
Reference in New Issue
Block a user