Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: random split


From   Rafal Raciborski <[email protected]>
To   [email protected]
Subject   Re: st: random split
Date   Sun, 12 Apr 2009 17:06:25 -0400

i think "or a variation thereof" takes care of that :)



On Sun, Apr 12, 2009 at 5:04 PM, Martin Weiss <[email protected]> wrote:
> <>
>
> 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
>
> //get proportion instead of count
> gen prop=N/800
>
> //summarize results
> su prop, d
> kdensity prop, xli(0.33)
> ****
>
>
> HTH
> Martin
> _______________________
> ----- Original Message ----- From: "Martin Weiss" <[email protected]>
> To: <[email protected]>
> 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"
>> <[email protected]>
>> To: <[email protected]>
>> 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 <[email protected]> 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/
>

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



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