Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: listing, then restricting a complete sample space


From   "Martin Wall" <[email protected]>
To   <[email protected]>
Subject   st: listing, then restricting a complete sample space
Date   Tue, 20 Mar 2007 16:15:05 -0000

Dear Statalist

I have a number of regions A, B, C...
I am picking one of two areas in each region for a randomised study

So my first allocation will be A1, B1, C1....
Second A2, B1, C1....
Third A1, B2, C1
...etc
...
...
I think I will have 2^n possible allocations where n is the number of
regions.

The problem is some of these allocations are pathological. For example I
might pick the poorest area in each region, or the richest. For that reason I
want to do a 'restricted randomisation' that is delete these pathological
outcomes from the sample space before randomising. So I restrict my sample
space by firstly listing out all the 2^n allocations (in my case n=20) and
then scoring them by using the data I have on each area. 

So e.g.  I might get my 20 areas as follows

A2, B1, C2, D1, E1...

I then use the data I have on deprivation in the 2nd area in region A, the
first area in region B and so on, and decide that I want to exclude this
particular allocation from being chosen.

I would like to produce a dataset with all the possible allocations in it.
Either of the form

A1  B1  C1 D1 E1
A2  B1  C1 D1 E1

For 1048576 lines or

Variable names 	A1	A2	B1	B2	C1	C2	D1	D2...
			1	0	1	0	1	0	1
0
			0	1	1	0	1	0	1
0

for 1048576 lines

Apologies if this is trivial but I don't have much of a programming
background in Stata so any pointers would be appreciated

Martin




*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index