Re: st: random split

 From "Martin Weiss" To Subject Re: st: random split Date Sun, 12 Apr 2009 23:04:04 +0200

```<>

To see my argument, run

****
//drop the thing
capt prog drop sim

//program definition
program define sim // , rclass
version 10.1
drop _all
set obs 800
gen split = runiform()>.33
cou if !split
end

//simulation
simulate N=r(N), reps(1000): sim

gen prop=N/800

//summarize results
su prop, d
kdensity prop, xli(0.33)
****

HTH
Martin
_______________________
```
----- Original Message ----- From: "Martin Weiss" <martin.weiss1@gmx.de>
```To: <statalist@hsphsun2.harvard.edu>
Sent: Sunday, April 12, 2009 10:59 PM
Subject: Re: st: random split

```
```<>

"exactly a third of observations in the desired group"

```
How do you know that the split will be exact. Even leaving aside the question whether ".33" is close enough to one third to warrant the statement, the uniform number generator will still be noisy, i.e. the true proportion will most likely be different from 1/3...
```

HTH
Martin
_______________________
```
----- Original Message ----- From: "Rafal Raciborski" <rraciborski@gmail.com>
```To: <statalist@hsphsun2.harvard.edu>
Sent: Sunday, April 12, 2009 10:54 PM
Subject: Re: st: random split

```
```gen split = runiform()>.33

or a variation thereof to make sure you have exactly a third of
observations in the desired group

On Sun, Apr 12, 2009 at 4:48 PM, Galina Hayes <galina@uoguelph.ca> wrote:
```
```Hello everyone,
```
I want to randomly split a data set of 800 or so observations into two groups, with 1/3rd of observations in the first group and 2/3rds in the second group, and am blanking on how to do this. Can anyone help?
```Thanks,
Galina
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

```
```
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```