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

Re: st: draw parameter values from distribution


From   "maartenbuis" <[email protected]>
To   [email protected]
Subject   Re: st: draw parameter values from distribution
Date   Tue, 14 Dec 2004 10:05:12 -0000

--- "Kelchtermans, Stijn" <Stijn.Kelchtermans@e...> wrote:
> based on the parameter estimates, get 1000 draws from the 
> multivariate normal distribution to generate 1000 alternative 
> parameter values. Using these values, I calculate 1000 choice 
> probabilities. I then drop 2,5% of the values in each tail to get 
> the 95% CI for the choice probabilities.
> 
> I can't find Stata commands that allow to automate this procedure. 

Have a look at -simulate-, something like this should do what you 
want:

program define sim, rclass
drop _all
whatever commands needed to generate one "new" dataset
whatever commands needed to estimate parameters
whatever commands needed to compute probability
return scalar prob = probability
end

simulate sim prob = r(prob), dots reps(1000)
sum prob, detail


Since you are repeating these commands a thousand times it is well 
worth to use build in commands instead of ado commands wherever 
reasonably possible, since the build in commands are a lot faster. 
However, it will always remain a tradeoff between the time it takes 
to code your do-files (and later understand and revise your do-file) 
and the time it takes to run your do-file.

Maarten




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