simulate — Monte Carlo simulations 7
We can obtain final results, running our simulation 1,000 times, by typing
. set seed 48901
. simulate med=r(mean) bs_se=r(sd), reps(1000): bsse
Command: bsse
med: r(mean)
bs_se: r(sd)
Simulations (1,000): .........10.........20.........30.........40.........50....
> .....60.........70.........80.........90.........100.........110.........120..
> .......130.........140.........150.........160.........170.........180........
> .190.........200.........210.........220.........230.........240.........250..
> .......260.........270.........280.........290.........300.........310........
> .320.........330.........340.........350.........360.........370.........380..
> .......390.........400.........410.........420.........430.........440........
> .450.........460.........470.........480.........490.........500.........510..
> .......520.........530.........540.........550.........560.........570........
> .580.........590.........600.........610.........620.........630.........640..
> .......650.........660.........670.........680.........690.........700........
> .710.........720.........730.........740.........750.........760.........770..
> .......780.........790.........800.........810.........820.........830........
> .840.........850.........860.........870.........880.........890.........900..
> .......910.........920.........930.........940.........950.........960........
> .970.........980.........990.........1,000 done
. summarize
Variable Obs Mean Std. dev. Min Max
med 1,000 -.0013359 .1221602 -.3795549 .3656219
bs_se 1,000 .1278773 .0303109 .0614031 .2484805
This is a case where the simulation dots (drawn by default, unless the nodots option is specified)
will give us an idea of how long this simulation will take to finish as it runs.
References
Cameron, A. C., and P. K. Trivedi. 2022. Microeconometrics Using Stata. 2nd ed. College Station, TX: Stata Press.
Hilbe, J. M. 2010. Creating synthetic discrete-response regression models. Stata Journal 10: 104–124.
Taylor, M. A. 2018. Simulating the central limit theorem. Stata Journal 18: 345–356.
White, I. R. 2010. simsum: Analyses of simulation studies including Monte Carlo error. Stata Journal 10: 369–385.
Also see
[R] bootstrap — Bootstrap sampling and estimation
[R] jackknife — Jackknife estimation
[R] permute — Permutation tests
[R] set rngstream — Specify the stream for the stream random-number generator
Stata, Stata Press, and Mata are registered trademarks of StataCorp LLC. Stata and
Stata Press are registered trademarks with the World Intellectual Property Organization
of the United Nations. StataNow and NetCourseNow are trademarks of StataCorp
LLC. Other brand and product names are registered trademarks or trademarks of their
respective companies. Copyright
c
1985–2023 StataCorp LLC, College Station, TX,
USA. All rights reserved.
For suggested citations, see the FAQ on citing Stata documentation.