Statalist


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

Re: st: Latin Hypercube's sampling with Stata


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Latin Hypercube's sampling with Stata
Date   Mon, 13 Oct 2008 09:35:09 -0400

Carlo Lazzaro <carlo.lazzaro@tiscalinet.it> :
If I understand the question correctly, one method would be to make a
Stata dataset with all possible combinations of x variables and then
sample from that dataset using whatever method is desired (e.g. help
sample, help bsample, findit gsample), e.g.

clear
range x1 1 4 4
range x2 1 4
fillin x1 x2
ssc install gsample
ssc install moremata
mata mata mlib index
gsample 160
tab x?

* here is a start on orthogonal sampling (also programmable in Mata
but not done yet to my knowledge):
clear
range x1 1 4 4
range x2 1 4
fillin x1 x2
g u=uniform()
sort x1 u
by x1: drop if x1==1 & _n>1
forv i=2/4 {
 loc used=x2[`=`i'-1']
 by x1: drop if x1==`i' & x2==`used'
 by x1: drop if x1==`i' & _n>1
}
li

On Mon, Oct 13, 2008 at 8:54 AM, Carlo Lazzaro
<carlo.lazzaro@tiscalinet.it> wrote:
> Dear Statalisters,
> is there a way for doing Latin Hypercube's sampling with Stata 9.2/SE?
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index