![]() Check Independence (Ignore Correlations) to run the simulation with all inputs independent of each other (zero correlation).If the relative difference is between 1e-10% to 1e-4%, the status is “Good”, and if greater than or equal to 1e-4%, the test status is “Poor”. If the worst case relative difference is less than or equal to 1e-10%, the test passes and the status is “Success”. Each output is assessed by comparing the simulation means. Run Validation using Native Excel runs a validation test to compare Accelerated Mode versus Native Excel.If the DiscoverSim interpreter sees a function that it does not support, you will be prompted to use Excel’s Native mode. The interpreter supports the majority of all Excel numeric functions (for more details see Appendix: DiscoverSim Engine and Excel Formula Interpreter). If unchecked, the calculations are performed using native Excel. Accelerated Mode uses DiscoverSim’s Excel Formula Interpreter to dramatically increase the speed of calculations for rapid simulation.For details on Random Number Generation (RNG) in DiscoverSim, see Appendix: Input Distribution Random Number Generation.For further details see Appendix: Input Distribution Sampling. Latin Hypercube Sampling is less random than Monte Carlo but enables more accurate simulations with fewer replications. Select Monte Carlo (Random) for full randomization.Note that the results of a fixed seed for 32-bit Excel will be slightly different for 64-bit Excel. If you want the simulation results to match every time (for example in a classroom setting where you want all students to obtain the same results), select Value and enter an integer number. Seed is set to Clock by default so that the starting seed of random number generation will be different with each run.Replications value sets the number of simulation replications. ![]() Accessing Simulation Data in VBA Code explains how to use VBA to get the data from a particular input or output after a simulation.Overview of DiscoverSim™ Menu and Dialogs Run Simulation.Generating Values from a Distribution includes several methods for generating sample values directly in an Excel sheet, without using Visual Basic.This will not register as a VBA error that interrupts execution of your macro. If the Risk.Sample method returns an error such as #VALUE, that will be written to the worksheet. Range("myKeyLocation").Value = Risk.Sample("RiskBinomial(A1,A2)") Range("B1").Value = Risk.Sample("RiskBinomial(A1,A2)") You can apply it to a specific cell or to a defined range name: X = Risk.Sample("RiskDiscrete(Xarray,Parray)")Ĭan I write the sampled value to my workbook? X = Risk.Sample("RiskDiscrete('My Sheet'!A1:A10,'My Sheet'!B1:B10)")Īs an alternative, in the worksheet you can define names for the arrays, and then use the names in the Risk.Sample function: It follows the pattern of Cell References in Distributions. I want to sample a RiskDiscrete with a long list of x and p. X = Risk.Sample("RiskBinomial(BinomialN,BinomialP)") X = Risk.Sample("RiskBinomial('My Sheet'!A1,'My Sheet'!B1)") If you don't want to worry about which sheet is active, specify the worksheet or use defined names: The cell references must be in A1 format, not R1C1, and they are taken to refer to the active worksheet. (Beginning with 6.2, start with the Automation Guide for a high-level introduction: Help » Developer Kit (XDK) » Automation Guide.)Īm I restricted to just numeric arguments, or can I use cell references? Please see the XDK or Developer Kit manual for details on the objects and methods mentioned in this article, as well as alternative methods. Setting References in Visual Basic gives the appropriate reference(s) and how to set them. To call functions from Visual Basic, you must set up a reference from Visual Basic Editor to via Tools » References in the editor. If you want to access simulation data, use members of the object after the simulation finishes. They always use the Monte Carlo method, as opposed to Latin Hypercube RiskCorrmat and RiskSeed are ignored. The sampled values are not the same numbers you would see from that function in a worksheet. The Sample method normally returns a numeric value, but if there's an error in the definition of the distribution then the method returns an error variant in the usual way for Excel. Use the Sample method with the Risk object. How can I generate a random sample within a VBA macro or function? Sampling Distributions in VBA CodeĪpplies to: 5.0 and newer, Professional and Industrial Editions
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |