1
$\begingroup$

I am working on a GLMM model with crossed random effects and I would like to write an equation from the output where the outcome is the probability rather than a log of the odds.

model <- glmer(y ~ x1 + x2 + x3 (1|R1) + (1|R2), data = df, family=binomial)

My question is, does the model above have the same equation as a linear mixed model?

Yij=(γ00+u0j+u1j)+γ10X1ij+γ20X2ij+γ30X3ij+eij

where Yij = the outcome (in log of the odds)

γ00 = intercept under the fixed effects output

u0j = intercept for the first random effect (R1)

u1j = intercept for the second random effect (R2)

y10 = coefficient for the first fixed effect X1

y20 = coefficient for the second fixed effect X2

y30 = coefficient for the third fixed effect X3

e = not quite sure where to find the level 1 error in the output. Is this the standard deviation for the random effects? If I have two crossed as in the glmer formula above do you use both SD's (add them together)?

Question 1 - am I correct to include both the random effects' intercept in the equation at the beginning?

Question 2 - where is the error term in the output for glmer models? Is this the standard deviation for the random effects? If this is the case do you include both standard deviations for the two random effects terms?

Question 3 - How do you transform the equation so that the outcome is probability rather than log of the odds? Specifically I would like the outcome to be a probability of .5 where I can solve for one of the values of the fixed effects.

Thanks!

$\endgroup$

1 Answer 1

2
$\begingroup$

The equation you’re looking for is: $$\left \{ \begin{array}{l} \log \frac{\pi_{ij}}{1 - \pi_{ij}} = \beta_0 + \beta_1 x_{1ij} + \beta_2 x_{2ij} + \beta_3 x_{3ij} + b_i + u_j,\\ b_i \sim \mathcal N(0, \sigma_b^2), \quad u_j \sim \mathcal N(0, \sigma_u^2) \end{array} \right.$$ where $\pi_{ij} = \mbox{Pr}(y_{ij} = 1 \mid b_i, u_j)$. To obtain the probabilities you need $$\pi_{ij} = \frac{\exp(\beta_0 + \beta_1 x_{1ij} + \beta_2 x_{2ij} + \beta_3 x_{3ij} + b_i + u_j)}{1 + \exp(\beta_0 + \beta_1 x_{1ij} + \beta_2 x_{2ij} + \beta_3 x_{3ij} + b_i + u_j)}.$$ Note: I have used a generic form for the subscripts, perhaps they need adjustments according to the specific setting of your data.

$\endgroup$
2
  • $\begingroup$ Oh quick question, where do the intercepts for the random effects go into the equation? are they included in β0? so it would be β0 + b0i + u0j? $\endgroup$ Commented Oct 7, 2018 at 5:26
  • $\begingroup$ Yes, you can combine them with the fixed effect intercept. $\endgroup$ Commented Oct 7, 2018 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.