Statalist


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

R: st: Latin Hypercube's sampling with Stata


From   "Carlo Lazzaro" <carlo.lazzaro@tiscalinet.it>
To   <statalist@hsphsun2.harvard.edu>
Subject   R: st: Latin Hypercube's sampling with Stata
Date   Mon, 13 Oct 2008 18:36:12 +0200

Dear Austin,
thanks a lot for your kind and helpful reply.

Kind Regards,
Carlo
-----Messaggio originale-----
Da: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Austin Nichols
Inviato: lunedì 13 ottobre 2008 15.35
A: statalist@hsphsun2.harvard.edu
Oggetto: Re: st: Latin Hypercube's sampling with Stata

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/



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