I'm having difficulty in understanding the "process" that is going on behind how we are calculating all of our parameter estimates and how the random effects are used in our models.
To begin we can express the linear mixed model as:
$$y = X\beta + Zb + \epsilon \\b \sim N(0, \psi_\theta),\ \epsilon \sim N(0,\Lambda_\theta)$$
Where $X\beta$ would represent the fixed effects and $Zb$ would be representative of the random effects. How are both sets of effects being estimated? What I mean by this is I get that we will be using maximum likelihood methods to estimate the parameters formally. But what is the process? Are we estimating the fixed effects $X\beta$ and the random effects $Zb$ separately and then bring them together in our model?
I was playing around in R to try and understand more, but I'm still stick in making the leap. Here is an output I got from fitting a LMM to the iris
data set:
Linear mixed model fit by REML ['lmerMod']
Formula: Petal.Width ~ Sepal.Width + Sepal.Length + (1 + Sepal.Length | Species)
Data: iris
REML criterion at convergence: -66.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.76049 -0.54295 -0.08282 0.55066 2.74867
Random effects:
Groups Name Variance Std.Dev. Corr
Species (Intercept) 0.24352 0.4935
Sepal.Length 0.01377 0.1173 0.40
Residual 0.03091 0.1758
Number of obs: 150, groups: Species, 3
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.20829 0.33520 0.621
Sepal.Width 0.27272 0.05248 5.196
Sepal.Length 0.01796 0.07726 0.232
Correlation of Fixed Effects:
(Intr) Spl.Wd
Sepal.Width -0.116
Sepal.Lngth 0.134 -0.279
> coef(ir_lme2)
$Species
(Intercept) Sepal.Width Sepal.Length
setosa -0.1400153 0.2727164 -0.10956019
versicolor 0.0573940 0.2727164 0.08658932
virginica 0.7074925 0.2727164 0.07684240
attr(,"class")
[1] "coef.mer
So I have fixed effects
and random effects
as can be seen at the bottom of the outputs.
With regards to the random effects I get that we "group" our observations and then use those groupings to get group estimates of our parameters which are the random effects
below. Were those random effects
estimated in isolation and if so how? Same question with respect to the fixed effects
. Another question is how are those random effects
playing into the fixed effect
estimates? Are the random effects contributing to the values we see in the fixed effects read outs?
I read previous articles on the site about the ideas:
What is the difference between fixed effect, random effect and mixed effect models?
What is a difference between random effects-, fixed effects- and marginal model?
I had also asked a previous question about this, but I might delete it because it is muddied in my confused understanding of the concept.
As you can see my head is all over and I'm very confused about how things are being put together in this model. Any help to clarify things would be appreciated. Even in chat because I feel the things I'm not getting should be easy to clear up.
EDIT: So I attempted to get some clarification from a TA. In my example let's say we end up with the expression:
$$y = \beta_0 +\beta_{SW} \cdot SW + \beta_{SL} \cdot SL + (\alpha_1 + \alpha_2 \beta_{SL}SL)$$
where $\beta_i$ correspond to the fixed effects and $\alpha$ corresponds to the random effects, $SW =$ sepal.width
, $SL =$ sepal.length
, and $\alpha =$ random effect from Species
.
So if I understand this correctly for the random effect of random slope, we would group by species
, take all of the Sepal.Length
values by species (let's use setosa as a concrete example), compute an estimate for the variance, use this estimate for the variance in a normal distribution $\alpha \sim N(0, \sigma_{setosa}^2)$ from which we would draw a random value for Sepal.Length
, and then this would serve as the random factor $\alpha_2$ which we would multiply by $\beta_{SL}$ to get our value for the random slope?
Not looking for the precise mathematics yet, just an understanding.