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

st: RE: permutation and group structure

From   David Airey <>
Subject   st: RE: permutation and group structure
Date   Mon, 21 Jul 2003 10:18:53 -0500

David Airey wrote:
> 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.

Nick replied:

Not quite sure what you're after here.

. sort foo bar

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


. 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).

David tries to clarify:

Thanks Nick. I'll dig that up. Here's the situation. In the above model, I actually have 329 separate fixed effects. I test each fixed effect,

response = fixed effect,

and after all 329 tests, I could correct for multiple tests using any number of procedures (smileplot offers many choices) in order to get a multiple test corrected probability. But I could also randomize the order of the response variable and run all 329 tests again and count the number of significant tests. And do it again 1000s of times to get a distribution from which I get an empirical multiple test corrected statistic or probability (the 95% of that distribution). I am just confused about randomizing while retaining the structure of my data, which has 25 groups with approx. 40 units within each. I wanted to randomize within group.

* For searches and help try:

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