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

st: RE: permutation and group structure


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: permutation and group structure
Date   Mon, 21 Jul 2003 15:50:36 +0100

David Airey
> 
> If I have 25 groups each with approx. 40 units each, and I want to 
> re-order the data to get an empirical distribution of 
> probabilities for 
> a model (continuous response, one fixed effect, one random 
> effect for 
> group), what Stata commands should I be looking to? I 
> understand Stata 
> does nifty things with survey data where strata are a 
> common concern, 
> though I'm not too familiar with their use Is there an easy 
> way to tell 
> Stata to permute so that group is respected? That is, I 
> don't think I 
> want to re-order the data such that units change groups.

Not quite sure what you're after here. 

. sort foo bar 

sorts on -foo- and within groups of -foo- on -bar-. 

Similarly, 

. bysort foo (bar) : <whatever>  

does that and then does <whatever> for 
distinct groups defined by -foo-. 

There was a fairly detailed tutorial on -by:- in 
Stata Journal 2(1), 86-102 (2002). 

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