### Number of groups varies between 2- and 3-level multivariate MLM

Posted:

**Wed Sep 25, 2019 9:16 pm**Hi all,

I am running a multivariate MLM that has repeated observations (level 1) of teachers (level 2) within schools (level 3). The data has 550 non-missing observations on the two outcomes for 65 teachers in 23 schools.

Variable | Obs Mean Std. Dev. Min Max

-----------------+---------------------------------------------------------

ELA_overall | 550 2.472286 .7009207 .5555556 3.888889

CLASS_over~l | 550 4.394666 .6439461 2.739683 6.023016

There was not an occasion level variable, so I created one that does not repeat across teachers using
The two level model is as follows:
The number of groups is as follows (total number of obs = 550):

I then run the 3-level model, asking for residuals at each level:
This model reports an additional two id groups, and the number of observations per id differs slightly (total number of obs = 550):

Any ideas what might be going on?

Thanks,

Erik

I am running a multivariate MLM that has repeated observations (level 1) of teachers (level 2) within schools (level 3). The data has 550 non-missing observations on the two outcomes for 65 teachers in 23 schools.

Variable | Obs Mean Std. Dev. Min Max

-----------------+---------------------------------------------------------

ELA_overall | 550 2.472286 .7009207 .5555556 3.888889

CLASS_over~l | 550 4.394666 .6439461 2.739683 6.023016

There was not an occasion level variable, so I created one that does not repeat across teachers using

Code: Select all

```
sort id
gen occ_c = _n
```

Code: Select all

```
sort id occ_c
runmlwin (ELA_overall cons, eq(1)) (CLASS_overall cons, eq(2)), ///
level2(id: (cons, eq(1)) (cons, eq(2))) ///
level1(occ_c: (cons, eq(1)) (cons, eq(2))) nopause correlations //gives you corrs vs. covariances
```

Code: Select all

```
-----------------------------------------------------------
| No. of Observations per Group
Level Variable | Groups Minimum Average Maximum
----------------+------------------------------------------
id | 65 1 8.5 17
-----------------------------------------------------------
```

I then run the 3-level model, asking for residuals at each level:

Code: Select all

```
sort sch1 id occ_c
runmlwin (ELA_overall cons, eq(1)) (CLASS_overall cons, eq(2)) , ///
level3(sch1: (cons, eq(1)) (cons, eq(2)), residuals(uS)) ///
level2(id: (cons, eq(1)) (cons, eq(2)), residuals(uT)) ///
level1(occ_c: (cons, eq(1)) (cons, eq(2)), residuals(r)) nopause correlations //gives you corrs vs. covariances
```

Code: Select all

```
-----------------------------------------------------------
| No. of Observations per Group
Level Variable | Groups Minimum Average Maximum
----------------+------------------------------------------
sch1 | 23 1 23.9 60
id | 67 1 8.2 17
-----------------------------------------------------------
```

Thanks,

Erik