Statalist


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

st: R: Monte Carlo Simulation, help!


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   st: R: Monte Carlo Simulation, help!
Date   Sun, 18 Jan 2009 18:12:40 +0100

Dear STATADndee (knowing your name would make it less impersonal, I
suppose),
sticking to the example reported in the Appendix of the BMJ reference you
pointed out, what below seems to do the trick (for Stata 9.2/SE).

HTH and Kind Regards,
Carlo

----------------------------begin example--------------
set obs 10000
g A=.04 + .005*invnorm(uniform())
g B=.05 + .0102*invnorm(uniform())
g C=.06 + .0204*invnorm(uniform())
g Rank_A=3 if A>B&A>C
replace Rank_A=2 if A>B&A<C
replace Rank_A=2 if A<B&A>C
replace Rank_A=1 if A<B&A<C
g Rank_B=3 if B>A&B>C
replace Rank_B=2 if B>A&B<C
replace Rank_B=2 if B<A&B>C
replace Rank_B=1 if B<A&B<C
g Rank_C=3 if C>A&C>B
replace Rank_C=2 if C<A&C>B
replace Rank_C=2 if C>A&C<B
replace Rank_C=1 if C<A&C<B
tab1 Rank_A Rank_B Rank_C
centile A B C, centile (2.5 50 97.5)
----------------------------end example--------------

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di STATA Dndee
Inviato: domenica 18 gennaio 2009 12.46
A: [email protected]
Oggetto: st: Monte Carlo Simulation, help!

Hi
I want to rank institutions for and outcome given in outcome% based on Monte
Carlo simulation and produce a table like table 2 in
http://plus.maths.org/issue46/risk/index.html.  The method is also described
by Spiegelhalter in BMJ, 1998, 316(1701-1705). 
I am a beginner in STATA. Could anyone help me in performing the analysis in
STATA? I need the commands and number of iterations.  Number of institutions
is more than in the sample.

Any help will be really appreciated.
Kind regards

Inst.	cases	total	outcome%

f	71	273	26.01%						
e	259	809	32.01%						
c	121	345	35.07%						
d	262	726	36.09%						
mean	713	2153	33.12%						
b	192	480	40.00%						
a	120	204	58.82%	


      

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index