# R: st: Monte Carlo resampling

 From "Carlo Lazzaro" <[email protected]> To <[email protected]> Subject R: st: Monte Carlo resampling Date Sat, 19 Jan 2008 18:30:30 +0100

```Dear Maarten,

My question came up after a comparison between the results of
gen Invgamma=556*invgammap(1, uniform()) in 1/10000

and

gen A=556

. sum A

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
A |     10000         556           0        556        556

. return list

scalars:
r(N) =  10000
r(sum_w) =  10000
r(mean) =  556
r(Var) =  0
r(sd) =  0
r(min) =  556
r(max) =  556
r(sum) =  5560000

. scalar a=(r(mean)/r(mean))^2 //assuming that the mean is the same value as
the std. dev.

. scalar b=(r(mean)^2/r(mean)) //assuming that the mean is the same value as
the std. dev.

. simulate (b*invgammap(a, uniform())), reps(10000) nodots seed(999): sum A

command:  summarize A
_sim_1:  b*invgammap(a, uniform()).

Even though similar both in terms of mean and standard errors, these two
approaches give back different ranges.

Thanks a lot again, with the sincere hope that replying to my thread has not

Kind Regards,

Carlo

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Maarten buis
Inviato: sabato 19 gennaio 2008 16.25
A: [email protected]
Oggetto: Re: st: Monte Carlo resampling

--- Carlo Lazzaro <[email protected]> wrote:
> does -simulate- suite resample with reintroduction?

No, -simulate- just repeatedly calls a program and stores the results.
So, the way you sample (or whether you sample at all) depends on the
program that -simulate- calls. If your program drew a sample with
reintroduction than -simulate- would do what you just asked. However,
the easier way to do that is to call -bootstrap-.

The strong point of -simulate- is that is makes it easier to play
around with different techniques and find out their strong and weak
points. Its primary usefullness is in that sense theoretical, while the
primary usefulness of -bootstrap- is empirical (it helps you to
describe your data). Though the distinction is not black and white.

Some examples of the use of -simulate- are:
http://www.stata.com/statalist/archive/2007-12/msg00504.html
(bottom of the post)

http://www.stata.com/statalist/archive/2007-09/msg00638.html
http://www.stata.com/statalist/archive/2007-09/msg00665.html

http://lists.utsouthwestern.edu/pipermail/impute/2008-January/000530.html
though note:
http://lists.utsouthwestern.edu/pipermail/impute/2008-January/000531.html

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

__________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com

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

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