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

RE: st: get samples in Stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: get samples in Stata
Date   Mon, 9 Feb 2004 12:40:29 -0000

(can we go lower case please?) 

You have a dataset. 

You want to take a sample from part of it. 

The key is to specify that part using -if-. 

You later want to take a sample in another
way. 

The same is true. -if- specifies what you 
are sampling from. 

If it's important that the samples don't 
overlap, as seems likely, that's to be 
included in the -if- condition second time 
around. 

Whether you do this from first principles 
using random numbers directly or use 
a command like -sample- is secondary. 

Nick 
[email protected] 

sgsr100
 
> The think is I am trying to get random samples from a data set. I have
> to use the traning and houldout data. But I have to get this samples
> with the same criteria that the original data set was built.
> In order to do this in a first stage I have to get a random 
> sample from
> the primary units (it is composed of the group of housings ). In a
> second stage I need to get another random sample from the secondary
> units (it is composed of the group of households). Is the cluster
> command useful for this?

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