Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: programming question: obtaining statistics from clustered data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: programming question: obtaining statistics from clustered data
Date   Wed, 26 Jun 2002 10:43:42 +0100

Javier Escobal

> I need to construct a number of summary statistics for clustered data
> with a particular twist: for each observation the summary statistics
> should be constructed without taking into the account  the reference
> observation.
> 
> I have a data base that has the following form:
> 
> id    cluster    X
> 1        1        0.5
> 2        1        0.7
> 3        1        0.4
> .        .         .
> .        .         .
> .        .         .
> 100      3       0.6
> 101      3       0.6
> 102      3       0.8
> 103      3       0.2
> 
> that is observations can be grouped in clusters (of different size). I
> am interested in constructing different statistics: for example for each
> observation "i" I need to capture the average and standard deviation of
> all observations that belong to the same cluster where "i" belongs
> excluding observation "i".
> 
> Can somebody help me with a simple way of constructing this aggregates?
> 

Ulrich Kohler has made several very helpful suggestions. 

In addition, please check out the FAQ 

How do I create variables summarizing for each individual properties 
of the other members of a group?

at 

http://www.stata.com/support/faqs/data/members.html

Nick 
n.j.cox@durham.ac.uk 

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index