The -moremata- package, available from the SSC Archive, now
provides sampling functions. The functions may be used, for
example, to implement resampling techniques in Mata.
The most important of the new functions is called
-mm_sample()-. It covers a variety of sampling methods:
o simple random sampling (SRS)
o unequal probability sampling (UPS) / sampling with
probabilities proportional to size (PPS)
o sampling with replacement
o sampling without replacement
o stratified sampling
o cluster sampling
Results are returned as a permutation vector or, optionally,
as a vector containing sampling frequencies.
Furthermore, -moremata- contains functions, which provide
the basic sampling algorithms used by -mm_sample()-. These
functions are:
o mm_srswr(): simple random sampling with replacement
o mm_srswor(): simple random sampling without replacement
o mm_upswr(): unequal probability sampling with replacement
o mm_upswor(): unequal probability sampling without replacement
Type
. ssc install moremata, replace
to install the new functions.
ben
*
* 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/