3
$\begingroup$

I am fitting the following logit model in lme4 (R):

dummy ~ ind_var1 + state_var2 + country_var3 + (1 | country/state)

This specifies varying intercepts for countries and states, with states nested within countries. I am using the following notation to represent this model:

\begin{align*} p(y_{ijk} = 1) & = {logit}^{-1}(\beta_{1}\cdot{x_{1ijk}} + \beta_{2}\cdot{x_{2jk}} + \beta_{3}\cdot{x_{3k}} + country_{k} + state_{jk}), \end{align*}

\begin{align*} country_{k} &\sim N(0,\sigma^2_{country}) \end{align*}

\begin{align*} state_{jk} &\sim N(0,\sigma^2_{state}) \end{align*}

However, this seems wrong. The nested intercept (states in countries) don't appear as nested in the model. I am just adding an index to show the nesting. Can someone help me understand how this model is best represented? Any references related to this is appreciated as well. Most of the stat books I have read focus heavily on non-nested models/notation. Thanks!

$\endgroup$

1 Answer 1

2
$\begingroup$

$$ p(Y_{ijk} = 1) = \mathrm{logit}^{-1}(\beta_0 + \beta_{1}{X_{1ijk}} + \beta_{2}{X_{2jk}} + \beta_{3}{X_{3k}} + c_{k} + s_{jk}), $$ where $k$ index the country, $j$ for state and $i$ for individual, $c_{k} \sim N(0,\sigma^2_{c})$ is country specific random intercept, and $s_{jk} \sim N(0,\sigma^2_{s})$ is country-state specific random intercept.

In your case, if there is no same state names in your data set. nest or not nest will give you the same results. Otherwise, you will get the different results.

The nested intercept is $s_{jk}$.

Following is the random intercepts for two countries and 2 states in each country with the same names of states using (1 | country/state):

                          c_1    c_2    s_11     s_21     s_12  s_22          
 country 1, state 1         1     0       1        0        0     0
 country 1, state 2         1     0       0        1        0     0
 country 1, state 1         0     1       0        0        1     0
 country 1, state 2         0     1       0        0        0     1

Obviously, $s_{11}$ and $s_{21}$ are nested in $c_1$ and $s_{12}$ and $s_{22}$ are nested in $c_2$

If use '(1 | country) + (1 |state)', the random intercepts will be:

                         c_1    c_2      s_1     s_2           
 country 1, state 1         1     0       1        0 
 country 1, state 2         1     0       0        1  
 country 1, state 1         0     1       1        0  
 country 1, state 2         0     1       0        1  

If no same name for state, (1 | country/state) and (1 | country) + (1 |state) will be the same:

(1 | country/state)

                          c_1    c_2    s_11     s_21     s_32  s_42          
 country 1, state 1         1     0       1        0        0     0
 country 1, state 2         1     0       0        1        0     0
 country 1, state 3         0     1       0        0        1     0
 country 1, state 4         0     1       0        0        0     1

(1 | country) + (1 |state)

                         c_1    c_2    s_1      s_2      s_3    s_4          
 country 1, state 1         1     0       1        0        0     0
 country 1, state 2         1     0       0        1        0     0
 country 1, state 3         0     1       0        0        1     0
 country 1, state 4         0     1       0        0        0     1
$\endgroup$
3
  • $\begingroup$ Thanks for the help! This equation is the same as the one in my post except for the individual level intercept (beta0), correct? So nesting states in countries (country/state) estimates the same model as specifying a varying intercept for both countries and states? I did not realize that. Could you please explain a little further when that won't be the case ("if there is no same state names in your data set. nest or not nest will give you the same results. Otherwise, you will get the different results.")? $\endgroup$
    – BHudson
    Nov 11, 2018 at 1:41
  • $\begingroup$ First question, answer is yes. For the rest, see my added part in the answer. $\endgroup$
    – user158565
    Nov 11, 2018 at 2:30
  • $\begingroup$ Ah, thanks for the detailed explanation. Marked as answered! $\endgroup$
    – BHudson
    Nov 11, 2018 at 21:03

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.