4
$\begingroup$

Data:

level - categorical variable, 2 levels, A and B

Model:

y ~ x + (1 | level)

The model output has multiple intercepts (one for fixed effects and one for random effects).

To calculate a mean y for level B, I have to sum random effects intercept (probably level A used as a reference?) + level B b-coefficient?

$\endgroup$
5
$\begingroup$

Since your level variable has only 2 levels, A and B, you should not be fitting random intercepts for this variable. You are asking the software to estimate a variance of a normally distributed variable from 2 observations. Can you imagine sampling the height of 2 people in a population and using those two heights as an estimate for the variance the height in the population. There is no universal rule for determining how many levels are needed to estimate a reliable variance, but 2 is certainly too few. You should fit level as a fixed effect.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you! But what if "level" has 20 levels. How to calculate mean y for level B? Level A would be random effects intercept; thus, i have to use this and add level B coefficient? Or in other words, fixed effects intercept is used only with fixed part predictors? $\endgroup$ – st4co4 Aug 18 at 4:42
  • 1
    $\begingroup$ In that case you start with the global intercept, add the fixed effect for x andvthen add the random effect for level B. $\endgroup$ – Robert Long Aug 18 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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