ࡱ> ZY  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX\]^_`akcdefghij[lmnopqrtuvwxyz{|}~Root Entry F∬3>s@WorkbookC[_VBA_PROJECT_CUR"A)tjglgVBA tjg`kg  Worksheet"&Tools&WindowChart"&Tools&Window(Visual Basic Module"&Tools&Window\p Administratoreto Ba= ThisWorkbook=+<n@"1.Times New Roman1.Times New Roman1.Times New Roman1.Times New Roman1.Times New Roman1. Times New Roman1.8Times New Roman1.Times New Roman1Arial1$Arial1. Times New Roman1.Times New Roman1 Arial1.Times New Roman1. Times New Roman1.Times New Roman1. Times New Roman1.Times New Roman1. Times New Roman1. Times New Roman"$"#,##0_);\("$"#,##0\)!"$"#,##0_);[Red]\("$"#,##0\)""$"#,##0.00_);\("$"#,##0.00\)'""$"#,##0.00_);[Red]\("$"#,##0.00\)7*2_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).))_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)?,:_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)6+1_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)"C"#,##0_);\("C"#,##0\)!"C"#,##0_);[Red]\("C"#,##0\)""C"#,##0.00_);\("C"#,##0.00\)'""C"#,##0.00_);[Red]\("C"#,##0.00\)72_("C"* #,##0_);_("C"* \(#,##0\);_("C"* "-"_);_(@_)?:_("C"* #,##0.00_);_("C"* \(#,##0.00\);_("C"* "-"??_);_(@_)A<_("$"* #,##0.000_);_("$"* \(#,##0.000\);_("$"* "-"??_);_(@_)C>_("$"* #,##0.0000_);_("$"* \(#,##0.0000\);_("$"* "-"??_);_(@_)=8_("$"* #,##0.0_);_("$"* \(#,##0.0\);_("$"* "-"??_);_(@_)94_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"??_);_(@_)E@_("$"* #,##0.00000_);_("$"* \(#,##0.00000\);_("$"* "-"??_);_(@_) 0.000000000 0.00000000 0.0000000 0.000000 0.00000 0.0000 0.000 0.0%0.0 0.0000000000 0.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.00000000000000000000 0.0E+00 0.000E+00 0E+00 #,##0.0 #,##0.000 #,##0.0000 #,##0.00000 #,##0.000000 #,##0.0000000#,##0.00000000                + ) , *           " q!  a q q*0  *8 q(  a( q" " q q" q q ( q  q   q  q!  q       " q   *8  *8 " q  a    q , q  $@ @  ,@ @ q @ @ q (@ @ q (!@ @ q !@ @  $!@ @ q !!@ @ q(0  q (@ @  q ,!@ @ q (!!@ @ q ( q @  $@ q (@ @  ,!@ @  ,!@ @ q (!@ @  ,!!@ @ q (@ @  ,!@ @  ,!@ @ q (!@ @  ,!!@ @ q (  q (  q ( q (@ q (  @ q (  q (  q ( q (@@  q (  @  a (@  a (  q (@  q ( @ q"8"@@ q"8"@ q"8 " @ q"8"@ q"8 " @ q*8@ @ *0!@ @ q"8@@ q"8  @ q"8@@ q"8  @ q*8!@ @  Normal_AutoCorrNormal_MonteCarlo8 ``i̜̙3f3333f3ffff333ff333f33f33BBB\` %Doct: OneVarMCSimu} TwoVarMCSim MainModule`i H8 Sample NumbersecsAverageSDMaxMin?Only the first 100 repetitions are displayed on this worksheet.Summary Statistics!Results of Monte Carlo SimulationSimulation Stats repetitionsWThis add-in permits Monte Carlo simulation of one or two cells from any Excel workbook.Var1Var2fIt also allows the user to easily switch from RAND to random(FMRG), the Barreto/Howland implementationof Deng and Lin's FMRG.secondsNotesCorrected Mac LanguageID bug.#Used latest Howland Histogram code.Revised Histogram code--FHOBeginning value for Histogram display still need some work to make scaling nice,2Var Histogram is same scale both variables.mI dragged the Histogram module from MCSimRevised.xla.xls (that Howland was using for testing) into MCSim.xla.'Resized form for better display on Mac.UI'm still not able to get a nice display on a Mac without making it look bad on a PC. Frustrating.&Recovered file from Howland's machine.This should be it!*I'll never say "This should be it!" again.Added error checking code.=Added Howland's latest tweak on the binwidth and starting binvFollowed up on Howland suggestion to trap and report an error when the user selects a cell with a formula, but it does&not vary as the sheet is recalculated.6Added ability to track up to 256 cells and 65000 reps.CCorrected problem with sheet recalculation for tracking many cells.4Added option to output results to an existing sheet.1Based on a request from user Andrew Biggs at SSA.%Corrected Histogram updating mistake.3Added option to out results to MCRaw existing sheetCorrected Symbol font formatted cells, added updated (Oct-2004) RNGandSortModule from Random.xls, and added warning message in cell I1 on use of functions available only from the add-in.ZFixed problem with simply copying sheet with a chart from the add-in to the the user book.Learned that =random() looks first in the workbook, then add-ins. Because chart uses the name of the sheet in the Series formula, that somehow triggers "full naming."XThe only way to access the random() function in the add-in is to use MCSim.xla!random().With this version, the MCSim sheets in the add-in do NOT have charts. The chart is added AFTER the sheet is copied to the user's book.fAlso changed code to check for no change in a cell up front instead of waiting after the code has run.CFixed problem with wrong color coding of chart in a 2 var histogram>Fixed bug with non US English versions. Thanks to John Talyor.(Added recalculate entire workbook option8Fixed sheetname problem when user deleted an MCSim sheetOAdded Functions module from Random.xls to include functions with correlated Xs.Enabled fewer than 100 repsAdded a feature that uses the cell name, if it is named, instead of the address, in the Monte Carlo output using the Function CellName(Address as String) eFixed bug with recalculate entire workbook option. You cannot put a checkbox control inside a frame. |Put in latest version of RNGandSortModule and cleaned up Log10 function (putting it in the Histogram code where it belongs)."Foreign language uninstall support:6 U+n1" cc  R(148:  dMbP?_*+%;&A Page &PMF Canon iR5570 PCL6<h  odXLetterCanonY Canon iR5570/iR6570 PCL6ddd      d d d d dd@@d  d  d dd d"edd     ddd     d!!d      !"#$ddA     A d     @8o @*/ o @*/ AXXd2\SRGBCO~1.ICM\SRGBCO~1.ICM\SRGBCO~1.ICM CONFIDENTIALCONFIDENTIALHArialDefault Settings@"dXX??U} 7}  R;;;;;;; ; ; ; ; ;;;;;;;;;;;;;;;~ 7@ 7 7 7~ 7@@ 7 7~ 7@ 7 7 7 7~ 7@ 7 7 7~ 7@ 7 7~ 7@ 7 7 7~ 7`@ 7 7!8t!;";$;%;';(;);+;,;.;/;1;2;4;5;6;7;8;9;;;<;>;?;~ !7@ "7"~ $7@ %7#~ '7@ (7$ )7%~ +7@ ,7&~ .7@ /7'~ 17@ 27(~ 47@ 57) 67* 77+ 87, 97-~ ;7@ <7.~ >7@ ?7/2@;A;B;D;E;G;H;J;K;M;N;P;Q; @70 A71 B72~ D7@@ E73~ G7@ H74~ J7 @ K75~ M7 @ N76~ P7@ Q77>4@RRR7 Sheet1   gV<eWky|  dMbP?_*+%;MSymantec Fax Starter Edition@f@MSUDOLFAXDRVd"d??U} #}  } } } } -}  } }  @ }  }  } @} @ }  }  } !* } +1 } 2 Estimated rho in SUsgBBv BH! BJ BJ B;B;B;BJ B; B; B; B; B; B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;  !#$%&*&2A  B f g"""""""("""""""""" ~ !" """#$""%>&"""""""""""""""""""""A~ #?$ (C > !!?~ "#$!?~ %&*&2A~ #@$ (D E a  bc  d  de &!!?~ "@#$!?~ %@&*&2A~ #@$ %8% G H|u? '[V\ &!1?~ "@#$!?~ %@&*&2A~ #@$ = ; 0n? F]^T !!?~ " @#$!?~ %@&*&2A~ #@$. < :>i@ '_UT !@)?~ "@#$1?~ %@&*&2A~ #@$. ? @lSQ? 9`YZ !1?~ ""@#$1?~ % @&*&2A~ #@$/%6%%%% !9?~ ""@#$!?~ % @&*&2A~ # @ $ / (6%%%%  & !!?~ "(@ # $!?~ %@ &*& 2A~ #"@ $ %6%%%%  & ! ?~ " @ # $@)?~ %@ &*& 2A~ #$@ $ %%%%%%  & !@)?~ "@ # $@)?~ %"@ &*& 2A~ #&@ $ %%%%%%  !`?~ "@ # $1?~ %"@ &*& 2A~ #(@ $ * %%%%%%  !1?~ "@ # $1?~ %"@ &*& 2A~ #*@$*%%%%%% !?~ "@#$9?~ %"@&*&2A~ #,@$*%%%%%% !9?~ "@#$9?~ %(@&*&2A~ #.@$%%%%%% !?~ "@#$!?~ %(@&*&2A~ #0@$%%%%%% !!@~ "@#$!?~ % @&*&2A~ #1@$%%%%%% !c@~ "@#$ ?~ % @&*&2A~ #2@$%%%%%% ! @~ "@#$ ?~ %@&*&2A~ #3@$%%%%%% !0@~ "@#$@)?~ %@&*&2A~ #4@$%%%%%% !@)@~ "?#$@)?~ %@&*&2A~ #5@$!Pk@~ "#$`?~ %@&*&2A~ #6@$!`@~ "#$`?~ %@&*&2A~ #7@$!p@~ "#$1?~ %@&*&2A~ #8@$!1@~ "#$1?~ %@&*&2A~ #9@$!s @~ "#$?~ %@&*&2A~ #:@$! @~ "#$?~ %@&*&2A~ #;@$! @~ "#$9?~ %@&*&2A~ #<@$!9 @~ "#$9?~ %@&*&2A~ #=@$!{ @~ "#$?~ %@&*&2A~ #>@$!@~ "#$?~ %@&*&2ADl B;!B;"B;#B;$B;%B;&B;'B;(B;)B;*B;+B;,B;-B;.B;/B;0B;1B;2B;3B;4B;5B;6B;7B;8B;9B;:B;;B;<B;=B;>B;?B;~ #?@ $ !@~ " # $!@~ %@ &*& 2A~ !#@@!$ !!#!$!@~ !%@!&*&!2A~ "#@@"$ "!#"$c@~ "%@"&*&"2A~ ##A@#$ #!##$c@~ #%@#&*&#2A~ $#A@$$ $!#$$ @~ $%@$&*&$2A~ %#B@%$ %!#%$ @~ %%@%&*&%2A~ &#B@&$ &!#&$0@~ &%@&&*&&2A~ '#C@'$ '!#'$0@~ '%?'&*&'2A~ (#C@($ (!#($@)@~ (%?(&*&(2A~ )#D@)$ )!#)$@)@~ )%)&*&)2A~ *#D@*$ *!#*$Pk@~ *%*&*&*2A~ +#E@+$ +!#+$Pk@~ +%+&*&+2A~ ,#E@,$ ,!#,$`@~ ,%,&*&,2A~ -#F@-$ -!#-$`@~ -%-&*&-2A~ .#F@.$ .!#.$p@~ .%.&*&.2A~ /#G@/$ /!#/$p@~ /%/&*&/2A~ 0#G@0$ 0!#0$1@~ 0%0&*&02A~ 1#H@1$ 1!#1$1@~ 1%1&*&12A~ 2#H@2$ 2!#2$s @~ 2%2&*&22A~ 3#I@3$ 3!#3$s @~ 3%3&*&32A~ 4#I@4$ 4!#4$ @~ 4%4&*&42A~ 5#J@5$ 5!#5$ @~ 5%5&*&52A~ 6#J@6$ 6!#6$ @~ 6%6&*&62A~ 7#K@7$ 7!#7$ @~ 7%7&*&72A~ 8#K@8$ 8!#8$9 @~ 8%8&*&82A~ 9#L@9$ 9!#9$9 @~ 9%9&*&92A~ :#L@:$ :!#:${ @~ :%:&*&:2A~ ;#M@;$ ;!#;${ @~ ;%;&*&;2A~ <#M@<$ <!#<$@~ <%<&*&<2A~ =#N@=$ =!#=$@~ =%=&*&=2A~ >#N@>$ >!#>$@~ >%>&*&>2A~ ?#O@?$ ?!#?$@~ ?%?&*&?2ADZl@B;AB;BB;CB;DB;EB;FB;GB;HB;IB;JB;KB;LB;MB;NB;OB;PB;QB;RB;SB;TB;UB;VB;WB;XB;YB;ZB;[B;\B;]B;^B;_B;~ @#O@@$@!*&@2A~ A#P@A$A!*&A2A~ B#@P@B$B!*&B2A~ C#P@C$C!*&C2A~ D#P@D$D!*&D2A~ E#Q@E$E!*&E2A~ F#@Q@F$F!*&F2A~ G#Q@G$G!*&G2A~ H#Q@H$H!*&H2A~ I#R@I$I!*&I2A~ J#@R@J$J!*&J2A~ K#R@K$K!*&K2A~ L#R@L$L!*&L2A~ M#S@M$M!*&M2A~ N#@S@N$N!*&N2A~ O#S@O$O!*&O2A~ P#S@P$P!*&P2A~ Q#T@Q$Q!*&Q2A~ R#@T@R$R!*&R2A~ S#T@S$S!*&S2A~ T#T@T$T!*&T2A~ U#U@U$U!*&U2A~ V#@U@V$V!*&V2A~ W#U@W$W!*&W2A~ X#U@X$X!*&X2A~ Y#V@Y$Y!*&Y2A~ Z#@V@Z$Z!*&Z2A~ [#V@[$[!*&[2A~ \#V@\$\!*&\2A~ ]#W@]$]!*&]2A~ ^#@W@^$^!*&^2A~ _#W@_$_!*&_2ADl````````````````````````````````B;aB;bB;cB;dB;eB;fB;~ `#W@`$`!*&`2A~ a#X@a$a!*&a2A~ b#@X@b$b!*&b2A~ c#X@c$c!*&c2A~ d#X@d$d!*&d2A~ e#Y@e$e!*&e2A f,x``````P>@   7 Sheet2   g=~: `  dMbP?_*+%;"d??U} #} 0} 1} } }  } }  }  }  } @} @ } 5 } 6 Column LgBBv B! BJ BJ B;B;B;BJ B; B; B; B; B; B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B;B; !'6A  2 3 B f l"""""""j"""""""""""""""A~ #? 45 (C > !'6A~ #@ 45 (D A h  i  j  k  d e&!'6A~ #@ 45 %8% I JLo?  N Or?}k?  VW &!'6A~ #@ 45 I K ??  N Ph ?  SX !'6A~ #@ 45 I J*?  N OV?  UT !'6A~ #@ 45 L M{n  Q R ݿ  YZ !'6A~ #@ 45%6%%%% !'6A~ # @ 45  (6%%%%  & !' 6A~ #"@ 45 %6%%%%  & !' 6A~ #$@ 45 %%%%%%  & !' 6A~ #&@ 45 %%%%%%  !' 6A~ #(@ 45 * %%%%%%  !' 6A~ #*@ 45*%%%%%% !'6A~ #,@ 45*%%%%%% !'6A~ #.@ 45%%%%%% !'6A~ #0@ 45%%%%%% !'6A~ #1@ 45~ +?%%%%%% !'6A~ #2@ 45%%%%%% !'6A~ #3@ 45%%%%%% !'6A~ #4@ 45%%%%%% !'6A~ #5@ 45!'6A~ #6@ 45)!'6A~ #7@ 45!'6A~ #8@ 45!'6A~ #9@ 45!'6A~ #:@ 45!'6A~ #;@ 45!'6A~ #<@ 45!'6A~ #=@ 45!'6A~ #>@ 45!'6AD`ljrvvvlvvvllzlllV`VVVVVVV B;!B;"B;#B;$B;%B;&B;'B;(B;)B;*B;+B;,B;-B;.B;/B;0B;1B;2B;3B;4B;5B;6B;7B;8B;9B;:B;;B;<B;=B;>B;?B;~ #?@ 45 !' 6A~ !#@@ !45!!'!6A~ "#@@ "45"!'"6A~ ##A@ #45#!'#6A~ $#A@ $45$!'$6A~ %#B@ %45%!'%6A~ &#B@ &45&!'&6A~ '#C@ '45'!''6A~ (#C@ (45(!'(6A~ )#D@ )45)!')6A~ *#D@ *45*!'*6A~ +#E@ +45+!'+6A~ ,#E@ ,45,!',6A~ -#F@ -45-)-!'-6A~ .#F@ .45.!'.6A~ /#G@ /45/!'/6A~ 0#G@ 0450!'06A~ 1#H@ 1451!'16A~ 2#H@ 2452!'26A~ 3#I@ 3453!'36A~ 4#I@ 4454!'46A~ 5#J@ 5455!'56A~ 6#J@ 6456!'66A~ 7#K@ 7457!'76A~ 8#K@ 8458!'86A~ 9#L@ 9459!'96A~ :#L@ :45:!':6A~ ;#M@ ;45;!';6A~ <#M@ <45<!'<6A~ =#N@ =45=!'=6A~ >#N@ >45>!'>6A~ ?#O@ ?45?!'?6ADJ lVVVVVVVVVVVVV`VVVVVVVVVVVVVVVVV@B;AB;BB;CB;DB;EB;FB;GB;HB;IB;JB;KB;LB;MB;NB;OB;PB;QB;RB;SB;TB;UB;VB;WB;XB;YB;ZB;[B;\B;]B;^B;_B;~ @#O@ @45@!'@6A~ A#P@ A45A!'A6A~ B#@P@ B45B!'B6A~ C#P@ C45C6A~ D#P@ D45D6A~ E#Q@ E45E6A~ F#@Q@ F45F6A~ G#Q@ G45G6A~ H#Q@ H45H6A~ I#R@ I45I6A~ J#@R@ J45J6A~ K#R@ K45K6A~ L#R@ L45L6A~ M#S@ M45M6A~ N#@S@ N45N6A~ O#S@ O45O6A~ P#S@ P45P6A~ Q#T@ Q45Q6A~ R#@T@ R45R6A~ S#T@ S45S6A~ T#T@ T45T6A~ U#U@ U45U6A~ V#@U@ V45V6A~ W#U@ W45W6A~ X#U@ X45X6A~ Y#V@ Y45Y6A~ Z#@V@ Z45Z6A~ [#V@ [45[6A~ \#V@ \45\6A~ ]#W@ ]45]6A~ ^#@W@ ^45^6A~ _#W@ _45_6AD lVVV>>>>>>>>>>>>>>>>>>>>>>>>>>>>`B;aB;bB;cB;dB;eB;fB;~ `#W@ `45`6A~ a#X@ a45a6A~ b#@X@ b45b6A~ c#X@ c45c6A~ d#X@ d45d6A~ e#Y@ e45e6A f,x>>>>>>P>@"    7 Sheet3 &A Page &P"P??d> P MainModulebY.__SRP_b __SRP_aThisWorkbook%  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^`abcdefhiklmnopqrstuvwxyz{|~ $  8 X 4` 8 ""6 &8C` x/3x  0 4 & "( 0HPX *`"2 K ;0 D@$R    ,S 2 H <nP Fs H  ( <0 p  x 2   >v       8 P X 0h  ` " J   DOCUMENTATIONE> This add-in does a Monte Carlo simulation of one or two cellsog from ANY Excel workbook INITIAL DATE: 5 Jan 2004 REVISIONS: 5 Mar 2004 8 Jan 2004 14 Jan 2004 20 Jan 2004 22 Feb 2005 24 June 2005- To see complete documentation, see Doc sheet User Input; It is assumed that the user has a workbook with some cells that use random number formulas Written by Humberto BarretoQ for Barreto/Howland, Introductory Econometrics, Cambridge University Press, 20067 Idea behind the Progress Bar is due to John Walkenbach3 http://support.microsoft.com in the Knowledge Base( FMRG references in the RNGandSortModule% All other ideas from Barreto/Howland Contact Humberto Barreto Dept of Economics Wabash College Crawfordsville, IN 47933 E -mail: barretoh@wabash.edu phone: (765) 361-6315 FAX: (765) 361-6277- Run the MCSim add-in by executing this macro2 It will bring up a form which enables the user to input necessary information+in case the user is in a graph or something load form with where the user is "!$ !( make sure it's A1 style &!( *This add-in will not work with columns as numbers. Please execute Tools: Options, click the General tab, and uncheck the R1C1 reference style option..Unacceptable Reference Style0 42A@,k B@6oh) ****************************************. This macro adds a menu item so the ShowMCForm macro can be run from the menu define variables]]'B$ Make sure the Tools menu is visibleWorksheet Menu Bar$D(Fcheck language] &!J$WThanks to John Talyor N &%LTools'H=it's not English, try to get the word for Tools from the userd@The language of this installation of Excel does not appear to be EnglishUS. Please enter the word that Excel is using for Tools on the main menu across the top of the screen. For example, in Spanish, it is Herramientas.Get the word for TOOLS Herramientas &%P'HkdTools'Hk HWorksheet Menu Bar$D%R(F+ Check t &$^HxME@ LZ6 <`<< L"LLLLLL`k66;`@x`Bv `HX X@%@x\ @T  j`Jq@D %(`pXx@4 @($ @ @ @0 @H @` @ @ @ @ @ #`%)@@ ^@X @p| @l @\ @L @< @d, @ 0H"&*4,@x @h @d @T @`D @@ @x0 @ @ @ @ , `l @\ @L @< @, @  @  @  @ (  @ @xx @h (d @` @P L @< @,  ( @ @ H  @ x  @  @bD!$*\Rffff*3I4462fc38*\R5*#50*\R1*#4a*\G{6D9D214E-BA6D-4A92-B9A3-7C5942959563}#1.0#0#..\Forms\RefEdit.exd#Ref Edit Control*#0$*\Rffff*1Y445b700f*\R1*#1c8*\R0*#14*\R0*#1*\R5*#30*\R5*#50*\R5*#4f*\R1*#6c*\R0*#f*\R1*#d7*\R5*#4e*\R5*#4d*\R5*#8c*\R1*#e8*\R1*#2ac*t  D `       0 4H  B &    X8 > : . ,@ p     o see if there is a MCSim menu item'B @ HWorksheet Menu Bar$D%R!R!T @ HWorksheet Menu Bar$D%R%R!V MCSim ...AMeans the MCSim menu item is already there, make MCSimIsHere True'Bd5Means the MCSim menu item is not there, so do nothingkX @+ Add the MCSim menu item if it is not there B]( ^l HWorksheet Menu Bar$D%R!R%\.X X ShowMCForm9` MCSim ...9Vqxkpoh* Message to the user when add-in is loaded MCSim ...ToolsWorksheet Menu Bar$D%R%R!`A@,o(AYou have successfully loaded the Monte Carlo Simulation add-in. You must have at least one cell that has a random number function in its formula. You provide one or two cells and the add-in simply recalculates the workbook for as many repetitions as you indicate and outputs the results in a new sheet in your workbook. $f $fExecute  H: MCSim ... to begin. h Monte Carlo Simulation Available$,'dAttribute VB_Name = "MainModule" ' DOCUMENTATION@This add-in doe MonCarlo simulation of one or two cellsfrom ANY Ex workbookINITIAL DATE: 5 Jan 2004REV$ISS: 5 (Mar8 )14 20 2 Feb:5$2uR 3Taee c omplejdo@cumenti, s Doc s0heet!User Inpu ' It ssd thate uhay with so ranBdnumb.for8Written byHto Barpreto /PHowl&,Qtrctory 0Econ@cs, Cambridge University PXresF6Idea behin6eog!=due !John Walke nbach#http://support.microsoft.Z @the Kn*e BaseA FMRG ref`erenc RtNG3S All o@r iy)s BDE@1C@acjQNDep&tGic¬Wabash Colleg&CrawaYdsviVN 47933"#E -mail:D bdh@w.Heduph: (765) 3@61-631ŸFAX277 C.RunMCSimby executing@\maW@w@' @vup a ,m which enabl*A/SE#GiX ne-s2aDina_ Sub ShowMCFR() @On Err`|Re^ Next '5c`8b `a graphA^tIgloafd$bwh=I  .RefEd@itOneC.ValN= Act`VBAddR make sure it's A@1 styl`7If Applicoba KS`xlR1C1 Th en Ms@gBox pp0t:=")+not˜ycolumn|s ws. 0 Ple!#5e Tools: OVp@lckBGeneral tab, \ uncheca o.", TitleUnalccX; `& Buttons:=vbC!l E@zIf&-<@>O * *"a$"QUu`1em BIcc be r ]"xGSCPub% P=`MenuItemaQ' defivari[ D ej Asp Lon`MI,sH"B`1ea`== Fal]AMFIb7 s visih 0Comm5@s(l"WB ").VC@LTruQ@ C;guamy# `SA@VLeft(VOFpD~Sys, 1) "W"$W'ThanksTalyor E_I{rnaq(al(xlNonEnglishF')) <> ! 81E Ђ'iq601, tC`ge#ppor>/#ZB&?7 v8("]9 5ZpDs@dstalӅd1 appe% US.9aR)B RxKusU`P a ^ns Ws@ltop# Gcre\en?R0Za,nSpan(ramiAsa<"GOOLS;", 2XTFD4  4:`]3p6D4%;D `"%p$ p Dc]@p5D CX RD (%'%'%'%'%: %:` % p$ p D`1Xp5D/ CXSlXF%\:`%p$ dp H\  ,  )p\pvnxlXF%\:`%p$ dp H\  , WDA4")p\6D4dsx@lXF%\:`%p$ dp H\  , DA4:]3)p\6D4vpvx xf kv0v%lXF%\:`%p$ dp H\  , W4$)p\64$ l    c D  $ '<'L:N\\@:`D4$:lXF|:l^i,6D4$|l\L<`4,XHTp\D4$|l\L<0   arU $ `$ `$ `nd ^^#<}~3Z L2{?Fc7BHhgʓxc7BHhgʓ}~3Z L2{?ME0[LSS6"<8<<<<< <$<(<, <<<N0{00020819-0000-0000-C000-000000000046}P n@`@|kT p`NX`H%@ %l0 %>(olo\Hvxt p @` @P @@ (0 , @(  @ @ @ @ @ @ @ @ @@\TbD!$*\Rffff*1V445b700f$*\Rffff*3I4462fc384" "0 8 " @ 8H    DX$` Dm  Put the MCSim menu item in does A@>ox@1 Delete the new menu command from the Tools menu.0check language] &!J$WThanks to John Talyor N &%L@Tools'H, =it's not English, try to get the word for Tools from the useruaged8The language of this installation of Excel does not appear to be EnglishUS. Please enter the word that Excel is using for Tools on the main menu across the top of the screen. For example, in Spanish, it is Herramientas.Get the word for TOOLS Herramientas &%P'Hkd MCSim ... HWorksheet Menu Bar &%D%R%RB@zoTools'Hk `@Attribute VB_Name = "ThisWorkbook" Bas0{00020P819-0C$0046} |GlobalSpacFalse dCreatablPredeclaIdTru BExposeTemplateDerivBustomizD2Sub _AddinInstall() ' Put the MCSim menu it em inqdd M I ` End ) " -Uni.Dele0new/ comma"from=Tools! . On Error ResuNext Xcheck languagQ D-yAs Sng If Left(Application .Oper@ngSys3, 1)AW" The;'Thanks to John Talyor@Internal(xlNonEnglishFuncAs) <> _DA5m)A<@'it's not , trygeewor8d fB8Lus:e&EB K*putBox("8L of]isxB2Excel doe$appe$arA#be(US. PleeAe )tha1Busing.onB mainC`acrosZtop$e screen. F"<<<< <$<(<,<0<4<8<<<@/,q  (P x   ,0J "ZR`J & "  >0 p!x! ,j      8 @ $`  -<2 0*f8   h  8Q &D  204[G (-&!!  (  8 P ` p  x .-0d 0 @P *X* ^ 28n@ x/,q (  (  0 "8"R` " " $Ph"G  22 282P h    $4 t d,,0+0z( X p ( 7  .4N&18 `2op2o8x8x2P0`2p !> * H27 8@H7Phpx; .v  < @ H` x-<2 *f *f8  h   8 Q &D!  20!4[G  (!-!&!!!!"  ("  8" P" `"p"  x" ."-"""0d# 0# @#P# *X#*#*# ^# 2($8n`$ $$/$,q$ (% 0%@%H%  P% "X%"R% "% "% %$Ph!"G%"G &  H& 2X&2p&2&2& 2&2&2&2' ' 8' X' x' ( (( (( )0z) **0*$48*`* h*x**$4** *,H,+,,H,*,+ (P+ 7x+ + +.+4N+&1, 0,2o@,2ox,8x,8x,2 -00-2@- !P->`- *x--- ------H-2-7-...7 .8.@.H.P.X.;`.. N. . <p/ / "/-/ /,O0 013@1111121 2D3244 . 4P4/X4 $h4Ox4 x535 6(60686/@6 $P63`666 6  7 @(7<h7<7H7 ,08 "E`8<8N88.9 "B(9P9/99 @:<@:<:<:H; ,H;"Ex;<;N;<. < "B@<h<</== N= "=2> "> B(>-p>>|C> ? . ?/P? $`?Op? p@3@A A(A0A/8A $HA3XAAA A BB0a0B `B pB "B "B2B "B/B BC &C8C @C`C &hC C/C&JC;C C1D &(D %PD `DD D D D "D 3J D "D D EE " E(E0E"V8E $`E`QpE EEE EEEfF hF"pFxFF"VF $F`QF G(G0G 8G@GHGfPG G Kx] ]X]p]]]]](]@]X]p]ete th]0]H]`]] ; These are the proposed Widths of the bins in the histogram]]]]](]H]h]]]]] !! $!!'Get user inputted data First cellmake sure it's a valid cellA@  Unload MCForm|k*Get exact location of the cell as a stringNThis string can be used in a Range Object with all usual Properties accessible !! $%$'User error check $!=  aThe selected cell does not contain a formula so the cell value will not change. Please try again.. 42 Fatal Error0A@, Unload MCForm|8k0 Second cell !! 'dmake sure it's a valid cellA@  Unload MCForm|k !!  %%$' $!=  hThe selected second cell does not contain a formula so the cell value will not change. Please try again.. 42 Fatal Error0A@, Unload MCForm|kxkpcheck to make sure cell changed]]]0  it's a OneVar $! ' $B@  $! The cell you selected, , did not change when the sheet was recalculated. This cell may not be appropriate for a Monte Carlo analysis. Do you want to proceed? Cell Doesn't Change Warning$,'   A@r|kkd it's a TwoVar $! ' $! ' $B@  $!   $! One of the cells you selected,  or  , did not change when the sheet was recalculated. That cell may not be appropriate for a Monte Carlo analysis. Do you want to proceed? Cell Doesn't Change Warning$,'   A@r|kkk ` Track the Time elapsed ' Get the calculation setting &!' Set to manual  &( Turn off screen updating &($ Change RAND for random if requested !RANDOMRAND   !B@kh$ Change RAND for random if requested !RANDMCSIM.XLA!RANDOM   B@k Show the Progress Bar !(F9 general variables not used in this histogram application'':handle user's request for more tracked cells, called MCRaw ! !  !.check for too many reps  You cannot have more than 65,535 repetitions when the Record All Selected Cells option is on because the results will not fit on the sheet. Please lower the Number of Repetitions below 65,535.. Too Many Reps0 42A@,|kdeclare array for results]h] Get number of var to be tracked  !  !  '    You have selected more than 256 cells to record. This cannot be accomodated on an Excel sheet. You may have inadvertently selected a large range of cells. Please correct this and try again..Too Many Cells to Record0 42A@, A@r|kadd a sheet for MCRaw B@\CI added 1 to Sheets.Count and used 2 instead of 1 to make the MCRaw1sheet number correspond to the MCSim sheet number8I added a loop to ensure the user would get a valid name]'  !TMCRaw !T   $!!name is taken can't use that name  '@k80name wasn't taken so use it]k0    get the sheetname for later use] !'7put down cell addresses in first row as labels for data'  !  ! %$  $%(   '   size array  kX  Run the Monte CarloDetermine if a One or Two Var  it's a OneVar   !! A@0this is actually faster if the workbook is smalldx $B@k` !!  $%!  + Track Progress  '2 Update the Caption property of the Frame control. 0%$ !(V Widen the Label control.  !!  !(, The DoEvents allows the UserForm to update.  d &!Z%"load array if user requested MCRaw ! ! 'initialize for next rep  !  !  ' !   +  k (put down results if user requested MCRaw ! !    @   @$  @ $%(  @ k@ #Get Summary stats and put them down     A@ WBasicFour(data() As Double, MEAN As Double, SD As Double, MAX As Double, MIN As Double)+Copy the MCSim sheet to the user's workbook & OneVarMCSim MCSim.xla$"%B@$name MCSim sheet'(  !TMCSim !T   $!!name is taken can't use that name  '(pkh`name wasn't taken so use itMCSim !T   (get current MCSim sheet name !'Put down first 100 $  $( x  +  +  +  +Make histogram**** Width histrange ^    $*'d    $8'khnHistogramMaker FirstCellArray, myReps, 31, xmean, 0, 0, 0, ActiveSheet, ActiveSheet.ChartObjects("EmpHist"), 1^(values, noobs, Nobins, center, manual, minval, maxval, histsheet, histogram, whichhistonsheet I4$( B2 B2$(   %P( %$.histsheet.Activate (,"make a chart on the existing sheet .B@\ 4 0(2 add a series :8  0B@6aa1:ab3 %> 0B@<C one seriesEmpHistChart 1 %@(size it $%D!EmpHist %B( $%H!FEmpHist %B(F $%H!J EmpHist %B(J $%D!EmpHist %B( 0!LB@H T N!P(R 0!VB@H NB@z Z 0%XB@H N!\ `9^ T9bq N T9d T9f T9hqx Z 0%X!jB@H 0!LB@H l 0%X9n9pq  Z 0%X9n9pq 09r Empirical5t!v(dq         Ax Label Output5This is the end of the One Var Monte Carlo simulationd(it's a Two Var (   !! A@0this is actually faster if the workbook is smalld $B@kh !!  $%!  + !!  $%!  + Track Progress  '2 Update the Caption property of the Frame control. 0%$ !(V Widen the Label control.  !!  !(, The DoEvents allows the UserForm to update.  d &!Z%"load array if user requested MCRaw ! ! 'initialize for next rep  !  !  ' !   +  k (put down results if user requested MCRaw ! !    @   @$  @ $%(  @ k#Get Summary stats and put them down     A@      A@ WBasicFour(data() As Double, MEAN As Double, SD As Double, MAX As Double, MIN As Double)+Copy the MCSim sheet to the user's workbook & TwoVarMCSim MCSim.xla$"%B@$name MCSim sheet'z  !TMCSim !T   $!!name is taken can't use that name  'z(k name wasn't taken so use itMCSim !T   (get current MCSim sheet name !'Put down first 100 $  $(  $  $(    +  +  +  +  +  +  +  +Dim myMin As DoubleDim myMax As DoubleDim myHistWidth As DoublemyMin = Application.WorksheetFunction.Min(Application.WorksheetFunction.Min(FirstCellArray), Application.WorksheetFunction.Min(SecondCellArray))myMax = Application.WorksheetFunction.Max(Application.WorksheetFunction.Max(FirstCellArray), Application.WorksheetFunction.Max(SecondCellArray))"myHistWidth = (myMax - myMin) / 10Make histogram[SuperimHistoMakerScaled FirstCellArray, SecondCellArray, myReps, 31, (xmean + x2mean) / 2, 0, 0, 0, ActiveSheet, ActiveSheet.ChartObjects("EmpHist"), "Var1", "Var2",' myMin, myMax, myHistWidth, 2 get width %P( %$. ^    $*'d     $8'k ^    $*'d    $8'k Label Output AL1$( I4 AM1$(  C2$( AL AL1$( ]`"make a chart on the existing sheet .B@\ 4 0(2 add a series :8  0B@6aa1:ac3 %> 0B@<C two seriesEmpHistChart 1 %@(size it $%D!EmpHist %B( $%H!FEmpHist %B(F $%H!J EmpHist %B(J $%D!EmpHist %B( 0!LB@H T N!P(R 0!VB@H NB@z Z 0%XB@H N!\ `9^ T9bq` N T9d T9f T9hq8 Z 0%X!jB@H 0!LB@H l 0%X9n9pq Z 0%X9n9pq 09r Empirical5t!v(dqx               A|(values1, values2, noobs, Nobins, Center, manual, minval, maxval, histsheet, histogram, myname1, myname2, histbegin, histend, histwidth, histno)5This is the end of the Two Var Monte Carlo simulationkHdo the existing sheet option !~! ]0Please enter the number of the existing MCSim sheet to which the results of this simulation will be written. Simulation results on the existing MCSim sheet will be overwritten and lost. Click Cancel if you are unsure.Existing Sheet Name Requested MCSim Number &%P' fYou have canceled writing output to an existing sheet. No changes to an existing sheet have been made. hNo Writing to Existing SheetA@, k ]HMCRaw 'MCSim 'I5 $%! AverageI6 $%! SDI7 $%! MaxI8 $%! MinThe Average, SD, Max, and Min results are written in cells J5:J8, with labels in cells I5:I8. Cells I5:I8 of the chosen existing sheet do not contain this information so this may not be an MCSim sheet. Thus, no changes to the existing sheet have been made. 40Existing Sheet May Not be MCSim Sheet CompatibleA@, k (check to make sure existing sheet exists $B@H  The sheet name you entered does not exist. Please enter the name of the existing sheet on which you want to overwrite the MCSim results with the results of this simulation.Existing Sheet Name Requested MCSimNumber &%P' fYou have canceled writing output to an existing sheet. No changes to an existing sheet have been made. hNo Writing to Existing SheetA@,kk' $B@H  SThe existing sheet cannot be found. No changes to an existing sheet have been made. hNo Writing to Existing SheetA@,k B@  it's a OneVarb3:b102 $%! b3:b102 $%( f3:f4 $%! f3:f4 $%( j5:j8 $%! j5:j8 $%(  AH1:AL10000 $%!  AH1:AL10000 $%( &update the histogram on existing sheetEmpHist $%BB@ 0%!'  $AL$2:$AL$ '?&the 10 characters in the search string  ,'     $'EmpHist $%BB@=SERIES( !!$AL$1, ! !$AK$2:$AK$ , ! !$AL$2:$AL$ ,1) 0%(K15 %B@Hdb3:c102 $%! b3:c102 $%( f3:f4 $%! f3:f4 $%( j5:j8 $%! j5:j8 $%( l5:l8 $%! l5:l8 $%(  AH1:AM10000 $%!  AH1:AM10000 $%( &update the histogram on existing sheetEmpHist $%BB@ 0%!'  $AL$2:$AL$ '?&the 10 characters in the search string  ,'     $'EmpHist $%BB@=SERIES( !!$AL$1, ! !$AK$2:$AK$ , ! !$AL$2:$AL$ ,1) 0%(=SERIES( !!$AM$1, ! !$AK$2:$AK$ , ! !$AM$2:$AM$ ,2) 0%(K15 %B@HkXHdelete new MCSim sheet since the user wanted output on an existing sheet &( $B@z &(<output to MCRaw sheet if user selected record selected cells ! ! ]`CDo you want to write the output to the existing MCRaw sheet called ? MCRaw Output Option$,' (check to make sure existing sheet exists $B@H  The sheet name you entered does not exist. Please enter the name of the existing sheet on which you want to overwrite the MCRaw results with the results of this simulation.Existing Sheet Name Requested MCRawNumber &%P' fYou have canceled writing output to an existing sheet. No changes to an existing sheet have been made. hNo Writing to Existing SheetA@,=k=k=' $B@H  SThe existing sheet cannot be found. No changes to an existing sheet have been made. hNo Writing to Existing SheetA@,=k= B@   @   @$  @ $%(  @ delete original MCRaw sheet &( $B@z &( $B@HMCRaw overwrite end to IFk;record selected cells end to IFk;existing sheet end to IFk; Find Time elapsed and report it 'K15 %B@H   Q$(  $( run link checker I1$(  Return the calculation setting  &(One last calculationA@Put away the form A@r Turn off screen updating &(o:x Put away the form A@ro99] !! $%$'  Your entry, !! 2 , is not a valid cell address. Please try again..A@,'| 9d9'|9k9 Your entry, !!  , has caused error,   . Please try again..A@,o88]P !! $%$'  Your entry, !! 2 , is not a valid cell address. Please try again..A@,'|7d7'|7k7 Your entry, !!  , has caused error,   . Please try again..A@,o@7  2 &!Z% GA@j  2 &!Z% GA@j6get names of cells !! $']x !! $'ts K4$( C2 B2$( HNumber of repetitions -- check]` !! '   $?The number of repetitions must be an integer greater than zero.A@,|hHk`H]x '  ?The number of repetitions must be an integer greater than zero.A@,|GkG All is well 'G%check to see if one more is availableo maMCRaw !T   (<2+1 to make the number match the MCSim sheet number is taIt was not possible to give the MCSim and MCRaw sheets the same number. You may want to rename these sheets to indicate that they were generated by the same Monte Carlo simulation. h2MCSim and MCRaw Name Report0A@,IOAttribute VB_Name = "MCF@orm" Bast0{3FEB2C26-D2F4-4B47-8C2F-E4E382253116}{F91FD8BB-659J803-AE0D-D372D2D@E048F} G lobalSpacoFalse CreatablPredec$laIdTru BExpose0TemplateDerivCustomizDOption 0licit Pub CellValidSngTest As Boolxean9= Sub CommandButton1_C"k()ADim iL ong Fixrst1 1 A@rray()DoISecondQGmyreps!PctdoneSinglDmysta0rtti@=Va0rianGA yourseng 9xmGA,, xSDmaxLinC@x22%L22mVi8ewT{mA0AllA@shistRangCC$@myendTBwB1G/, w2G ' The@ the proWidths ofbins @/ ogramjjilHjkkInteger#a!(C`MCRaw myOriginalSheet()UmyCurrentMCSim/RSLPosip myEnd 'Ge@t user`'p;@ndBk cwmake sure it's a vazh#C{Fr If=. : 'U@nload B aExit  If )= .(#.RefEditOne. ue).Pq`Gnt./bexact locNab&H as+@TI  can be%daMa Obje with allAual PUertie ccessi #A.Addr`( exterH:=!'U6error check-In 1(1," ).ula, "=", vbT `p`#) < 11MsgBox!mmpt:="p sel`CB$donot tana f 8 soqDueX wi`"h. P` ztry 4ag.s: =vbCrXcal, TitleF@Rl EaC?F!F'TQDTwog"""Hw``(By00a'1-1rq11av152 XAct|bE.&it:)&&p %&&he>O&FE&syr &&&&h&&ti&& &Q _ q'pmy_~=RqL PIgݰ[nBp7sjRnPm/SS"SaF to />cM"=duFIn09dr?--' Aဠis wj* Re7FirstAArray(1 To- Track@L`ime elapsedstartt= Now!Af' Gehe calculaA se ng ` your@%A pplic.C SA#anu0al T xlHM ' Turnf screen upd SU@1RAND for random ifquestGa @\q.Op!Buttonb='uVwActiveSheet.a.Ds.elac`h at:="OM; moLookAxlP., SearchhOrdZ_X :=xlByRows, MatchCase:=['œBFMRrG`%TrVMCSIM.XLA!&a a7ShowVPro~ss Bar 5Frame%.Visi{Ogeneral v@s not< u_` @lhist am aX ViewTa .`rLong G dle! r's BJMmore tn cx 9ilMCRalNC!1cKah"R"= #PWiYw.SelzeRo@`bt*oboyAs( > 65535OmpXYcan%have ᭸65,A ¦w4Recorc"J ok .donca0Bresult@i f`tsl Ple_ l|owd߀lb.e  .UTidtlf"T `y s=s:=vbCritKI)cB(decla}aUD Cv(>)ueSgwCouweek0Un)Pn# Each a Iny #.Ao 6C1aHGDi!my[=a+ 1#N C : ra30*> 256#Qq#b#~s)P #0r=#.!&~ccxomo^ Ex0 !)may "inadvert`Vly0j0`a 0_P`2.$*An@a:y again#ny S, #._$W$U1% add@ % "fs.Ad@z'I PP 1Ac% M2 Mlqrmak Hp4'3d'spo` Q5]0I oopensuMr woul(d g~aVlixd nPY1 `ap;I0=(continue3: 9-iiPs._B)a5p*"R" &  +8=(ii).N ,y' QKtnА1PKatt"?f7Gofy!;C_see on[!.vailm3"Mb wa"Σ soqQl it`(= 2M'+'&m1^O& #(' `^$Hb $Str`QerRrput dowy15\(sesрfQ rasCds8PHPr(_Y_Y r+[_Y[5R sP[ )\(1, )/C1@q (Zernal:=Qq i.\t Psiz`Al , ?k7q7' Run;e CarloDeڌmi(p(a OзTwo!袈S_True kk0 'initialize\ nextp @4 Each a In.AreaCa.A+ 1Q+@(i, kk;C)NA!C .a>iCpu@t down,s'den"YG2 B& wid`=9* 0+- 10 N Do Event]llows"UserU to uB! Yigd Appl@!#.W@Ps!vFunon.Max({| / 50G0\@xload aa[u requ e@]dgRaw 6 hg1cJgkk0 'init@ialize/ Lne  Each |In W.AreadDfC `a.MGA` + 1GaMC(i, k*kC _NC a aAnbi!' down sul3}o"c"i!j &CounaFD`s(@ , j| #jdi`@Get Summary xstaARA!m! Basic Four MxmeaSDxW)\G`242B2Rm!hx2b'(@a() As+Bu2hMEANSDAXI8!Copy6MCSe36kqg] 5!^s(".xla").$>"`PPBeqFe:=㎂@n'0_. LoopNumber#20 Gin`ue5: #"s.!e" :3 " &  +S").%HpEu' a}`n can't at {8us~<Gop~?e,Gq.%was tR sUse i5= a8 g 3curr\myCBGmGPutGfb0 A_ _in#10efBS(2 P2A33ς! DR}s5bfr@I6)VSD57axE8GiW2Q\PAEad{UpmyMinwBWax_y1W~fH3=xxo[)?~et*)M' / 2N/ * / o/ ) / =f * -)1.R0RSu0imorS`edg\R3`()P03$2, 0%80:tObject_Pa""^1"p2p_ AG  a2#, 2 BҠ_CݠtP>r(A0] 1 58 401_< 862l\w1p!-ASqrDCp#?1ב1?(10 * Log10@hen w2 = (x2m ax - 8in) / Sqr(myreps)Else(10 * Log10z|nd If 'Label Output Range("B2").ValuemyOneCellNamr""C "Two"I4EK ""AL1#LAM# 'make a chart on the existing sheeCs.AddActive .TypxlXYScatterLinesNoMarkerBs'add7s0erie $LoiCWhere:=xlEAsObject, [:=myCurrentMCSimS*SetSourceData :=C .maa1:ac3") 'two 'C Shapes(:"< W#"E(mpHM"D9size iNBC2E ).Lefts7).Columns(9GC CTopRow@ Hei gh-B10).!D * 13wi8dth""* 6) "..PlotArea.SelHcM.InUior,orIndexxlNonĉ- LegeTndT D tARx Gxl‡)jWigBorde&r#!o.W-xlHairljlStyloE@! Ck MajorTicktl8Min¥Positw= )' (K""Grid>s*$29P CategoryĻHasK Fa.akp+C=h-? ?d  #k TitBTr>uQbXbac@_s.TexayiricalDG Call @ogramM r2Var(FirstArray, SecondC, w1, w2, xminax2A, )P, hUZ, _#Ala ngpViewTable, 2 |(vzsAnoobsdo(binpCcerA` anualpinxrq"p#Ryn`m`qbeg AgHnoB "wT1@ isvP:ofy  MoH CarlhimulaA5щRdoz opIf MCForm0eckBoxf2 T║D4imEt" A"sian lmy= Appl "S("Pl8easT number F{ to whichresul,tss wi'be wrian. @ v܋over D alostC k0ncPif you are unsur@e.", "E RequestedNB, (_2GtMsg0 "Yphave caledoan . No [0@%op  "been mad vbInf!% }W0@GoTo fini0sh e(#Raw#W= "M"C" &m' _)PK )eI56<> "Aagep" OrS61SD"Gng\7Max\8[in"!Q["`; d pVD, },,pz0+U.in @-ls J5X:J8pWцls I5:I8.r ![s S8(h\osp#;P GnPot cJa@t3M% sI ֻXw_URerYUVw#qfWkZRtR۠RRpr@`xistingSheet = False Then MsgBox "You have canceled wri output to an e  s. No changes@been made.", vbInformation, "A6WibE_" GoTo finish End Ifrr0 -s(my#?).Sct@ If E9 {inot be foundqrr.Clear aSecondCell{""e 'it's a OneV Rj("b3:b102").`Value CurrentMCSim). \ f3:f4 j5:j8+ AH1:AL10Ap'update the hogram oԁ cChartObjects("EmpHA(Activ myqStr@we"@brie`sColl @p(1).FqulaASt Pos`!@= In(1 , w$AL$2:") + p10 'a@racters i nsYch s" @y myq,") Mid߀ -@  B.,rm,1"=SERIES`(" & ">.Name@"!*1,K"/K$A=& "Y6 Q1)$zK15L%E@JU,`co>uΙ?@冟  l5:lAfJ^$2IML@as3_"~eaLLx /.?5LdLrtLLtLoE "6L!MLLndLL SٯLngALgLKL[L)od?_OGL heL$LNLLtKRDL",L (2o pYM _ UxM"]M7/]`!q2Yp("7|Y$B:dnew =S si byuser waDDoiTruEMCRawD hif sd rrd PdlsMCp.etck1v!D im@4Over!e Aste$ge@my= ("Do yqQϳ ҂d cad s{5sPR3A+?2Yes,No@BO#OpO1+ 6 0 'ch make suremο  ӓw֖ = )"In 㙠("ֲ nq1er'doPá֢. P΀)"ofBc`*whi oresulp*withris0a"5 :Reques@2"bNumHber, 2 WR>~8]"]formation, "No Writing t@o ExisXSheet" GoTo finish End Ifrr = 0 Zs(my~Raw&).Select If E\9 Then MsgBox " evsv cannot be found. changesan 0have.en made.", vbIn>rr.Clear @For iiy1 myrepsX j MCVarC_}Cells(.+ 1, j).Value(%  5Next j iiM'dte original  Applic.DisplayAlertsFalsep)Name).DTruŀ#B 'C%overwe eIF@ rec ord s@cted cF @ # FiTiBm@lapsa@port iia: my =w>ctive B3.R("K1 5"G6n4, 6m…-startt@) * 8640̓ 3 Ŕ@,run link checkfeI1L @CC' Return thelcul~@T $ng sCa= yourseOne last9 e>`Put away an Unload$ M Tof@f scretupd -SUd`SJB/LoopNumberMCSim <>  A`:m> uBapĎprompt:="It was possibleag@>C _aEWbj`+s d n. You%y nt!ren0se#qPaq hahe ere gene4ra]b#) MonzCarlo sim$9But@tons:= TitleyBp]nSub!GPriv ` Comm` 2D_Ck()= u=CmJ B wStrTestF0irst!_ Ona€Resu s!8 D@;A A$s # = aM.RefE8ditUa ).Address(er:=AJ1004ёC`:"r try &A " , iCIa valic a`DPɠA again.`1 zid#g`t3+ⵗflbm_ l)h& h2cauSerrorc}(!Sub wS^nd1!e !p!ы!!Two!t!!QB/)!! !C~A !z!fT!!="  !!!:/!G$ a:D t(4]g6tw3'$'d:T Ntt:N 6td$0$ a` 1 /50$ a` 1/5 ll0/'T%ltF%$ aBt52lF%$  d)8okD]'T%ltF%$ a35D'$'d:Nttlt*#*F^i4/6td$]3V$ /'T%ltF%$ aBt5/'T%llF%$ aBt52lF%$  d)wokD]'T%ltF%$ a/tok]'%llF4%$ ad/$)6dX'$'d:Nttlt*#*#ll*#*F^i426td$]3V$ %$  ;:]/(T]Itd D$5D!+'$'d't:N 6td$ Btooi+'$'d't:N 6td$ "qdldp P. $   !li@% $   $!" $   !-$  "c]35U:#%:D$%%%ft%$ @ Wt%&'()*+5t-$  "c]35W:$%:D,%%%ft%$ X $  -pp-$  "c]35 '$ D a.5ld3'$'d:T/Ntt:0N 6td$!a81[X5T.H !a.[P5L.; k^p^ L.# T. k^ 3'$'d:T2Ntt:3N 6td$l$ 7 '4%'D%'T%'%$  ()pJ/$  0ld@ q4$  0lkJ#*F]?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~rU 0@ d!0/ I %%'%9''9( (!)y,,Q/a(!-I00!1Q3dy3^i44415(,(!5Y55 6A+9<!9<1@!=@@@A_<_Q6666A77a7!`I888!AQAAAAB!BaBBBBBCICqCCCCDYDD!EiEE FAFiFFFF G)GGYG!IN!MYOyOOOO P)PIP)H!Q`iPX9U9YZZZ[Y[[[[L \A\q\\\]AXqXXXPPq^9]Y^d9a ad9eeaff!91 Y  8 q `a<   @ q `D9HQLiPTXi\i1`Idqhli pq1t 1Qx 1|q!Qyp//o4A?4Q'%$ a%$ atAd `1)6tdVcT%'%$ a%$  t`1t)6tM'T%ltF%$ a:D t(4]g6tF3'$'d:T Ntt: N 6td$+$ a:]35~Cl4ZcT%$ a%$ @ d$`1l)6d$M'T%llF%-$  "c]35p!a81[5.!a.[5. kp aBlxkl`5 . .b xf 1 -$  "c]35lddk^ddlll`k%liT%@l8F%$  d%C5)5 f( f* M4@(MD@0MT@8M@p :n$ @ Qo%:T;%<:<%$  D=< > d?@)<5p/$  0ldqA$  0lk#*F]4o(o kD(T dM@ CtdBt5,lFD%'T%:D%$ ,,lFD%'T%:E%$ ,z(%(D%$ @ %(P%((%$ @ t% %$ ,  FU)* $ WVq%lCW%lCX q $ Q%Y%Z%[cH %$ ,  FWt\U)5t2 $ ,  F)7 %$ ,  FQf%]f%^c7 %$ ,  FQf%]f%^c$ , Q  pF;:_%  Fa[`,)5cv$ @ (tM @M @lM @Qo(M4@ MD@MT@dM@p a(l=.6t.,ldhxldd-$  "c]35) $ T ]2lF%$  d)f$ a% d?@)<5p/$  0ldC qA$  0lk#*F] %$ ,  FU)* $ WVppql%llCW%llCX ql $ Qh%hY%hZ%h[chH %$ ,  FWt\U)5t2 $ ,  F)7 %$ ,  FQdf%d]f%d^cd7 %$ ,  FQ`f%`]f%`^c`$ , Q\ \ pF;:_% \ Fa[`,)5c\$ @ (tM< @ML @Md @lMt @QoM@M@(M@ M@M4@MD@dMT@dM@hp h@l=.6t-$  "c]35>O (%'%'%'4%'D%:Ti%:j%k$   !f]3,3'$'d:TlNtt@:mN 6td$>:4 :A:n%$  dAt5:Do]K/$  dU)$ x yl t/O (%'%'%'4%'D%:Tz%:j%{$   !f]3r/3'$'d:TlNtt@:mN 6td$> x y/$  dU)$ x yl 03'$'d:TlNtt@:|N 6td$> xH ll04:T}%lF%$  dAt5%:4}%<$ < ddC5)<6td:T~%lF%$  dAt5%:4~%<$ < ddC5)<6td:T%lF%$  dAt5%:4%<$ < ddC5)<6td:T%lF%$  dAt5%:4%<$ < ddC5)<6tdE:TH%lF%$  dtM)5t< (%$ ,  FW`1)5l pklp.kkDkM@t t`16tB:H%$  dtM)5t:$ @ W t:Td$ @ W$ :DlF4:<$ @ C''$:DNdd: :Tt^p^6 td$ k^ >/ $  dU)$ x yl <O (%'%'%'4%'D%:T%:j%$   !  f]3 <3'$'d:TlNtt@:mN 6td$> x y/ $  dU)$ x yl <3'$'d:TlNtt@:|N 6td$> xHlddTf=k^dL\=alll`k4%li%@ $  d%C5)5 fL< fT<" $   !2l8F%$  dT)" $   !/$  dU) /:%$ @ tU5tJPQt%(T%(4%$ X dC55d;ldi%(%(D%$ X C551 F%'T%:%$ ,5%@" $   $! $ T l$ " $   !kkJkJ?3'$'d:TNtt@:N 6td$0?l0XTPL40,(hd`\p t@`h p8Plt<td$p`1T Vx$ x $ xxKVc@%P'T%t$ tad%$ P `1x)tP6d $ xtt yltQ''':Tt$ tad :@ t6 d 4 4'|'':Tt$ tad :@  xPP yli0: )tP6d |x(x4 tPd  |xKVc@%P'T%t$ tad%$ P `1x)tP6d $ xtt yltQ''':Tt$ tad :@ t6 d 4 4'|'':Tt$ tad :@  xPP yli0: )tP6d |x(x4 tPd  | 4 8@5<jx^Z#<E٥RNV>( FpOr{ {xpOr{ {E٥RNV>(ME(SLSS6"N0{00020820-0000-0000-C000-000000000046}(%` % %`h8@HH0bD!$*\Rffff*1Z445b700f4xAttribute VB_Name = "She@et2" Bast0{00020820- C$0046} |Global!SpacFalse dCreatablPre declaIdTru BExposeTemplateDeriv$Bustom izD2rU Px Yyx4|}`rU @n__SRP_16__SRP_17BHistogram"%__SRP_4<, HbD!$*\Rffff*1[445b700f*\R1*#1c8*\R1*#2ab*\R0*#15*\R1*#1c7*\R1*#d7*\R1*#31*\R1*#78*\R1*#1c4*\R1*#2c*\R1*#1f0*\R1*#246*\R1*#2aa*\R1*#10*\R1*#261*\R1*#1c*\R1*#262*\R1*#15*\R1*#db*\R1*#3c*\R1*#e8*\R1*#2ac   $0 "X 2 & . :0p  $  H `  6 2 * @ P ` " h p  & T0%2 ^G x 1`ME@( > <`< L**LL0 `@  `B A`D %`F` ` ` $`  `  H to  `J `L  x %%`N |  @ ``h d(18 ` \Ca  Xge)%  0P`R d` @` `  `#k'' ) 08igure ou )pxDie $ X)dy Amit = 10 I (xx)I < liI  limI$ 8t = ):(px / 2ame  X),seIf mul `t `p5`@8llt = X`&(k@I `lt =I rray`:x 8`'Dk I:  ol ``),k8I XI8 `Xx`t! ``*+I e thI (mit I Hlt =I hI 8Id @`(x `+k,,I  (xx)I @If `ht`jl` d`\`T`lL@5 r(%`nJ8P@h `8 @PD @h4 @$ @  0`8H@`(PhPP x@8 @ @ 40@ @t @d the@T st @D @4 @(0 !le@, mns((5 @h( @$ ` @  @ ,co@ ns(1@ @h tObj (=@0 HE@ X0E0H@ @ @ eighhlZTN` `hi@ `(his@  `h@#P8`8%h @ `P@ x@` 9@ ` ` (% pP    H 8 !P"8#P@ @  @x D40@l @`T x8{@P `{Long@L stsh@H  @D @4 obs @$  @ @0 al@H x @` @x  @ @! `@ @ 0@@ G X @ h@@elVa@ name@  @ @   @0  H  @h  X 0 0 @ |  h late@ x ion8 eetnam @ t she! Funct@(!p dom.! x@! @P!l h!(!@x"h x!P!!P!@!` @\ *:lZTNTV`@!X ` "!@ "T `@"!te"P8"`8%h" "@"@ "P"@"<`"x"@#, "" @@#(`#"@h#$ `0#"@ X## @`#@# @# ` #h#! # (%@#`h#%xx8%$0%$H%$`%X&@$@$\ @$X @T  @%D @%4 @$ @% @p% %%H% @%  %p% @ @ (%p% @& &%}@8&  (&& P&&@`& x&8&@ &`&`&" `@h'8''@P'h @X @'H 8 @'8 @( h(((h(((@8l (h(<(@(\ @L @D x)))*@)d @H*T @D @*@ (*)@< 8** * @, Hh0++@+h @`+X @H+H @+8 @( -@ `0x@h,8,,@P,8 @,( @, 8@, @ @ *  * 8@ H X "h        (  H X hx       (  ( 08@*H 6x  D  (8HP` p&2 6    0@ H   X h  p                 0  H P   X  h p x             "     8 @ H P X ` h p x       P $ $@ h       :    (  0 8 @ X ` (p   # #  2, *P  p   4( >U "+0<gX$   V 8 :X (  "+"+( P` h$p ,       0 P p   $   " &0 X x $    & ( 8 X x  $   " & @ ` $x    *  $( @P 0 / T 2`7p7 "202 ! & HP$DX7 $ > * (08@H P @p , " F *P   ( " 4 2 HP F P P0 $      ((( @ $H ` " h p H( *p   (08@ H`hp4x( 40  h p  (   T0             ! !!!0! :8!x! ! !! ! !! ! ! !! ! " "" 8" P"  `"p"x"""""" """##0#P#X# `# p###### # # ## #$#0$41P$ $ $$P($>U%"+X%<g%$% %% %5&6_ & X&x&&(+& & & &"+'"+(' P' &`' 0' 8' '( (0( #H(#h( 21( (.+(.+)0`0) `) p)6_)) 4() >U* <gX* $* * * %* *5++6_ +X+ `++"++ + ++ %+ ,(,0,"+H, p, , ,"+,J?, -$0- X- x-- ----- - - ./. 8.TH. ..9@/ 2`/7p////7//// "/2/0/20 !0 & 0H0P06YX0060 *0000 060 *0111 1 (1 $H1 "p1 "1 $1 1 2 72(202 82X2 >`2 *x222 222222 $2 $22 3 3 3 (30383 H3P3 X3`3 h3(p3(3 3 $3 3 " 3 `3 04 B84 4444(O4 4 /4&W5 85  H5h5 55 5 5555 5 $606H6X6p66666 7 /7&07 P7" X7`7h7 p7 77(77B 7 ,77 " 777  8 8  808 H8 X8h8 p88 " 88 8 f8  9 89 H9 P9 0p9 9 09 99"9 .: @: n`: 0: n0; 8; ; 8; ; ;<" < <(<0<8<@<H<P< X< h< x<<<<<"<$<$<$<$=(= 8= H= X= h=x= == == ======#=> >@> P> Histogram 22 October 2002 Routines modified 8 Jan 2004 This revision: 22 Feb 2004 Contains NewLimit routine, which does a better job of finding binwidthch and starting bins for histogram' Sub Limits(minval, maxval, Width, xx):3 Establish adjusted minval and maxval for histogram~ Sub HistogramMaker1Var(values() As Double, noobs, Width, minval, maxval, histsheet,' histRange, ViewTable, AllLong, number) values(): data array! noobs: number of observations  Width: binwidth minval: minimum value maxval: maximum valued Mi/ histsheet: the sheet where the output is to goel+ histRange: the Range where the output goes do no# ViewTable: include Frequency table be an AllLong T number:s 7 This routine determinesEx Width: this is binwidth xx: this is the starting value]]re] t ]8 ' absolute value of minimumThe d''  not   se e Bring xx back above absmint on w   t to  ' Mp6  're xx = 9 * yylation '   Nam  '  '6! We're done: xx is just below yy   ed wr   to  'ee5 ''  ave   h  'o  'A@P5   '! We're done: xx is just below yyk5k5d4''k4   'This is the differenceh0 Next step it to adjust width so that it is even' the default;   Var '6we're going to have to lower xx by 10*yy if minval < 0f3:f   %   '43   '   '$  '3  G    'j0/ Next step is to get the Width to be reasonable  Start with original width]Ph'     '  '' e @''d2 ''k`2X2 'dH2   '  '' e @''d1 ''k11 'k1   'dh1 'kP1kH1o@1 Written by Frank Howland] ]8]P The bins]]]]]]H]]]]]](]@`]I Get the variable labels--this routine may be unnecessary if public worksDim Varlabel(1 To 2) As StringCall RetrieveLabels(Varlabel)varname = Varlabel(1)]]   ']]0]H`4 This code checks for zero width (SD = 0) histograms ' 'd.   Ak.   '     A     :  ] 8$$     $:$A 0 %!'G jNo. Obs. ,$    $  G +j8  $ to  $   , $   ,G   %   %$.ge.C !DB@is !'(18   G 'j x(myboOSet myboxRange = Range(histRange.Cells(17, 3), histRange.Cells(18 + Nobins, 4))3)Call PutInBox(myboxRange)4 Is this right or should it be histRange.Columns(3)?@ !Columns(3).ColumnWidth = maxwidthk`+& %' @  @$: @ % ,( @$ @ & ,nt @limit ]P '  G 'j& Figure out appropriate starting point 0Dim limit As Singlehenn'Dim mult As LongliDim oldy As Single limit = 10mult = 0IfIf limit > Abs(xx) ThenWhile Abs(xx) < limitame  oldy = limit! If mult = 0 Thenul limit = limit / 2mit  mult = 1mult = ElseIf mult = 1 Then  limit = limit / 2.5  mult = 2 En ElseWend limit = limit / 2y M mult = 0While  End If Wendim If xx < 0 Then limit = oldyElse  While limit < Abs(xx) oldy = limitk is s If mult = 0 Thenul limit = limit * 2mit  mult = 1mult = ElseIf mult = 1 Then  limit = limit * 2.5  mult = 2 En ElseWend limit = limit * 2 old mult = 0  End If -li Wend# If xx > 0 Then limit = oldylimit)End If(If xx < 0 Then limit = -limitimit: do same for valrange if it's less than abs(limit)-abs(xx)*Then add the valrange units to lower limitHistogram TitleEmpHist %BB@ 4 0(2% %  & %$>  0B@< 0!B@H@ l 0%XT9n9pq$ Z 0%X 9n9pqX$ 0( 0!LB@H T N!P(R 0!LB@H NB@  ActiveChart.Axes(xlValue).Deletes  09r Histogram of 5t!v(dq# l 0%Xkboo 9 $9 .MajorUnit = tickwidthq@# Z 0%XB@Hg N!\Need `9^ T9bq# N T9d T9f T9hq"Dim chartName As Stringth9 **** Need to check for other charts named Histogram ****&chartName = "Histogram" '& Varlabel(1)st ActiveChart.Name = chartName Varia@ Count the number of chart objects and then just assign the last$Dim rowH As Variant, colW As Variant = his!leftC = histRange.Columns(3).LefttopC = histRange.Rows(1).Top +.rowH = histRange.Rows(15).Top '.RowHeight * 14Coun,colW = histRange.Columns(10).Left 'Width * 6heet.CAhistsheet.ChartObjects(histsheet.ChartObjects.Count).Left = leftC?histsheet.ChartObjects(histsheet.ChartObjects.Count).Top = topCisIhistsheet.ChartObjects(histsheet.ChartObjects.Count).Height = rowH - topCIhistsheet.ChartObjects(histsheet.ChartObjects.Count).Width = colW - leftC %B@]h !' d`' kP !' d0' k   !  9alues1 !  9obs1, q %B@HoCall HistogramMaker2VarRev(values1, values2, publicnobs1, publicnobs2, w1, w2, MINvalues1, MAXvalues1, MINvalues2, MAXvalues2, histsheet, histRange, ViewTable, 1)' 21 Oct 2002grA In this revised version I use the methodology from HIstogram1Var$ for setting limits on the histogramhistsh] ]0 ]H  The bins] ] ] Dim Nobins As Long] Dim histsheet As Worksheet] ] ]X ] ] Dim noobs As Long] ] ]0 ]H ` ) keep track for scaling purposes]x   0] ]  n ] ] 8 ]P h ] ]  ] - Find overall max and min for the 2 variablesll R "'MsgBox histRange.Addressme & " G &'j $' ( $ G ('j! Call RetrieveLabels(Varlabel) myname1 = Varlabel(1) myname2 = Varlabel(2)M Same as HistogramMaker except adjusted to accept two series on the same plotth a] First variable ' $'<dX "  <A k8 0'  ('>d &  >Aogramk4 Choose the larger Width as the class interval Width'N    *******L 'J'dx 'J'k` " $ 'J'k8 & ( 'J'k1 This gives us parameters for the first histogram < >  <'Ld > <  J'N > N J 'L L < G L J 'Lj8kPdH  >'Ld( < >  J'N < N J 'L L > G L J 'Lj kk J    'Jd'Jkxkp $ L '  J ':> :8roblem :X to  : 0x : 2$$$  : J L$0$2A ]   : $  G +j>avoid rounding problem  $ to  $   ,) $   ,   %   %$.B !DB@: !'   G 'j  $D( & % :  %$.seCall PutInBox(myboxRange)k  :, xx2) $   , togram :$'B @ : @$0 @ % , @$2 @ & , @ 6 reset bins for second histogramL*Call Limits(minval2, maxval2, Width2, xx2)2 This gives us parameters for the second histogram ( L '  J '8 8  8(8 8 4Hum 8 6h$$   8 J L$4$6A 8  No. Obs. in $H , No. Obs. in $H , % %$(P 8 :  why is this column 4? % 8  %$.,  : 8 $  G +j  $ to  $   ,bo   %   %$., !DB@ !'   G 'j   ,,   $D( d % :  %$.kCall PutInBox(myboxRange)  8 @ $   ,  @ : 8   8 :   , G 8k  8ure ou $   ,h As S k @ 8 @$4 @ % , @$6   @ ' ,?* (Width1 / Width2)4 @P 8$ B G 8$'Bj'  Figure out chart scalingDim tickwidth As Single ]p : 8 tSou :'Rdh 8'RkX & %'De.' %'F38 Put in the chartEmpHist %BB@ 0 4 0(2% % R ' %$>  0B@< ActiveChart.SetSourceData Source:=Range(histRange.Cells(1, 37), histRange.Cells(Nobins * 2 + 3, 38)), PlotBy' :=xlColumns :8 ! 0B@6F 0!B@H l 0%XB@9n9pq  Z 0%XV9n9pqX  0(  0!LB@H T N!P(R 0!LB@H NB@s2 < 3 ActiveChart.Axes(xlValue).Deleteor 09r Histogram of D And  F5t!v(dghq  0%B@H  N!\ = x9R T9^ V9bqH  0%B@H N!\9R T9^ V9bq  If Nobins2 < 30 Then With Selection.Border .ColorIndex = 57T .Weight = xlThinB@6 .LineStyle = xlDot End With End If l 0%X L9 B9.MajorUnit = tickwidthq Z 0%XB@H 9 N!\ `9^ T9bq N T9d T9f T9hq` %B@6 %B@]x( !' d' k !' d' k  !  9 !  9&!Zq %B@Ho`Y Usage Call MakeBins(binleft(), bincount(), values(), noobs, Nobins, Width, xx, x(), y())< This routine determines the binleft() and bincount() arraysb]]  AX   &!Z%\+Dxx   $   + $  &!Z%\ +   Put data into bins@ @ @+:' $ @$b  G^Fj  'X^P $ + @ Get coordinates for histogram$+:+  ':  '@  $ @+: $ @+ $ @ +: $ @ +   $  +:  +o]': :  % : ': :$8 'op :$<$@$<'8i@]x]0'  0.'8   0' k (b8o]Dim statRange As Range`Set statRange = Range(histRange.Cells(6, 1 + whichseries), histRange.Cells(12, 1 + whichseries))statRange.Select ' If AllLong = True Then) Call FormatSumStats(statRange, 0) Else) Call FormatSumStats(statRange, 1) End Ifd0   '( Call FindPrecision(width, precision) If AllLong = True Thenh Set statRange = Range(histRange.Cells(8, 1 + whichseries), histRange.Cells(12, 1 + whichseries))) Call FormatSumStats(statRange, 0) ElseG End Ifkg Set statRange = Range(histRange.Cells(6, 1 + whichseries), histRange.Cells(7, 1 + whichseries))1 Call FormatSumStats(statRange, precision)1 Call FormatSumStats(statRange, precision)oH:]`]x]]]]]0  ''nd9'nk9 $8'h $8 h 'j?$8'@$8'@$8'!@$8'l h'  j  j  j l j  'd8 'k8d8 @'k8d8 'kp8kh8   'f f n'f nG f  'fjo88{Attribute VB_Name = "Histogram" 0 ' 8422 October 2002&Routines modified 8 Jan>4fThis revision: Feb 0 Thenh<' Brw!backoveC%Whily >sG= * 1`!apWend"/j'B9 y`b%nig<i -%B iL A' We'`done: `AA!low Else**  #'" / /4A$+$A_bM%F(-)j+)EIf%-#bI[k=T ?` 'C`8ydiff@nce!NextҸep C ‰h so@a@evvAfyPAp" efault; =B>c02wKgok`haj@Kby a2* if= < $xcA+*;8-RH @*'PF4 &2= --$xy' Ds 0get0etbeason`SVth originalۥQWmQSyPX{ 2= 1C<]=*1A / Ж5tWYCe.5[T(2 t ,4%3g#S# <Q1  e*lq 101 1pa   U0 > 1}ନ 4>+'QP@-"dTi@є@V,erHWrin NFrank How~lຑ >(%jW%left}'4c8ounUMin!Maxaom my GWorkGXgyo!choiceQ colOPWgPvarn@ S0ng4Nosp\co`Rble, xup As Doudown D im yy Dabsmi, myboxRangeV ' This code checks for zero width (SD = 0) 'tograms 8 IfAen 1= 1 xx9maxval ElseCall NewLimits( ,Px),nd If rX= # - xx !DriveFormat ting(>, Nobins, AllLong, ",a|, 12 \Releft(0 To#couPnt(1X2 * + 2 !y?TaOAmWaH@BZDMakeB>(2x), ,Bue@FnoobJMxx, X( Xy(),F=M.Cells(18,5.Column'BView0@}TrueB6 H4) "No. Obs."Æs| iHXAa@AbsF7i)) < 1[10 ^ \-6AnLThen q  Next :ic'Ȍ17, 3M18@2-R4P'}PutInBox( ' Is t` right should i0t beWVs(3)?CX! "O _Ernamne8!Xj` T2Ma *j27aQX(jd Y8AyF0jtickC7 S@l =Cbv- > 5ga ' Figure out appropriat@e star PpoinN'AlAmult@oldB#@ w'@̀@SC> axx) Whil@< 'aB =a]'' $ / 2)g g .5S )s' 5 ?|U,rWend z< P+><DAH!%s*eO=  /P >dyoc-R!d8o sQIa ifO's lesQQan (2)-2]addSef un`o lower3HiBs TitEActSheet.ChP@ObjeBc"Emp").2`BOTypTxlXYSc`erLinesNoMarkn just assign0lastBDim rowH As{iant, colW&AleftChRange.Columns(3).L&top! "Rows.Top5= D5) '.Height * <14E 9109 'Width 6,sheet.O( _#= o!o~ ==c- D=Cr-E6 ADnelle, 1).ate subLongBIfp@t>1 Then  @ = 0` ElsJ1@@If vFWiWindow%H .ScrxollGE3-` )S -[ME:$N(q/Sel`uaS,ubA FMaker2`(values1()3Double, 2noobs1, 2, BBminmax"A" i,>, All!C E`Vie8wTaCallRev%, picn+` wwMIN@ , MAXga`(1)' 21 Oc@t 2002@w Iis revised version I useBmethodology f@rom HID1@4afor setting limi !K-miEmGjObini,"I"o!U' Fa  !:2pUriMS cg1e'MsgBox8qAdd8res@n2 < rG}D=A DQcY >TbQ AHWReeveLqs( JYm$!=82U(v2Sp$] excepdASto ac"two0Qries ŴPs!plop^is1&r va3‚10CFA3NewLY(qp !xA3 iC3~2c!pF2wq.=O= 0  1 $*-Xth  _\ ar }gsQ`| paepsXfi&y7$" b-_ eg &OTp;In1 phll D0  ,E&Y@s 83>  (]K- minval) / 2 aElseHhoverallWidth = 1nd If E .ranDgeLmax1H - ~xxDN@obins1@Ihnt(^/%e) +f/lReDim 9left@(0 To H) couW1! 'x1C2 *G82) As DoXubl~;YC MakeBn(T),YIv ues1(noobs1,>, xx, UA)umyƆW4, wЉ yb8oxRȀ  If ViewTasTrue ThenHFor| iIPCAbs7i)) < 1@Q10 ^ L-6ii)0 'avoid rfding (promhistB'.Cells(i8, 4 Si1) & " to&m5ci4Sxet CB @,(9$, .Columns.AutoFitG+q~=H D xG @^ >gzmG=  N`ext iD (|4);a!mɇF= s!17a3 187s, 5!V!,'cPutInBox( %ŇeO{.2, 24E0*E0 IIC jۉ[2 j37@ujDe^8azej'0 resRs f`qseco 0ograf)Limits(C Fxx2`' ris gives us pa!`eter thde / @ 2븃'2%'6?%#t% x2-56 #`+"D!92!Y2xm\1""No. Ob s. inbVarlabel(1 MA6!MWF/bOO>).WrapT!FK0d  >ue' w(hy )t cbQ 4?Q H bHcH4HE 1a=Gtq1P ononincn7 mpmIia?j?jQ rso#q1jjqgjn߼j jxja1Р00w]q?nQ˭'''geo6'Ymo4t)OG="-P.822{1nȳwws7t(1`Q| |2(|pT9|;(3Pԣa) '* (11@W A0e?Pl"3P=u ' Figure out chart scalPtick;6SṕnbsLong231f[y"=\e/mynameA] 38/SA_ 39P `1o Act Sheet.Ca Objec"EmpH").2ValuentinuouV+2+5 .a$If Nobins2 < 30 The@f)@olGV5`*+DotHg+bIf !"[CMinimumScab9overallxx .MabxImax#'#Uni!Etickwidth"ep$oTc-.(HairA!L>g+k "TMarkvɎ3 'oraLabelPosi<= ARange.Cell s(1, !yhow(`: Dim rowsub As Long, col[w 1[A=` 0 EϦ1`M l l h !d1cCW8indAB.ScrollRow -G4v g$-~Sub1 MakeBPD(2left()Double, @counT vys{noob&sI, 5, xx, Xy@~' Usage< C<`, i, W<x(@PHas Bu_e denm‹the $a #AarrayPb'q+preciskiAjr F`"P( ! 0)0# Appli.WorkFunon.R d(9G 'PC iP`3oDbyiqH+S`iO , NA' Put data intoq$y j BO  Doi`x <=5"jT1@sD GoTo veloop:i໗ @1LP  S25+ j)Get<in@Qs for ;CX(B 0 ycpOO412 -ahX(jYiy G @$1Dy(]2L[K5h';X!9SPinglX% Wh#X >S/tX / 12W f,-Log10(X)ytpc 0pmc_3Bp/(10#`XU#Y" ҿSps(sPw #p tr vH!$= "0" @0 > 5!.! &vS *&CxF .Numbe'P 1Dro` p[g%S!,P Allhrш,4dwhichsǴ$[ ' 7RS:= u(}v6@0!y,j histRange.Cells(12, 1 + whichseries)) B 'staSelect If width = 0 ThenRNobins(01 'tNAl lLong(TrueX8 Call FormatSumShs(n, 0+ElseS 616nd pIf >9Int(valrt /g)]LindPrecision(y, p2rSet j( 8,.B%6%7 EGAyNT{}Sub  NewLimits(xmin,C~,grt,Dim lAs Doubl@Grem a b C d neg@egefrB؁' < ؂= - @ǸO?3= Log10ò!|c$= I - a@VC1.75`$b2.2C4.d8#*= 10 ^ fa''@bTICDd\**aa*%5.E 2.HEKg`rt@0*g>BG E* `FNcG-1b{ -cei  #tAl<ot?o$ooq|o$l|ot oo? oot oz n4nootxt(ok*s4n4oq,l,pl,l#l,L#l,H1HLMl@M@,M@ll lp $Dc]3hxl,dPlxlp ϳ lxlpUlxi%(l%lxlp#L*#Hlxlp#D*F%l8D2LHD5+lxi%(l%lxlli$%l8Dglxi%(l%l8Blxi%(%l8B$ Q6$a 5aBtd5 odo\odt\ xfPp5o\kl%(%$ ` C5_(%(l%l8Bl,i%(%l8B$ QX6xl,d+lxi%(l"%lxlpk$%l8D xf} l,lpt tl,d=+lti%(l%%ltlLk$%l8D+lti%(l&%ltlHk$%l8D tf0ok*s4n4oq0l0pl0l#l0D#l0@1@DMl@M@0M@lllp $Dc]33 +(%(l%!*F%l8D5+(%(l%!*F%l8D5`(%(l%l8B(%(%l8Bc%$ ,6 l0l, _(%(l%l8Bl0i%(%l8B$ QX6l,xl0d lxlp ϳ~ lxlpUlxi%(l%lxlp#L*#Hlxlp#D*F%l8D2LHD5glxi%(l%l8Blxi%(%l8B$ Q6$a 5aBtd5 odo\ odt\%lxi%(l%($%l8D xfV5o\kl%(%$ ` rU~|  ,1lhh A+QA!BY[8iEEBCh9mAFmmqCCCCDYDDnnAn%nn!iInn oX  D4Btd (Ddbtl od$odkD]godkD]$ts$(D 4bE$(D 4Btl qTodkD]$glTqTlTolkDbodkD]$godkD]$g$(D 4b DBtl qTodkD]$@odkD]$tulTqTlTolkDb<lTolkDb (DbtlodkD$4Bt\ qXo\kD]$tW qX$odkD]g$olkD4b$olkD4bodkD$4Bt\ ol tl $(D]gD4lXolk$bsolkD]$t;$olkD]g,oltt n oltls% nol@tls% oltls olkDbolkD]$goltt n} oltls nol@tls oltls= otkDb$D4t$(D]Z (DbD4bt $ 4 ` *sD(]3E (b Bt\M@ll ok*sD((l$DM@l,ATBt6T(c]3 (%(%:d%l$Dxl %$ ,  )* $ Wq%lC%lC q $ Q%%%c$(%(%l$>T 5Tl$A(]35 q ql$A (]35 q q$ D Q(l$AliT"i%,5(l$A liT"i%,5c$(%(%l$>T5T,` ll7X @pPTpJ,($ T`p $Bt,$g- ,Bt (Bt0(tX 0Bt(]3 (b (Bt$$M@ll$  (]3 (b 0BtM@l l,  t Bt q<&  Bt q<$(3Q  Bt q<,03| Bt q< o$ol<o$too$oq|ol|ot oo$ ooC5M _(%(l%l8Bl,i%(%l8B$ QX6xl0d +lxi%(l%lxlli$%l8D xfb l,l0 l0xl,dx %lxi%(l%($%l8D xfx xl0dp3 +lxi%(l%lxlli$%l8D xfp tl0dh +lti%(l%%ltlDk$%l8D?lti4%('%ltl@kl%l8D tfhT l0lpo  l0lpt l,l0 l,qd l0qd (%(l&%l8B`15 (%(l'%l8B`15/: %$ @   5 K$ ,  (%(l%%l8Bldi%('%l8B$ %Q[\`$ , ` l)\`69l4A"`$ ,  )`52` $ ,  `)`7` %$ ,  Q`Xf%Xf%XcX7` %$ ,  Q`Tf%Tf%TcT" $ ,  h2` $ ,  `)`0% $ WC52` $ ,  `)`! $ $ , QP P pYl*#L#*#Hl*F% P a[``,2LH)`6cP6` (%$ ,  `)`* $ W@@q<(%l` %$ ,  `)`* $ Wq%lC%lC q $ Q % % % c $(%(l%l8>$5$(%(l%l8> 5l8A(]35 q ql8A (]35 q q$ D Q(l8Ali"il%,5(l8A li"il%,5c$(%(l%l8>5D|pXTP$ @,@ leStyXXp En LL9D9H.Maj,LHD`\tM\@l %O$\BkD%t@TX$  X &T@B )XT5p\"d / k4 Dlpi\Blp 5Wlp .@@t@TX$  X &T@-Blp )XT5 pf {l\"d qplp llnlpi\]D3[nlpqp-lplp lf# (,p\"d:lpqllp ll(lpll,lp ll(lpll, pf/\" 4(D($"(5&D(\(4",54($ XT\sxnxjh] Xt0 nx sx (xMh@H 'H8(X(b5H@ T\$ H8(h4,$@ (tD\B9 (oDkLl 84(l h)CxT(d]tS*Cxtd"dP < < >( 8>h     B J . $P `  h <(<]^Z0xME(> <0<<< <<<<< <$<4<8<<<9v@P @z$@4vxX`p%@l @\ @ `0>k''' D`> `|JN+2p``J b x`J u d@B `J (`J[[) 08   i X`i8xi`Xt$8`l`d`\`TMD`L+`@Jh i ihiheet H+`>J@i `i `H+h `HJ i i(J`X!`P  `TJ $)  ii!`tx`l`h`\ x `J 6`x `'`@(v`8bs, `00al, `(+ ``J Ai i  `8J8 XiPlea @ p   `8J $$e)   ` i`x  tx `  \   0 X(  0 ` T`@P  `hJ )  i i`xwher` t`p  `J d ' `\+ ``JX i x i `J.. d@B  X`TJP ):  piiiiee`~t`p`h (`8J NN): iii`j `d`~``P3\ `0X`4T`PP`N`L`J `| h##A i0 i4iiii (i$Hi(hi~, `tJd): i i(iHihii i$`x` t  `h 8 y): pxx Xii@i`x`p `J \`r@t@x(@|((@~Chp( x x  X((P(@xv~tr0(t   @p 8`x h hp(P8 xh P`p@x ` m`0 H`8`(r @`p P@` pH@@r,@P @@ 0 @ @ @   @ @ @ @  @ `l @\ L `"< @, @ @  @ @ @ xp80D `(p< (p<*|rX,  @ @  :  8 A H AT  0!!t !X@p @` @@ 0"@0"h"H"tX"p "Xp @` @@ > 8P####t#Xr@p @` @H pX(@$%r%(` @X (%T 8%`H%,X @P @H  @ @ @ X @ @ @ ''''xt'@r(p @` (X 8 ()(l (X@h @X @8 P H  *x*x*Xr @h @` @L **H **D * +@ ++8+H+< `+8 p+p @ X p,8,pl `,p,h ,< 8--`-XX @P @H @D --@ .< @, @ @ @ @ @ X x @/@/x/X/xth/@r<(p @` x0`0`,HP @@ @< 1: @0 @(  @ @ 1 @ 1 @  (@Ph2@(X @T h8P33h3`l x3(8 hHh(h(H4x85Xl 5h 66H7(7(H @8 @( @ @ P7`7 77( @ 77 @8`8p `8@ @ @ P889 @ @ @ @ @p 9(9` @9P9P h9x9@ 9@0 @ @ 93(42PbD!$*\Rffff*3J4462fc5b*\R0*#15' : &@ ,h " F \ Xh * 2 6( 4` p J9 R:B  p:x:::: Bx "        = ,0 &@ &h  "     $3  2  5 0 8 @ <H  F  "  `(  < X $8 ``  d H "` &  n 8 *P $ f  08@HP "X V .  h  "   .   0H  h "!       0 (8` x    "!8 H hpx     . B   V ^p .$ 8H "P x 6B   V ^0 .$    0HX` B  h$p    XC  *0`  h "   XC@X` *x  "  "  0H-h + B  $  > @ 4` F $ , 68 p  N 4 .  B  P BX $ "   ( 8 @ "  H (P x         !!! 0!@!X!p! ! ! ! 4!",) " P" 8`" "" " " # #0# "  8# @# P# `# p#x# *##  #* # $($" 0$8$P$h$"<$ $$ B  $ >$ >% @H%$% % % %% %%$%&  & (& DH& " &&& l&,('=8',H' (X'' <' ' ' ( ,( T@( @( 0( V) T`) V) * F(* Bp* P* B+ 2P+ :+ + ,+ , X(, ,, "  ,,,, , ,-"- @-`--- B  ------- B- 0. :P. *. . . ///  /&*8/ `/ h/x/ /// / /89// @/ $80 `0 h0 x0 0 0 0 0 *"0 1 01 @1 P1`1h1p1x1111 1 11111 11 1 B1 @2 P2  X2 $`2 2 222 222 62 .(3 4X3  33"  333 23 3 4  4 4404h4>p44 64 $5 (505 85 H54X55B55  5 56 64(6`6h6p6x6 6"  66666 66 66 77 7 07 @7P7X7 `7 h7 "  p7x7777 77 77 " 8 8 T 8x888&W8 8 8 8-9 (9@9X9,_p9 9 9 9 :4 This module contains three general purposes macros:tines 1) FMRG random number generatorev%2) Normally distributed random numberimit3) qsort sorting procedures job o?The module has an auto_open macro that initializes the FMRG RNGVTo use the module, copy all of it and paste it into a module in your "active" workbookRor, on a PC, from the Project Explorer, drag this module into the "active" project#For questions and comments, contact,Humberto Barreto Frank Howland/barretoh@wabash.edu howlandf@wabash.edu-765.361.6315 765.361.63176****************************************************** RNG macrosZDeclarations to enable the FMRG to be used by other modules in the SAME project (workbook)[To enable use by other workbooks, a REFERENCE in VB must be made to this project (workbook)] ] 6 see sheet CurrencyDoc in Random.xls for documentation] ] ] (] P] ]( Initialize FMRGizA@4 CRandomize runs on open; no need to use Randomize again in any macro 'v 'xLoad B values from p. 147 of Deng and Lin, "Random Number Generation for the New Century," The American Statistician, May 2000, vol. 54, no. 24, n]@#g+ j+tt+v+dz+ԁ+„+)+ +U +A + + ++++++٥+++++f++%Pick a B, each with equal probabilityabil]p  ' $'o@5TTo use FMRG in VBA code: FMRG runs the rng, myFMRG is the actual random number drawnnstallTo get a VBA Rnd, just use Rnd*To get an FMRG value, TWO steps are needed FMRGMC8 x = myFMRG to get the random number and put it into x5If you RESET VB at any time, you clear the value of B VBA6The If statement below runs auto_open again when B = 0 dra GA@j V8This calculates the next "random" number in the sequenceO  x v  ~  x v  ~ 't t ~'rnu v'x t'vo2C To use Random function on a sheet, simply type =random() in a cellment b( See sheet1 of Random.xls for an example &B@A@ r'2i@2;The two macros below remain for testing, but are not needed x]@BHt ' @BA@ r +Ra1   A@,$A@, PowerPC G3; 266 MHz -> 9 secondset PowerPC G4; 500 MHz -> 4 secondso 1x  A@ r': :ffffff? :H}8g? re n  ' : +A@ r +@Bk0x0op06******************************************************C G3Oct 2004 version@Copy and paste from *** above to *** below into RNGandSortModule of every workbookNormal distribution macrosZ Numerical Recipes in Fortran 77: The Art of Scientific Computing, 2nd ed.; vol. 1; p. 279 Box-Muller Method6 To use, call from a macro with FOUR parameter choices@Q The first choice requires an array so it has to be DIMmed somewhere in the macro Example 1: Explicit ChoosingZ Dim result(1 to 100) as double MUST be DIMmed as double to be compatible with NormalRNG NormalRNG result, 0, 0, 1] These two lines create a result vector that is filled with Normally distributed values based it on VBA's Rndewhe Example 2: Default ChoosingExplic Dim result(1 to 100) as double 1 NormalRNG resulth Since the default choices are VBA's Rnd, mean zero, and SD = 1, this gives the same result as Example 1a Example 3: is fi$ Dim myOutput(1 to 100000) as doubled NormalRNG myOutput, 1, 20, 5le 2_ These two lines create a myOutput vector that is filled with Normally distributed values basedhe on the FMRG routine Rnd, ]]]]] The Optional parameters aremple 3P TypeofRand, which is 0 or False if not set--this means the macro uses VBA's Rnd20' Getting the number of values requestedut]$' wa Because we generate TWO deviates at once, we divide number in two (with MOD handling odd number) We waste one deviate if oddters a P' Use VBA's Rnd to generate random drawss  es VBA z(  '  '   'ause w  Gj $< $*' handl  '|)     +'zd( |   +nd to 'zk(  d(" Use FMRG to generate random draws   zA@ ' r 'A@ r '<   '  Gj $< $*'   '|     +'zd@' |   + draws'zk' zk&o&'This is the old version of normalrandomDefault was Rnd(O To use NormalRandom function on a sheet, simply type =normalrandom() in a cellW The 3 parameters can be set, eg., =normalrandom(1, 100, 50) uses FMRG, mean 100, SD 50( See sheet1 of Random.xls for an example &B@th]    A@$'ih%This is the Feb 2004 versionn on aIt forces use of FMRGando/Also forces explicit declaration of mean and SD.,O To use NormalRandom function on a sheet, simply type =normalrandom() in a cell eW The 3 parameters can be set, eg., =normalrandom(1, 100, 50) uses FMRG, mean 100, SD 50( See sheet1 of Random.xls for an examples  &B@]  ecla'Error: SD must be >= 0Pd#SD OKunct   A@ t$'dokX#iP# &B@s ]8]P  om(1'Error!, med"      $* '   '$draw a random number on 0,1 intervalA@map to computed interval r     'k"i"h](]@]X$'      $* '   ']p   a ran$draw a random number on 0,1 intervalA@map to computed interval r     +P o ]]'$ A]0H` $*$    A  HiA@,o x &B@A@ r     'iBarreto Mar 2002in7myTInv takes a random draw from the t-distribution withdf degrees of freedom-This is based on the definition of the t-dist?t=z/Sqr(y/df) where z is standard normal rv, y is chi-square rv with df degrees of freedom %See, e.g., Freund and Walpole, p. 27002/Many Net references cite Knuth, Vol. 2, p. 130.onUSAGE:Two lines requiredHDim myArray(1 To 10) As Double CREATE AN ARRAY WHERE T DRAWS ARE PLACEDer.TRNG myArray, 100 CALL TRNG WITH ARRAY AND DF (Example provided in TRNGtest macro below.,<Used to draw a single t distributed variate in a single cell 2, p.User provides df &B@s ]X  To 1DF must be greater than 0'E T DRd  A@$'0 kxip "Get number of t deviates requested]0 $']H   e t di A@ s]   provi]  H ]P ]h  t be g +' A@ @ ' @$ @+ $ @$ + @ -create t distributed deviate and put in array   $ $ $* +  1Uncomment and go to Test sheet, then run TRNGTestFor I = 1 To UBound(tRand())@+Cells(I, 1) = myzRand(I) Cells(I, 2) = myyRand(I)Cells(I, 3) = tRand(I)ibutNext and po ]@ X $'$']p    $draw a random number on 0,1 intervalet, thA@map to computed intervalun r$<    +d(I) s(I, 2o ]'  an$A ' $   ,'  o 8 This is a quasi-Exponential random variable in which we7 take lambda = 1 in the standard defn of an exponential9 and adjust the mean and then scale to get the desired SD &B@A  'Error: SD must be >= 0"dSD OKA@ r$<    'si-EkiEnd Oct 2004 version8=*************************************************************djus ]@B to get 'eNormalRNG NormRand:=result, TypeofRand:=1, mean:=0, SD:=1 ', is an alternative way to pass arguments A@   A@, $A@,!PowerPC G4; 500 MHz -> 17 secondso06******************************************************Sorting algorithm Thanks to David MaharryG Aug 2000& quick sort of array x which is x(l:r)ternM l stands for left and r stands for right, but it's the same as top to bottom : sorts array x[l..r,n] using the mth column for comparison* n is the number of columns in the array xO m is column that will be used for comparison (that is, m is the sorted column)rrM Barreto made it sort decimal arrays by declaring several variables as Doublee saO If you make the temp variable in the swap sub an integer, you can see what theon code is doing. o? To use, call qsort with the FIVE parameter values as describedri< 1) The array to be sorted. This must be DIMmed as a Double.t deciI 2) l, stands for Left, or the first row number in the array; usually a 1< 3) r, stands for Right, or the last row number in the array+ 4) n is the number of columns in the array FIVE 3 5) m is the column that is sorted from low to highsorted Example D%Dim myArray(1 To 4, 1 To 3) As Doublefor qsort myArray, 1, 4, 3, 2Q This sorts the values in myArray, which is a 4x3 matrix, using the second column%Changed declarations to Long Mar-2002 in ]](]@ :   $'~rom lo ~ ~ $:'( :      Ae :    A :    Aes in k0o(X]8]P]h]]atio]< found is a check to see that there are at least two unequal~ entries in the list4 ptemp stores p in case median of three method fails  $ Incorporates median of three method Reference is Sedgewick t Help from Dave Maharry p FHth' '    ts  $:  $:Va'  '~d8  'k  '     $:  $: G  'jk 9 ptemp is needed in case we have three equal pivot values in the median of three method      $:'0  $:'4   '  $:'@ 0 4       ~A east t  0 4 es i 0  4  sto '~dH '~k8 d0 '~k 4  emedi 0  meth '~d '~k dF '~k k < If check = 1 we assigned p already in the Check for smaller  routine d` '~ If x(p, M) < x(p - 1, M) Then p = p - 1 End Ifk d '~ k G '~j/ check2 comes from CheckforSmaller and tells usqu( that all three x1, x2, and x3 are equalme.If all three are equal just use the original p ~'i ('', This checks to see which element is smaller June 2002 FH  0 4 0  '~% pick x1 because it is larger than x3dH '~0 pick x3 because it may be bigger than x1 and x2 0 G'j0 This says that all three elements are equal, so we need to discard the result thek 0 e 0 4 '~% pick x1 because it is bigger than x2d  '~4 pick x2 because we know it is bigger than x1 and x3k 4 e0 4 0 from '~ pick x2eld '~& pick x1 because we know that x1 <> x20kPdH'k8o0]] ' '   0  $:  h  'll  $: e2  ' d :   A   '  p  ' ik`X 'oH]]  igger  $:'0 @ $:  +:says  @ +:ementso read in the dataM the array must be DIMmed as a Double to be compatible with the qsort routinese i]H 4 p @know i  @$!   @+ use qsort A@ Output results b t x1 < @  @$  @ $( o@CThis function will NOT recalculate with F9 or Application.CalculateLThis function WILL recalculate with CTRL-ALT-F9 or Application.CalculateFullp &B@A@ r'i881Attribute VB_Name = "RNGandSortModule" ' This m< contains three general purposeLacros:l1) FMRG rom number`torB2) Normally disd 1'3) qs ing procedures Thehas an auto_open mat initializ=t2Nx!o Xuse%,upy N of it+d pasinto a:in your "active" workbookNor, oH PC, fr=Project Exploredrag?1*{WFor questioWmments\ct>HAUBarre  Ffk Howl bC h@wabash.X hC f@ 765.361.631n57.'~*2mv@"DeclaraC@:enabltzbexd by joVros@~SXAMEBf(p)To \a REFERENCEVB must maZd!ovp IPublic myA)As Do@e Int Curncy ' ssheet DocR@som.xls fဉdocuAFOlag1) 222BbLongfISETege[|dGECVt p@2147 48364DSuby(0 IFxbL C@z 'Gru@b`n; no need @7ag%any9cI 0"= Rnd * 2 ^ 242`'Load B valsc}p. 3!De3 Lin,b4 NG¨aW"6~New Cyury,"@e Ameri2cSt@9 cia@ May 2000, vol. 54,@. 2 Dim BArray(1 @XH25). )aa/6403F= 27149F @981 403022 = P313363(236f 7C98G8B4601B9B6098F10c181`(667136 84h"3709KEC787hc961 408540p4217@Ee 4(245g 24319G'2436j924 2A445302a4567h4633` 'PickB, each with equq{robab ility"myX1";f04 +z 0b # 9EP2:Ya;L;P'A7#MPrVBApjde::.rng,Pp!t ۃ@rwnXgpOaA1:, jVg9 Xnr9, TWO P|preAedSQ xX`CR 3;``Px'If`OP`pEtime,clearwfAB@1s =eZclow L׌#KwhB 00BnRrcalculatDnext "]S"E s0!encgfP@(bPcpQ2 -tR)mp@(/ p@## ?OV' qj(FunP`_(;Og'P) f#a sAu, simptypPa cell"S%x1qcvwZexa0App0~x.Voi(Trues'= U R"1 will N`OT reV=Fl9 ICe ^WILLCTRL`-ALT-FuQNV?Fals NVF/'a1twoE1\em{`-t, bu 9@cond@'4; P%4'/egraphqWh&i < 1;0C X % PDX > 0.7 A\fX00F Ѽi`C 0s(i, kX3Blu If Wen0W -)*O@4 vers |Co Cۢנ 0abovbeQV ] A=ey`C'* (=G, OpwTEofQwBooas0MePD&S>DL$l Recip^J+Bt. 77:#rt1 Scientific Computing, 2nd ed.; vol. 1; p. 279 ' Box-Muller Method XTo use, call from a macro with FOUR parametrchoicesphe f irst  requires an array so it has to be DIMmedmewhere pin tFoSExample 1: Explic>ChoosDimfsult(1S100) !/doub pMUST4 @c1atinNormalRNG.1, 01These tw o linqcrpeatexG @vectorfat isd+ly dist ributvalu#base' on VBA`'s Rn2: Defa1'Q3Sinc1@\.dske, mepzero,sd SD = 1,@76giv.msJao 3:AmmyOutFn0 o G` ,2a5a aFMRG roe/V1 As DB B2MRadiusMFACi 6 Optionalr ' TypeofRand, which0 @FalSif not set--th4!8on@=y`|s)LaG et:e numb{of $Sy|es@Uc( $= UBound(c7())A&eca we genereTWO` devi``t ^c` divi.d@m(tMOD`ndog o ddd ' WeX wa e ! Ifh'נX%In! U@'nr@-`drawF-ia` CB ISET0  rep : F= 2 *Az - V2:J= 2^ + ` /@>t Or  GoC"AaR= Sqr(-Log(q) /,!Gsc* c=i)@`b`@+a+$`ETq *A0 E IfNex`c`b 9v8oDHq8$  Ae!:my"2;T=Y7 _>/()2 ????? ?? ߻? t?iY Sub1 'TNNhold_rsT PLn}S<"5tBvFuncV >Adv(FX'WZPBool@q,GZM1rP 0f)y^`\3–: f a sheet, s"ipy t`_ = ()Aa ceLll/G 3 cc{`, eg.,P|@, 5_2a* 5 ' See1]om.xlP@e Ap`on.Vol(TrueDqr%Vq I1DlNG,oq,B yH0!#~#Feb 02004#@It for`<'Alexdecl౲$p'$ G&ORMALRANDOM(#"4"d i""Q/"e""al"" "n "Ќ""Q"9Tqw"Po< wDNh ""L'Error:  mu/`SqF6i'OKD$(u(?y+(1(Al("Uni%m!DD2OH#aGq8b  T!vb(1r,+ 1) !k- 4`a 30)70Pia- p]Qtї!֒ 4{p1PP谪:8mapinx* (b0a) + afU gE@(dS,'aLong formRand()) b = (2 * Mean + Sqr(<) ^ 2 h- 4|(<3)SD:) /` 2 a- b Dim i As Lon@g For= 1 To number 'draw a rom on 0,1 interval aFMRG 'map to computed .HUnii)myAbja)wa Next i End Su[  Test hl10)zDouble CalDl NG( ), 10, 2.g, Max+, Min3BasicFo= gs2@OK()~&&&>Qu2u#awOct4 vers0`*-VcN(",resulth,00Z rtthimeT``''g!P:=s, Typeof3@* :=-SD:=`1 ', Palnative wayYpasrgu1[sdf{?zdǢ`< (9 'PowerPC G4; 500 MHz -> 17 second@!SU'_!Sort algor@`'anksDa0 Mahoo' 8AugQ16ic8k s02 x`5Px(l:X l P (lefnrYri ghnp it'Ӱsaaqbottb" x[l..r,0n] u7 mth column formparison ' n is the number ofs in`array xXmXthat will be used (B0is, lcsort(A) SB_eto ma@de it # decimal {s bylng severvables as Dou OIf youNketemp +iswap sub antePger,cspee wnY(coLs doin$g.ZToy, caqYwith8FIVE ametvaluRdescribed*1) T;p #ed. mustDIMmqarA' 2) l, standsLeft, firrowr;.u-y a 1"3) ?Righla4)eA 5)ǃ -U a = X(p CaMyPartiG pv, k, n$!k - 1U( E0If @+a1Func-&,fou 4Boolea A/i,OmidHdlex1e,h x2h3e checb:I"Fpb$' ^a ks3re`t `}twneqsEen_listEsto rp!case ithr hoailsEIncorpporat@EReferenc`s SedgewickHelpDavemh2yFH#9= Fals@!Vi@`lWhi`5* A?i < rC@cX(iYc@ +Wmda Truapi! EFA!^AWen!1= i @w( >P_he\5J@rmgqAЃdpnj := 0\1 >CN3_5r2o+1,o '=3/A1O6 Q:  O ?p&'A'1 =assign>p already<. s.' routinO Gq1M)Wxҁ)'p bl}-0P2?F 'Cu2m`lҫ,@`d tells 'ђR%Bм 7ayw's jp¨origin@pя wP P1U< `J(@ '*#wNNJ@O0 =rAelem0v''June C' A `0_7#C@SPl, Pn beca1p oPnPC&#E3@܍Fmbig1!xq1F 7%25'\ sa~y7"pe$,%@ so ' we need to discarPhe re0sult(End If ElseIf x1 = x3 Then@(> x2(pRl ' pick8because it is bigger than;ld @r@2 @!knowH1 rax3O_2_2 _1_>(PqPnt}=w - Call swap(X,'@N$n>?S(HmWendCkAHrr qFX, j[|, jhrClt8emp C{For A [o vb= X(@*kh`X(j, K@ Nex ABT Dorttesting( '`ad in}e data  'barray must`{ DIMmas aZabe compati\ wi$thBqs rDou e  myA (4, 3d !i@{Cg$jeE #j)`Cells( 17 SB.Valua) ! cd , 3, 2%' Outputs `5) *4a*6a5\'\ ϳ5\#gD jDttDvDdzDԁD„D)D DU DA D D DDDDDD٥DDDDDfDD'\ p>5\k>D @P8D\0   0   0 p  0   0 x  0   0 (  0   0   0 h  0   0 x  0   0   0  0  0    0  0   0 X  0 ($  0   0   0        prU 4$`$`$` $`$!`$I`8q`!9k0` !9 ,`!a"     !#^]%='()*+,-./0123456789:;<$>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\_`{cdefgpijklmnobqrstuvwxyz|~9 ++, `!9 ++4 ` 9!9k++$9 `,a `Y ++( `i&0`yik&4` !9k++$`,)`!9 ++$Q`<y`ak((((8`ak(((P`$ !9((((((&&(H `aQak((+(((81`aqk((($Y`      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXZ[\]^_`bdefghijklmnoqrstuvwxy{|}~rU~| !`!%9Iol ˀ Lqx L kLb L kLb Lt dDollt tl4lt kL]glt kLb4lt kL]tlt kLb tfDYollxkLbtl Lt d7lt kL4$Btl olodtdololo\t\ tf o\ododlx춯lxSDModule ?#__SRP_8:__SRP_9"LinkCheckerModule$}  N  P ` , "  F ( "0 8 H `  p x    &    Source:B http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf.html4 A clever way to minimize roundoff error, especially|> for large samples, is to use the corrected two-pass algorithm F Given an array of data(), this routine returns its average, Mean, and it  sample standard deviation, SD.? I took out the skewness and kurtosis calculation from the code The SD is the sample SD.% The Population SD is Sqr(n/(n-1))*SD Barreto Feb 20019 To use this macro to get Mean, SD, Max, and Min you mustD 1) DIM the four arguments MEAN, SD, MAX, MIN as Double in the macro$AL$F calling this macro; no numbers need be assigned to these variables' 2) DIM and load a vector that has data 3) Call this macro like this: C BasicFour data:=myArray, MEAN:=MEAN, SD:=SD, MAX:=MAX, MIN:=MIN !$AL Examples follow below ]]]0]H]` find n:c$$  '2  set MAX and MIN to first value$$'$$$'j5:j) First pass to get the mean, max, and min @$$  @$ '$  @$ G @$'j$  @$ G @$'j%  'he Second pass to get the SD' @$$ @$  '   'L$    '?&(       '$SD Corrected two-pass formula. $*'pH The SD is the sample SD.% The Population SD is Sqr(n/(n-1))*SDopx]8]P]h]] find n)$$  'S(  First pass to get the mean.!$AK$2 @$$  @$ '  ' Second pass to get the SD' @$$in @$  'pu   'ng    '       '$SD Corrected two-pass formula. $*' The SD is the sample SD.% The Population SD is Sqr(n/(n-1))*SDoH]+@B+]0]H  $f "A@,o(]'h '  +]8 ]P A@,o`X   A@   A@` |Attribute VB_Name = "SDModule" ' Source:(http://www.u ^ZxME(> `  x`k@--) x `I I I I@ `xs it`@t it `lrd d`d? I`\ss a `Lk;) n SD*SD ii`x`@t `l`d`\j  (``k Z d  $`h kg dd ve'x(O T%`0H@L @H @8D (@4 @$ P@`  x8!@ `!`%*HP8hXp@X xX %@T   @P  @L yy i*``X`P0xH0Hf,@L @`< @, @ @" @ @ @ '@ @ @ x@ `` 8 P h h @P X @8 @ @P 0 8 @( @   h (@  ,@  @ @@ @ @ (bD!$*\Rffff*1^445b700f*\R0*#14*\R0*#f*\R0*#15u  H :X D L &0 FX  ,   "  @ JX L . $( JP   "  & H`  0x$)$) 08 Hhp   N ( 8 ,X "  "  " @ X ` p lib.org/webRoot/Books/Numerical_Recipes/b.cpdf.htmlA clever way to minimize roundoff erro@r, espCally6for large samples, is?use the corrected two-pass algorithm BGiven a rr{of data(),%?tinCeturns it Tage, Mea4n,d$@ standard deviatioQSD.6IMo k outNskewneInd kurtos9cul froBmcode2TyjSDr9/'b PopSqr(n/(n-@1))*SD!BatoFeb 2001OPublic Sub BasicFx(C As Do=SD?axin)ATo ]A@0macroagetI @G Min you must1) DIjM9f @tnZMEAN, AXIN a" @xB aNling!; no numb@ers ne@besignA)hese variab@2#*load a vthat h@ EA 3) C! likisB$SB:=myNA@37:=8:=9:@INEx foll`ow be@lDim nAgLong jsnepMVarC' fi`Rn n`(UBpAA) - L + 1@`B!s!?dAXc M6`zfirst-lu YMax Kk C=pni F z waMArmaS8 F`7j `V+ ss +EjIf a<{%lnBDQ>nj@Nex]ab / +A%Seco`-au03{j4 `@>= ep =f*" #E(i!- *)` / (n>u'C m= `Òr3_JE#S󡓡SD'Wj@?@ee # _e_e X)?W.WMBfM22&&&&(&&^|&a`& dg/r-r& 'W(A$\(0D01 =)@>`uP= -10Xa,*3+%.bEcp.aPqcsgBox & Chr(1i&L4$ 2? `9) 3HNi0 2 iyRnP#'! mg 3 ayC< M t\m\ kLb`l$ $ ˀ Lqx Lt dTMollt tl tfT3 ollx춈tl Lt dLlt tl olodtdololo\t\ tfLz o\ododlx춯lxt\ m\ 0$ ddPXdYL  F < '''oPk,< 6 <T< dU $<t( P(0'h8' P"d5 P~dY  &'''M@@ 6t\DPdo'\rU <` !9IYk////4` !9k++$`$`n<+ ^|xMEP6 LL"<<+`k$$`(trees`0:%Se&%XH@XH``xpHpl,2@p @l @(\ @L @*< @@( @@ @ @ XP@ @`@ (xpbD!$*\Rffff*1_445b700f*\R0*#13*\R1*#e8*\R1*#2ac*\R1*#f1$*\Rffff*1V445b700f$B   P0 ^ \ &@ Dh (   ..@ 2P1    &  &8 @P 11 Nov 2004butionBarretodfIthis function checks to see if there are any links in the active workbookWto this add-in and if so, it returns a message string that can be used to warn the userUto use it, drag this LinkCheckerModule into the add-in, then insert this line of codeRange("I1").Value = LinkChecker>at the end of the macro that runs from the Form for the add-in!Change the cell address if neededget this add-ins name]@ l!'((get all the links in the active workbook ,%.'*,check to see if any links are to this add-in]X *$2  * $* ('0 0 ?Warning! This workbook is using formulas available only in the ({ add-in. If you move the workbook, uninstall the add-in, or otherwise break the link, the formulas will show a #NAME error.'z@d8 there are no links so do nothingk d there are no links so do nothingkiHAttribute VB_Name = "LinkCheckerModule" Function p() As Sng '11 Nov 2004Barretothis f~cs to see if there a!ny l{s $in arve workbookKoNadd"-$andBso , it ourns a message s2at can b@e used}wardr -$, drag_4M]Z A, en sertae of c@ode 'Range("I1").Valu߁->P*ehamacrw rBukfrom6 Form forgB Ch1 chellOrn`eededrgFeSs n} Dim my$Gtv= TtWd.Oa.[qaAs@Awources()ȊaFa#0Pos.Intege@vIft IsEmpty()1eng S i@#1 To UBoundE Apmy= IBnG(1, (i),M, 1.A > 0HO<"Wing!@ @5E  us|mulavailabl1@nlyB}" "&Kp& ". @"you moAhE, uninLst%7B, Korwise breakb ;"^wi>shown#NAME erpror.Ex t*Elsdd'no #Iso do n ' eIfNext i   < E rU~|    6 Il9iIj<p$ >p1t.L '\%l$ Hl L<l< ((<5Iih1( @ <0< <<<<< L<4<8<<<++6h`J@)8 ` %+<X`J >>i> celi@iBiD(nseriF Ra HLnkCh` 0m fo J ded`n on`@e =r`` Ran Llex NHo ma P R8@B `,+Z`J xxVi\ds)^%)`H%)b( % dT` vale neededH fP myFandom nu h0L5If any tim`jH`lDnt b`nh@agai`p<`:8Th`@8xt " N4e se v  Hh0'r ,ndom fun L(@e =rl(H h      ` ,`r Po`t 9 s`vC G4`xPds zh`J `\z ^t % `p@% bl`% |H `JGGi\ )^%)`  %)b8 % ddp X  f`   h@ \  `jX`l T`nx P`pL`J`@H ND   Hx @    <   L8P 8 X x      `J44`>t`Bl`@d`D \`FT H48   p X  J  ``@`` LH0 N h P R t X`J8**SI XI xI I~ `j`@h`f`\ X0%`t`x4%`+`x0o i$  `J XhhH 8PPP8(P @@hd @T @P @@ @0 x8h+x @h @X H @8 (( @  @xt @d T @D @4 @$ ( @ `<l 0 0`H@(X @p H` @P x@ @0  @ (  @ #8 (#%@ @ @ , ,(.8X @ @ @ P1` x1 3 3578h8P ppl Xh @X P( @ @ @  @  @ < < (EX 8EHTpV X X Y Y\H]X( @p p_` _aP h@ hPj`X> @4 @, @* xm( m( @ o oqs H(,|h @X @ (T D @4 X$ @ @ @ @  H # h% 0 p!!xX!@x @h @6 !""4 """$ @ @ @ " @ # @ "&# #&8# (#(P#)`# x#*# #*# #+# #+#.($/8$( @ P$1p$x `$1$3$h $6$X $60%8@%XV @L @D @B X%;h%@ %;%(0 @ %= %=%?A P x @  &&n &&l &'','h 'pX @H '8 @( 0) @ (( @ ((( (((X @ @ @ ("( ("( )$0) )$ )&( X8x`+*l @V @* P*T h* x*R * *P x+ @ +0 @ @ H+( @ @  +       8@$#X &   B   D$0@Xx  ( $ $ $@ $h  6    .0 ` x " F   !8Xp!, , , ,0  @ ^+P     \+  @ P X  ` f+p     h+  p    : :  +  0 @ H P  Jh   \+       0  <+H           $$  @ P "`  '    8H ` x$- &1  08" @Hh+p 0  "   D$Xh  ( $ $@ $h $  6  ( 8 .X   " F   8H!`!0:(:@X Jp  $$  0 "@h  '   (0$-H p&1  $ "   &0Xpx0HXhx "  . 0 @ Xpx$# &  ,,  "  ( 0 H (`   .  8 P ` (Jp     (+     (60P X h x &  4   (0 HPrints out formula as text0Maja Sliwinski developed this for Simon Benninga &B@ S<-- 8!: &%d'6 andi`h]H]]0]H]`er]Ra]@ &B@Ch F 8Absolute value of rho must be less than or equal to one.A@,invalid'<TFk(+H F+H F+Hquires+Hs to b @+Phe >+Ro D+P 1 B+Ros @ Z DSDs must be positiveA@, invalid'<TFk8 D th NSDs must be positiveA@, Tinvalid'VTFk Call choldc to get weightsMRG ra torev  +ll ted ra' H A@X s dureerror'<ThTFk8 at ini $  +H  NA@t @a modu'  @ok  @ $H $N 'Expl  this  @$P @$R @+LFo @s and L'<T(i X>Dim corrRange As Range, meansRange As Range, SDsrange As Rangeh.ed &B@an]0h-76]  7]8P]h]****Dim mysheet As Worksheet!Set mysheet = Sheets("MCResults")corrrow = UBound(corrmat(), 1)dulecorrcol = UBound(corrmat(), 2)[Tomeansdim = UBound(means(), 1)FERESDsdim = UBound(corrmat(), 1)ct (If meansdim <> SDsdim Then/ MultiVarNormal = "Means and SDs wrong size"ta GoTo EndnowEnd IfxIf corrrow <> corrcol Then( MultiVarNormal = "Matrix wrong size"nd GoTo Endnow nEnd IfandoIf corrrow <> meansdim Then@ MultiVarNormal = "Matrix doesn't agree with means dimension"g  GoTo EndnowEnd If \N` \ \H \ \L \f \h \ \d0]8Ph] `!H!T'r b!H!T't ^!H!T'v ^!D!T'x r \TMeans array must have the same number of rows as the specificed number of variables.A@,error'ZTFk0 t \RSDs array must have the same number of rows as the specificed number of variables.A@,error'ZTFk v \[Correlation matrix must have the same number of rows as the specificed number of variables.A@,error'ZTFk x \^Correlation matrix must have the same number of columns as the specificed number of variables.A@,error'ZTFkp  \MsgBox meansRange.Address  `% +f  b% +h $h SDs must be positiveA@,error'ZTFk @ \  @ ^%  @+d  @$d QCorrelation matrix must have entries less than or equal to one in absolute value.A@,error'ZTFk  @  @$d2Correlation matrix must have ones on the diagonal.A@,error'ZTFkXkP @   \ @   @$d  @+H  @$H @ +H @  Call choldc to get weights  \  +  H \ A@X error'ZTFk  \ $  +H  NA@ @ \'  @  @ $H $N '   @$h @$f @+L @ L'ZMsgBox MultivarNormal(1)Ti](H'\ MCResults$.I22:K24$.^ ^!$A@,M22:M24$.`N22:N24$.b \ ^ ` bA|oh>Dim corrRange As Range, meansRange As Range, SDsrange As Range &B@]@ x  ]   0 ]H ` ]x ]   Dim mysheet As Worksheet!Set mysheet = Sheets("MCResults")corrrow = UBound(corrmat(), 1)corrcol = UBound(corrmat(), 2)meansdim = UBound(means(), 1)SDsdim = UBound(corrmat(), 1)If meansdim <> SDsdim Then/ MultiVarNormal = "Means and SDs wrong size" GoTo EndnowEnd IfIf corrrow <> corrcol Then( MultiVarNormal = "Matrix wrong size" GoTo EndnowEnd IfIf corrrow <> meansdim Then@ MultiVarNormal = "Matrix doesn't agree with means dimension" GoTo EndnowEnd If \Np  \ \H  \  \L  \f  \h  \ \d@  \ `!$A@,  `% +f  b% +h @ \  @ ^%  @+d @   \ @   @$d  @+H  @$H @ +H @  Call choldc to get weights  \  +  H \ \ A@X  l $  +H  NA@ @ \'  @  @ $H $N '   @$h @$f @+L @MutltiVarNormal = ResultArray~oH ]     ] ]@ x ]   ]]P]'>'B'@'D?'F+H F+H F+H+H @+P >+R D+P B+R Call choldc to get weights   +  H A@X  $  +J  NA@ @'  @  @ $J $N '   @$P @$R @+L @$LA@,$LA@,oDim n As IntegerDim np As Integer!Dim a(1 To np, 1 To np) As DoubleDim p(1 To n) As Double']]]]](Set mySheet = Worksheets("CholeskyTest")   @   @$'  '    $ @ $ '  'P  @  Impossible Correlation MatrixA@,'Tk $* +~d  $~ @ +k @ For i = 1 To n 'mySheet.Cells(i, 1) = p(i) For j = 1 To n- mySheet.Cells(i + 1, j + 1) = a(i, j) Next jNext iTosthis function takes a cell address, like $A$2, and outputs the name of the cell, if it's named, or the cell address]8 $$!!' G $'j 'iho8$A$1$A@,8Attribute VB_Name = "Functions" , Cell(Address As Sng) 'this f tak@es a cz ar, like $A$2, and outputs the nof 4, i@f it'sd0, orP @On ErrResuNext Dim  = Rang2ek).  If" Then 1/ Ep Sub tes tus() @MsgBox"1"  GetFormula(Rngoda Prin 2f a'Maja Sliwinski developed@XqSSimon Benninga ApplicaA.Volle True%<-- "h & T@,./Local, ";KKE BiVarN1al(mean1 _`)gDAId^"@olvalue 4must be lthanequal to one.'aCNin@ id Go9leavde:rIfAjB=, 1)1 >`1, 2  (`Pxg'!T c"S|D2g"BUbaX< 0bo$SDs %"positive3  {0vEr.".' Call choldc9getwg k1"p#rD(k*k a Q= 0 `75, ", r*IOlEBD)$ Ek, CRNG pK, 0!N joc|Y*j8 uI`= + j}* %c%j;)*S>0+ ?jp; 9 4O[b M iF"(P9rOpcorrrkN, !1sM/rzvWf['~~bsoLti`meL_ (* cS row Long, cold U#s}c XA &'/ ry9, 9" 0m0ysheP: WolrkS = S!s("MCs!}P= UBound(01&'W()N&<>P/sќ7*$f0 wr` sizAW'Bqnow0QM'  @"MaPx/ /7/2 t8doesn't agree with ensPPe ' Re[&`Uo R=`qga\+ēK'oc {om60 a0-, noa"RJs8noSDy8nod6  =C M.Rows.C00 4DI= /]04s#Cpmn))7/Shsanumber` "speci8fic_ia0sٚka)Ix5횷  :a =s @  # CqeQՀ+rixp_ W "rNormal = "error" GoTo leave: End If If nocorrcols <> nvars ThenrMsgBox "CFelation matrix m ust h the same number of Oumns aspecif0iced#jia bles.Multi,For i1 rb_'`meansRange.Add0ress (i)Cellss SDr!< 0be posiqez,}|jN|Av@k(i, j8AD09 2Abs(J ) >  '6en@esF xan iequ@to one in absolute valueɂރA EH7jh߀J/ r9, 4* Work+@7&,,Pq= UBound|)pHx, 2(0t&P=c'L@f.O"MH a wr` sizQ"ZqP.now .'z M///G"??doesn't agree with ensг@ ' Re,W&posRPq&g&r('c mcZŷ1m tU"2D( #(P.owCu#q /4'qr` {xjc2 lsVAvQ pC o *alooT= ooy vok`'1o=o'Mut J[? I4x Bwy(@azC- }X* BH k endIf j The(qa < 0  DF"Impossi@ Correlation Matrix"6hA Go`leav'baOIfp(ia]Sqr($&Elsa( / A# hai;6''$>@.Cells41C " ;A, + j!&>M' !: $p 0   0 h  0 X  0   0 h  0 H  0   C__SRP_3(pr_VBA_PROJECTh1dirzk__SRP_0FrU (`0$`,`=<`)9+++++H!`Ia&===$I`Hq`Ia&===$`8`////ng0* pHd MCSimAddIn4@j = r bD! J< rstdole>stdole %*\G{00020430-C 0046}#2.0#0#\\CALEB\WWW\depart\economic\Metrics\E Book\Cha pters01Introduction\ExcelFiles\StdOle2.tlb#OLE AutomaSMSForms>SFirms3hD452EE1-E08F-101A-8-02608C4D0BB4hC:\WINDOWS\Sys[T*ÇNAp7ksg0@co^ZtNżCVhXA2Be^F7"G! q as 8b=dimLerrorUformat_If(RandomResumeSubThenwidth Excel+ VBAWin16~Win32MacVBA6# MCSimAddInstdole`MSFormsC RefEditOfficeu MainModule  _Evaluate (ShowMCForm]A MCFormIRefEditOneCell;ValueK ActiveCellAddress Application*ReferenceStyle9xlR1C1pMsgBoxRpromptmTitle~Buttons] vbCritical+}Show(Log107HXoLogd(AddMCSimMenuItemja MCSimIsHeren CommandBars VisiblemyTools='OperatingSystem[ InternationalxlNonEnglishFunctionsInputBox ControlsKCount0vCaptionxnewItemICommandBarControlPAddrmsoControlButtonnOnActionMessageresponseChrK~ vbInformationn(test4 ThisWorkbook|Workbook_AddinInstallWorkbook_AddinUninstallLanguageSettings LanguageIDmsoLanguageIDUI5msoLanguageIDEnglishUSuDeletex Sheet1 Sheet3CellValidStringTestCommandButton1_Clicki` FirstCelluFirstCellArray SecondCell$SecondCellArray>myrepsPctdone mystarttime yoursettingFxmeanxSD!xmaxxmin;x2mean-x2SD@\x2maxHx2minf ViewTableAllLong histRangeO&Range  myendTimew1t_w2u_ii]jj]kk]aXCZ MCRawRangeExmyOriginalSheetName$myCurrentMCSimSheetmyCurrentStringmyStartPosition* myEndPositionSParentCellStringTestFirstCellexternalwFormulaqY vbTextCompare QRefEditTwoCell~CellStringTestSecondCell` ActiveSheet%NmyFirstCellInitialValueEmySecondCellInitialValue@myCellDoesNotChangeWarning[Sheets  CalculatevbYesNovbNo% TextBoxRepsKoNow% CalculationhxlCalculationManualScreenUpdating! OptionButtonRANDCellsReplacefWhatC ReplacementLookAtOxlPart< SearchOrderxlByRows MatchCaseOptionButtonFMRG+ FrameProgress CheckBox1 ActiveWindow+RangeSelection7~MCRawhmyMCRawVarCounteAreasKSheetLoopNumber  continue3rmyMCRawSheetName\CalcBookCheckBox) LabelProgress} (BasicFour` WorkbooksBCopyƿBefore continue4sSqr(DisplayGridlinesCharts ActiveChart  ChartType?xlXYScatterLinesNoMarkersvLocation-Where֍xlLocationAsObject SetSourceDataaSourceGShapes< ChartObjectsHColumnsp9Top5RowsUHeight|PlotArea SelectionZInterior; ColorIndexxlNoneLegendPAxesbxlValue5FshI&/O4͡4Mm xlHairline4 LineStylew MajorTickMarkw MinorTickMarkTickLabelPosition~MajorGridlinesW xlCategoryZHasMajorGridlinesHasMinorGridlines)HasTitle{ ChartTitle_ Charactersrg(HistogramMaker1Var continue5t(HistogramMaker2VarC CheckBox2myExistingSheet0finishXmyExistingRawSheetErroClearActivate|SeriesCollection;: DisplayAlertsmyMCRawOverwrite ( LinkCheckerCommandButton2_Click TestString{ Sheet2 Histogram''(LimitsPminvalpmaxvalxx_oldy$yys_absminxrem$adjustymultoldwidthvaluesnoobsr histsheetnumber-binleft;~bincount!MinMaxȲmysheetb Worksheetylchoice{colHvalrangecvarnameYcNobinsjmincompgmaxcomptLargeyRangexRangeWleftCVtopC. precision statRangeAxupwxdown myboxRange (NewLimitsl(DriveFormatting TableRange7myWidthoomaxwidth(MakeBins ColumnWidthAutoFit&  tickwidthPlotBy$ xlColumnsh ChartArea HasLegendB ClearFormats MinimumScale MaximumScale=rowsubmcolsub `rowColumni ScrollRow" ScrollColumnLHvalues1uvalues2unoobs1rOnoobs2sOWidth1yWidth2yminval1rmaxval1minval2smaxval2 AllLongs1 AllLongs2binwidthYx1_Y1O_x2_Y2P_Nobins2Nobins1xx1xx2xxmin5maxbin/myname1myname2Varlabel<@ overallWidth overallxxSRisubwWrapText}nbsAxlThinw xlContinuous[ (FindPrecisionWorksheetFunction&Round leaveloopc(FormatSumStatsv NumberFormatR whichseriesIstartlwidth` lwidthrem_d[neg RNGandSortModule(myFMRG (myFMRGInt6& (myFMRGIntlag1  (myFMRGIntlag2!(ISETu(GSETIpgMCSimInstalled (auto_openV RndRBArraymyXAddInsmyAddInlFilenamejCopyFile Installed(FMRG*Volatile(FMRGTestfrank starttimeLTimerX (FMRGgraphF (NormalRNGUNormRandYV TypeofRand47Mean@SD_V1t_V2u_RadiusVFACDrepeattrepeat27(NormalRandomAdvbNormalRandomValueh (NORMALRANDOM(Uniform?O (UniformRNG  UniformRand76(TestUniformRandv(UniformBetweenT(TDraweDF\TRand (TRNGmyzRandDmyyRand myyRandTmpt(ExponentialRNGOExponentialRand0lowert(TestExponentialRNG3? myTestVectorB(Expo{ (NormalRNGTestresultur(qsort#hlcrinemdkbpv^ (pivotValue (MyPartition/. pivotValueOldpfound+middleXx3_checkocheck2ptempe(CheckforSmallerlo ^hi](swap=tempR (sorttestingxNmyArray SDModuledata;sjep]Var(MeanSD(Exampleh"SDPop(Example2i LinkCheckerModule# myLinkStringaLinksActiveWorkbook LinkSourceskmyPosѰIsEmpty  Functions ( GetFormula|fRngU FormulaLocalD ( BiVarNormal_3mean1wSD1&mean2xSD2'rhomatIJweights[ ResultArraycK NormArraySDvec=MeanvecFleavet BvarNormal( choldc( MultivarNormal/;nvars corrRangemb meansRange"SDsrangelcorrmatRmeansSDsHcorrrowncorrcolmeansdimSDsdim nomeanrowsnoSDrows nocorrrowsR  nocorrcolsu( CallTestMultivarNormal( TestMultiVarNormalѾEndnow( BivarNormalTest<sumWorkbookk_B_var_i _Defaultj_B_var_myAddIn AddinInstallAddinUninstallUserFormNCommandButton1|CommandButton2}Label3,Label4,Label5,Frame1Frame2Frame3 OptionButton1k@Click _B_var_Format _B_var_Midp _B_var_aLinksg( CellNameο_B_var_FunctionO _B_var_On6 NameString _B_var_IfP namstringj( testnamestring _B_var_Sub_B_var_namstring myOneCellName0 myTwoCellNamex myrepsentered IsNumeric$*myrepsdQItemz _B_var_LeftQ _B_var_Chr\;_B_var_response  _B_var_Mean0 _B_var_SD _B_var_SDPopҿ_B_var_BvarNormal1_B_var_k  _B_var_result_B_var_mysheet_B_var_starttime_B_var_X_B_var_j (RandomNV"__B_var_continue3_B_var_continue4SheetLoopNumberMCSim?ned _B_var_nedu userSheetNamepmsgbo _B_var_msgbo| '  5 m }q$@ `@ @`!H@P$HA @tem32\FM20.DLL#Microsoft : Object Libr@ary/;D1?HR00}#0BR# 5h0 AAD148C92-33D8-4C6B-8047-F6F2D8564F5@j6DOCUME~1\user\LOoS@Temp\VBE\S.exd ; .E .`M C1RefEditgRfEi@3wH`24517HP1H@0Program FdOffice\OFFICE11\REFEDITm! " Col?iž7(07o84BBE403AC-470C-9126-F5DF4C88A89F}#F44`J @E!FC2!$#OfQ ic"``a22DF8D04C-5BFAf@B-BDE5@4AA4`2f}2C30MSO9h 9\.0h@ D^ainM leGMainM}du*,26  H1$",bH!"+Thi@sWorkb@GD Th sW rkbo2oƅ`m^"e;Sheet1G Se@;t1l¿2 ڪo 3 3 23 3 WZMC MC?  h] (*2222Ұ* \ HistRNGB%t$hgr.mj2'obG- RNGandSort6 QPNGn@\Sr\[7 |o t; c Z P SD5 1SD@92E?eLinkCheckerEA$Ln?C"8ceu 1B|A#Funs%FSn`t o@T>s%f%o6`?CommandButton2_ClickCellStringTestFirstCellCellStringTestSecondCell FK `M ,This add-in will not work with columns as numbers. Please execute Tools: Options, click the General tab, and uncheck the R1C1 reference style option. 8Unacceptable Reference Style 0VBE6.DLL S @ $Worksheet Menu Bar F F W Tools Herramientas F FControls CountCaption MCSim ...TypeAdd ShowMCForm i  DExecute Tools: MCSim ... to begin.} @Monte Carlo Simulation Availablep The language of this installation of Excel does not appear to be EnglishUS. Please enter the word that Excel is using for Tools on the main menu across the top of the screen. For example, in Spanish, it is Herramientas. ,Get the word for TOOLS You have successfully loaded the Monte Carlo Simulation add-in. You must have at least one cell that has a random number function in its formula. You provide one or two cells and the add-in simply recalculates the workbook for as many repetitions as you indicate and outputs the results in a new sheet in your workbook. ` OnActionName =2 The selected cell does not contain a formula so the cell value will not change. Please try again. Fatal Error  RangeexternalAddress .The cell you selected, What LookAt6 The selected second cell does not contain a formula so the cell value will not change. Please try again.CellNametestnamestring GetFormulaFF BiVarNormalMultivarNormalCallTestMultiK*y     rU&~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~ ~~~~~~~2 !ƐdgpB]#`   a Y,  a a ahg)ha aha aha Ia 1a ahIa y  7778!8 I8q88aa tHqqryr9rYryrrrrs)sQsissssst1tQtyttta Y,<< =16a Y,Ada Y, **!+i++++,A, yY  MainModule ThisWorkbookSheet1Sheet3MCFormSheet2 HistogramRNGandSortModuleSDModuleLinkCheckerModule Functions MCSimAddInF /C:\PROGRA~1\COMMON~1\MICROS~1\VBA\VBA6\VBE6.DLLVBA A i0F4C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXEExcel 9a@0Fe\\CALEB\WWW\depart\economic\Metrics\EconometricsBook\Chapters\Ch01Introduction\ExcelFiles\StdOle2.tlbstdole aaP.E .`M C:\WINDOWS\System32\FM20.DLLMSForms A`3kLGVOP .C:\DOCUME~1\user\LOCALS~1\Temp\VBE\MSForms.exd ApEF 6C:\Program Files\Microsoft Office\OFFICE11\REFEDIT.DLLRefEdit  @K G&L .C:\DOCUME~1\user\LOCALS~1\Temp\VBE\RefEdit.exd  L-[DR 1C:\Program Files\Microsoft Office\Office\MSO9.DLLOffice  q  ShowMCFormLog10AddMCSimMenuItemMessagetest FF5RMBa]KBHȖe&\HY~|dWߏuNt(3#3AY-J}.{lFWJOCommandButton1!-6S` ! AҋB ` TextBoxRepsCommandButton2"-?@Label3Label4?F`Frame1RҋB `OptionButtonRANDLabel5Frame2Frame3 OptionButton1BҋB ` CheckBox2OptionButtonFMRG FrameProgress CheckBox1RefEditTwoCellN!mmJ|YBc yRefEditOneCellCalcBookCheckBox LabelProgressȏ[qJ eUserForm]7J?y. F3Dynamic   CommandButton1_ClickvarNormalTestMultiVarNormalBivarNormalTestcholdc FCalculateReplacementE , did not change when the sheet was recalculated. This cell may not be appropriate for a Monte Carlo analysis. Do you want to proceed? 6Cell Doesn't Change Warning#=h8+3qG?,2qL// >One of the cells you selected,   or  CellsE , did not change when the sheet was recalculated. That cell may not be appropriate for a Monte Carlo analysis. Do you want to proceed?ҋB `! ~The number of repetitions must be an integer greater than zero.CҋB ` RANDOM RANDSearchOrderMatchCaseReplace MCSIM.XLA!RANDOMƏYl|Example2 OneVarMCSim MCSim.xlaFF BeforeCopy MCSimLimitsHistogramMaker1VarHistogramMaker2VarMakeBins FindPrecisionFormatSumStatsDriveFormatting NewLimits B2 AL1Fb You cannot have more than 65,535 repetitions when the Record All Selected Cells option is on because the results will not fit on the sheet. Please lower the Number of Repetitions below 65,535. Too Many Reps`Fpj).` BasicFourMeanSDExamplea |You have selected more than 256 cells to record. This cannot be accomodated on an Excel sheet. You may have inadvertently selected a large range of cells. Please correct this and try again. 0Too Many Cells to Record MCRaw Value 0% aa1:ab3 EmpHist Chart 1 ShapesColumnsLeftChartObjectsRowsTop Height widthInteriorColorIndex Delete Select Border WeightLineStyleMajorTickMarkMinorTickMark "TickLabelPosition Execute MajorGridlines "HasMajorGridlines "HasMinorGridlines EmpiricalxF TwoVarMCSim C2 I4 K4 AM1 aa1:ac3 :Existing Sheet Name Requested MCSim Number `Existing Sheet May Not be MCSim Sheet Compatibleo Please enter the number of the existing MCSim sheet to which the results of this simulation will be written. Simulation results on the existing MCSim sheet will be overwritten and lost. Click Cancel if you are unsure. x 5 You have canceled writing output to an existing sheet. No changes to an existing sheet have been made. 8No Writing to Existing Sheet I5 Average I6 SD I7 Max I8 MinfĤIx8< !$AM$2:$AM$ ,2)E٥RNV>( The Average, SD, Max, and Min results are written in cells J5:J8, with labels in cells I5:I8. Cells I5:I8 of the chosen existing sheet do not contain this information so this may not be an MCSim sheet. Thus, no changes to the existing sheet have been made.X ZThe sheet name you entered does not exist. Please enter the name of the existing sheet on which you want to overwrite the MCSim results with the results of this simulation. MCSimNumber b3:c102 l5:l8 AH1:AM10000 !$AM$1,pOr{ {+ The existing sheet cannot be found. No changes to an existing sheet have been made. b3:b102 f3:f4 j5:j8 AH1:AL10000ActivateFormula $AL$2:$AL$ , =SERIES( !$AL$1, !$AK$2:$AK$ !$AL$2:$AL$ ,1) K15# Do you want to write the output to the existing MCRaw sheet called  ? &MCRaw Output Option " p   V  f    invalidX ZThe sheet name you entered does not exist. Please enter the name of the existing sheet on which you want to overwrite the MCRaw results with the results of this simulation. MCRawNumber LinkChecker I1/@ 1 PfSDt9i@n Your entry,  d , is not a valid cell address. Please try again. * , has caused error, * . Please try again.}~3Z L2{?Fc7BHhgʓDFWorkbookWorkbook_AddinInstallWorkbook_AddinUninstall @ No. Obs.  to ClearFormats! ~Warning! This workbook is using formulas available only in the ? add-in. If you move the workbook, uninstall the add-in, or otherwise break the link, the formulas will show a #NAME error. . `S FColumnWidth Histogram of MinimumScaleMaximumScalerow Column No. Obs. in  And Show 0 0.NumberFormat Q  $A$1 <-- Text pAbsolute value of rho must be less than or equal to one. (SDs must be positive error auto_openFMRGRandomFMRGTest FMRGgraph NormalRNGNormalRandomAdv NORMALRANDOMUniform UniformRNGTestUniformRandUniformBetweenTDrawTRNGExponentialRNGTestExponentialRNGExpo NormalRNGTestqsort pivotValueCheckforSmaller MyPartitionswap sorttesting 4 ?4FBKf%, Means array must have the same number of rows as the specificed number of variables.+ SDs array must have the same number of rows as the specificed number of variables. 2DF must be greater than 0F2}zAjB FB$`34aJ݋qRandomNV/ Correlation matrix must have the same number of rows as the specificed number of variables.1 Correlation matrix must have the same number of columns as the specificed number of variables.   HiDF Worksheet* Correlation matrix must have entries less than or equal to one in absolute value. dCorrelation matrix must have ones on the diagonal. MCResults I22:K24 M22:M24 N22:N24 :Impossible Correlation MatrixR x *: MCSim ... to begin.& nIyG&diIWVqwD9 Ɂ `\(#QEi^X\ hIt was not possible to give the MCSim and MCRaw sheets the same number. You may want to rename these sheets to indicate that they were generated by the same Monte Carlo simulation 6MCSim and MCRaw Name Report__SRP_1'#MCForm@+`kgPkgfTo*0rU~~~~~~~~~~~~g        X I  I  I ( I i8 I H I qX  h yxCellValidStringTestAddress A+Rngmean1SD1mean2SD2rhonvars corrRange meansRangeSDsrangeanerrorpdataMeanSDMaxMinminvalmaxvalwidthxxvaluesnoobsx3 histsheet histRange ViewTableAllLongnumbervalues1values2noobs1noobs2Width1Width2minval1maxval1minval2maxval2 AllLongs1 AllLongs2binleftbincountNobinsy precision statRangevalrange whichseriesxminstart gNormRand TypeofRand UniformRandbDFTRandExponentialRandlrmx1x2middlecheckcheck2pvkij | yf(H  (@c},R KQDBTimes New Roman8KEFҋB `EF, #FrameProgressl(074CommandButton1{a$0 ;4CommandButton2g a$$#Frame1$#Frame2\ %t0CheckBox1ttoSelect cells on sheet, then execute Tools: MCSim( &pCheckBox2tto!,(pCalcBookCheckBox (ProceedqNqTahomad(CanceldENqTahomadLF#{0vRecord All Selected Cells (256 Max)e 5Times New RomanGHF{0vOutput to Existing MCSim Sheet 5Times New RomanGHF{0vRecalculate the Entire Workbook 5Times New RomanG<H   }S"Progress BarR KQDBTimes New Roman860 20LabelProgress "1Tahoma4 n``Microsoft Forms 2.0 FrameEmbedded ObjectForms.Frame.19qi02. n```kg`kgfo-/0CompObjpi26,<2 n```kg`kgfo134i3375 n```kg`kg8H  ' }SRequiredR KQDBTimes New Roman(P P RefEditOneCell{Click on the cell to be analyzed(2HLabel3L DTextBoxRepseqEnter the number of repetitionsd(2XLabel5$!#Frame3  (TH$ {Game!$F$8me. 5Times New Roman ( Select a cellanq 5Times New Roman@H,{1000 5Times New Roman0(Enter the Number of Repetitions 5Times New Roman8H $ }qChoose RNGRoL "XOptionButtonRAND{Uses Excel's RAND function\ #\,OptionButtonFMRG"Uses Barreto/Howland random number generator,f8o46CompObjpCompObjp $\OptionButton1MRG 0Fp ,0vAll RAND 5Times New Roman4F ,0vAll RANDOMRo 5Times New Roman4F ,1vNo ChangesRo 5Times New Roman n``Microsoft Forms 2.0 FrameEmbedded ObjectForms.Frame.19q n``Microsoft Forms 2.0 FrameEmbedded ObjectForms.Frame.19q8H  }SOptionalR KQDBTimes New Roman(2LLabel4NDX @%RefEditTwoCellnG{Click on a second cell to be analyzed $(Select a second cell  5Timei27: n```kg`kgf o9;CompObjps New RomanGH$F 5Times New RomanG n``Microsoft Forms 2.0 FrameEmbedded ObjectForms.Frame.19q Microsoft Forms 2.0 FormEmbedded Object9qVERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} MCForm Caption = "Monte Carlo Simulation" ClientHeCompObj8=aVBFrame.PROJECTwm^PROJECTight = 6510 ClientLeft = 45 ClientTop = 345 ClientWidth = 3435 StartUpPosition = 1 'CenterOwner TypeInfoVer = 99 End MainModuleMainModuleThisWorkbookThisWorkbookSheet1Sheet1MCFormMCFormSheet2Sheet2Sheet3Sheet3RNGandSortModuleRNGandSortModuleSDModuleSDModuleHistogramHistogramLinkCheckerModuleLinkCheckerModuleFunctionsFunctionsID="{AB8AEE19-FD9C-11D2-9CEA-20F807C10627}" Module=MainModule Document=ThisWorkbook/&H00000000 Document=Sheet1/&H00000000 Package={AC9F2F90-E877-11CE-9F68-00AA00574A4F} BaseClass=MCForm Document=Sheet2/&H00000000 Document=Sheet3/&H00000000 Module=RNGandSortModule Module=SDModule Module=Histogram Module=LinkCheckerModule Module=Functions Name="MCSimAddIn" HelpContextID="0" VersionCompatible32="393222000" CMG="6F6D697C77848288828882888288" DPB="7E7C788D88939694969496" GC="8D8F8B9A95A896A89657" [Host Extender Info] &H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000 [Workspace] MainModule=0, 0, 0, 0, C ThisWorkbook=0, 0, 0, 0, C Sheet1=0, 0, 0, 0, C MCForm=66, 87, 922, 527, C, 88, 116, 944, 556, C Sheet2=0, 0, 0, 0, C Sheet3=0, 0, 0, 0, C RNGandSortModule=0, 0, 0, 0, C SDModule=0, 0, 0, 0, C Histogram=0, 0, 0, 0, C LinkCheckerModule=0, 0, 0, 0, C Functions=0, 0, 0, 0, C PROJECTlk?>SummaryInformation(BxDocumentSummaryInformation8CompObj m   EFOh+'0H hp  ( 4@ Monte Carlo Simulation Add-inBarreto/Howland$Monte Carlo Simulation 11 Aug 2005Humberto Barreto@b%13@AL@kg՜.+,0HP X`hp x G Doc OneVarMCSim TwoVarMCSim  Worksheets F!Microsoft Office Excel WorksheetBiff8Excel.Sheet.89q