# st: Screening for nested data and multilevel modeling

 From Frank Gallo To statalist@hsphsun2.harvard.edu Subject st: Screening for nested data and multilevel modeling Date Wed, 05 Aug 2009 21:53:32 -0400

```Hi All,

```
I am using Stata Version 11. I am a beginner with Stata, and one with Multilevel Modeling. My data are police arrests, which may not be independent. For example, police officers respond to calls for service together, they make arrests together, and they usually make more than one arrest within a police department. This situation reflects the fact that arrests within each police department may be more similar to each other and not independent. We can go one-step higher within a state and say that arrests from police departments serving the same community population level may also be more similar to each other than arrests from police departments serving different community population levels. Multilevel modeling would be the appropriate statistical technique to employ if this is true. So below is output for my DV (police force), and for an Intercept-Only Model across level 2 units (police departments). The way I see this output is (1) small variability between police departments, (2) larger variability within police departments, and (3) rho = .03 (seems trivial). So there appears no meaningful average difference on the DV among police departments, and I may analyze the data at level 1 (arrest cases) using simple multiple regression. Are there some additional analyses you would suggest before I make this leap? I have 21 predictors. What would be the syntax using "xtmixed" or "xtreg" for testing a random intercept and random slopes (do the DV-IV relationships vary across pds) model? Thank you.
```
Best,
Frank

xtsum pforce, i(pd)

```
Variable | Mean Std. Dev. Min Max | Observations -----------------+-------------------------------------------- +---------------- pforce overall | 3.430618 .7753135 1.69 8.94 | N = 3300 between | .1435753 3.136604 3.668141 | n = 16 within | .7584913 1.523233 8.702478 | T-bar = 206.25
```

xtmixed pforce || pd:, variance

Performing EM optimization:

Iteration 0:   log restricted-likelihood = -3793.0922
Iteration 1:   log restricted-likelihood = -3793.0922

Computing standard errors:

```
Mixed-effects REML regression Number of obs = 3300 Group variable: pd Number of groups = 16
```
```
Obs per group: min = 22 avg = 206.2 max = 696
```

```
Wald chi2(0) = . Log restricted-likelihood = -3793.0922 Prob > chi2 = .
```
------------------------------------------------------------------------------
```
pforce | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------- +---------------------------------------------------------------- _cons | 3.365488 .0392125 85.83 0.000 3.288633 3.442343
```------------------------------------------------------------------------------

------------------------------------------------------------------------------
```
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] ----------------------------- +------------------------------------------------
```pd: Identity                 |
```
var(_cons) | .0190313 .0081169 . 0082495 .0439046 ----------------------------- +------------------------------------------------ var(Residual) | .5776606 .0142495 . 5503966 .6062752
```------------------------------------------------------------------------------
```
LR test vs. linear regression: chibar2(01) = 104.96 Prob >= chibar2 = 0.0000
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```