# st: RE: RE: permutation and group structure

 From "Nick Cox" <[email protected]> To <[email protected]> Subject st: RE: RE: permutation and group structure Date Mon, 21 Jul 2003 16:45:04 +0100

```David Airey

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

-permute- may help. Alternatively,

Here is a shuffling technique which you may able to
adapt to your problem. A version of it is applied to
another problem in a paper by Nigel Smeeton and myself
under review at the Stata Journal.

set seed 28031952
gen random = .
gen count = 0
gen ntests = _n
levels group, local(levels)

qui forval i = 1/100000 {
replace random = uniform()
sort group random
<reset anything of importance broken by shuffling>
...
local nsig = 0
foreach l of local levels {
<test> if group == `l'
<update nsig>
}
replace count = count + 1 if ntests == `nsig'
}

Nick
[email protected]

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