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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: Re: st: random split |

Date |
Sun, 12 Apr 2009 23:44:34 +0200 |

<>

HTH Martin _______________________

To: <statalist@hsphsun2.harvard.edu> Sent: Sunday, April 12, 2009 11:38 PM Subject: RE: Re: st: random split

Hi,If you want exactly 267 in the first group, won't the following achievethisexactly? gen u = runiform() sort u gen split = _n <= 267 More generally (i.e. with _N!=800), you could use -ceil(_N/3)- or -floor(_N/3)- to get 1/3, rounded up or down as desired. HTH, Glenn "Martin Weiss" <martin.weiss1@gmx.de> wrote: <> "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 * * 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/

**References**:**RE: Re: st: random split***From:*"Glenn Goldsmith" <glenn.goldsmith@gmail.com>

- Prev by Date:
**RE: Re: st: random split** - Next by Date:
**st: random number** - Previous by thread:
**RE: Re: st: random split** - Next by thread:
**Re: st: random split** - Index(es):

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