Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]


From   Joseph Coveney <>
To   Statalist <>
Subject   Re: st: GET SAMPLES IN STATA
Date   Mon, 09 Feb 2004 21:17:25 +0900

I forgot to mention that -<command> if !training- conveniently uses your
holdout sample after you've finished with the training.  So, the command
stream  would be:

set seed <seed>
generate byte training = uniform() < 0.33
<command> if training
* then, to use the holdouts after stepwise regression or whatever
<command> if !training
* or
<command> if ~training

Joseph Coveney

I wrote:

>You can flag training samples by -generate byte training = (uniform() <
>where X is the percentage of the total dataset that you want to use for
>training.  So, for example, if you want to use 33% for training and keep
>remaining 67% for holdout, then the commands would be:
>set seed <seed>
>generate byte training = uniform() < 0.33
><command> if training
>Joseph Coveney
>sgsr100 wrote:
>>Do you know how can a get a training sample randomly chosen from stata
>>and how can I keep the remaining observations as a holdout sample.

*   For searches and help try:

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