# SV: st: Within and between variances

 From "Ineta Sokolowski" <[email protected]> To <[email protected]> Subject SV: st: Within and between variances Date Thu, 15 May 2003 08:21:02 +0200

```Thank you, David, for the answer. It helps a little, but I have some
further questions about -xtsum-. I wish, there were more details in
manual.

I need the varians components to calculate the ICC (intra class
correlation). I tried different methods to calculate ICC, including
-loneway- and -xtsum-, but it gives very different result. Are there any
restrictions for use of -xtsum-? I mean, can I use it for my data, which
is dichotomous data. As I wrote before, my data are unbalanced- clusters
contain between 44 and 111 patients. Here is the output:

. loneway diagnosis gpnum

One-way Analysis of Variance for diagnosis
Number of obs =      2647
R-squared =    0.0394

Source                         SS         df         MS
F     Prob > F
------------------------------------------------------------------------
-
Between gpnum       11.486863     36    .31907954      2.97     0.0000
Within gpnum          280.36882   2610      .107421
------------------------------------------------------------------------
-
Total                        291.85569   2646    .11030071

Intraclass       Asy.
correlation      S.E.       [95% Conf. Interval]
------------------------------------------------
0.02684     0.00945       0.00833     0.04535

Estimated SD of gpnum effect           .0544317
Estimated SD within gpnum              .3277514
Est. reliability of a gpnum mean        0.66334
(evaluated at n=71.44)

. dis "ICC is " r(rho)
ICC is .02684102

. xtsum diagnosis, i(gpnum)

Variable         |      Mean   Std. Dev.       Min           Max   |
Observations
-----------------+----------------------------------------------------+-
---------------
diagnosis overall|  1.126181   .3321155          1          2      |
N =    2647
between |             .0682964   1.025316   1.339286      |
n =      37
within  |             .3255142   .7868949   2.100864      |
T-bar = 71.5405

. dis "ICC is " r(sd_b)^2/(r(sd_b)^2+r(sd_w)^2)
ICC is .04216445

I hope you can give me some more details.
Greetings,
Ineta

Ineta Sokolowski <[email protected]> wrote:

> Can anybody explain, why the one-way ANOVA (-loneway-) and -xtsum-
gives
> different standard deviations for within and between effects of a
> variable?
>
> . loneway diagnosis gpnum
> . xtsum diagnosis, i(gpnum)
>
> where "diagnosis" is a dichotomous variable (0=no illness, 1=illness)
> and "gpnum" is the general practitioners (GP) number (38 different
> numbers). Each GP has different number of patients (between 44 and
111).
>
> How are the SD calculated in each procedure?
>

Fra: David M. Drukker, Stata Corp [mailto:[email protected]]

-xtsum- and -loneway- provide different summaries of the data.  -xtsum-
is
summarizing the overall variable, the between transformed variable and
the
within transformed variable.  The reported standard deviations are the
estimated standard deviations for the transformed variables.  In
contrast,
-loneway- provides a one-way analysis of variance decomposition of the
specified variable.  The formula for computing these standard deviations
are
standard in the ANOVA literature and documented in [R] loneway.  It is
interesting to note that the reported standard deviations correspond to
the
variance components in a constant only model.
...

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```