# MonteCarlo

Fitting an equation for a quadratic with added noise is used to illustrate the MonteCarlo Graphical User Interface.

Model number: 0349

Run Model: |
Help running a JSim model. |

(JSim model applet may take 10-20 seconds to load.)

## Description

A quadratic curve, Quad(t), is generated. 10% proportional noise using the seed 12345 (in Solver GUI), is added producing NoiseQuad(t). The noisy curve, NoiseQuad, and the non-noisy curve, Quad, are saved using the "Store data set" from the pull down menu under the File Tab on the Figure 1 Plotpage. This data is saved as Fig1Save. The data stored in Fig1Save is plotted again in Figure 2 (red for NoiseQuad, Black for Quad.) Quad (from the Monte Carlo model is plotted in green dashes. The optimizer is run to get the best fit for a0, a1, and a2. This moves the dash green line (Quad, MonteCarlo) slightly off the black line (Quad from Fig1Save). Now we turn off (show button unchecked) the saved data, curves 1 and 2. Use "Store data set" to save the optimized Quad curve (curve 3, dashed line), naming the data set BestFit. For the MonteCarlo simulation, we are going to add noise to this best fit curve many times, and optimize these new noisy data sets. The optimization GUI should contain Data Set Curve Par/Expr Pwgt Cwgt OK Fig1Save NoisyQuad Quad 1 1 CheckMark This needs to be reset to Data Set Curve Par/Expr Pwgt Cwgt OK Fig1Save NoisyQuad Quad 1 1 blank BestFit Quad Quad 1 1 CheckMark NOW GO TO THE MonteCarlo GUI. Set the following parameters # optimizations: 1000 random seed: 6789 distribution: gaussian magnitude 0.1; add method:proportional. The "add methods" are called "proportional" and "additive". "proportional" noise NewValue=OldValue*(1+fraction*Noise) where Noise has mean 0 and variance 1 and 0<=fraction<0.25. "additive" noise NewValue = OldValue+amplitude*Noise where Noise has mean 0 and variance 1. Run the MonteCarlo simulation. There are a wide range of data items that the user can access. Starting with Reports, there are two views: Summary and Detail. Summary summarizes all 1000 runs. Detail gives the particular details of an individual run. From the summary run we have Parameter statistics: parameter mean sd a0 1.026 .0521 a1 .772 .321 a2 1.231 .3582 Normalized Covariance Matrix: a0 a1 a2 a0 1 -0.8481 .7424 a1 -0.8481 1 -0.9665 a2 .7424 -0.9665 1 Parameter estimates: opt# a0 a1 a2 ... 646 .9243 1.792 -0.0359 ... 881 1.192 -0.3187 2.558 ... Graphically, we can view Summary Plots of histograms of a0, a1, and a2, and two parameter scatter plots a0 with a1, a0 with a2, and a1 with a2. Using the detail view, we have access to any of the 1000 individual runs. Using the histogram plot for a2, we locate the max and min values for a2 and view the associated runs, 881 and 646 respectively.

Upper Left: The histogram for parameter a.
Upper Right: The scatter plot for parameters b and c.

Lower Left: The optimized curve and data for run 646.
Lower Right: The optimized curve and data for run 881.

## Equations

The equations for this model may be viewed by running the JSim model applet and clicking on the Source tab at the bottom left of JSim's Run Time graphical user interface. The equations are written in JSim's Mathematical Modeling Language (MML). See the Introduction to MML and the MML Reference Manual. Additional documentation for MML can be found by using the search option at the Physiome home page.

## Download JSim model project file

## References

www.physiome.org/jsim/docs/User_Monte.html

## Related Models

None.

## Key Terms

## Model Feedback

We welcome comments and feedback for this model. Please use the button below to send comments:

## Model History

Get Model history in CVS.Posted by: Name

## Acknowledgements

Please cite **www.physiome.org** in any publication for which this software is used and send an email
with the citation and, if possible, a PDF file of the paper to: staff@physiome.org.

Or send a copy to:

The National Simulation Resource, Director J. B. Bassingthwaighte, Department of Bioengineering, University of Washington, Seattle WA 98195-5061.

[This page was last modified 14Mar18, 3:17 pm.]

**Model development and archiving support at
physiome.org provided by the following grants:** NIH U01HL122199 Analyzing the Cardiac Power Grid, 09/15/2015 - 05/31/2020, NIH/NIBIB BE08407 Software Integration,
JSim and SBW 6/1/09-5/31/13; NIH/NHLBI T15 HL88516-01 Modeling for Heart, Lung and Blood: From Cell to Organ,
4/1/07-3/31/11; NSF BES-0506477 Adaptive Multi-Scale Model Simulation,
8/15/05-7/31/08; NIH/NHLBI R01 HL073598 Core 3: 3D Imaging and Computer
Modeling of the Respiratory Tract, 9/1/04-8/31/09; as well as prior
support from NIH/NCRR P41 RR01243 Simulation Resource in Circulatory Mass
Transport and Exchange, 12/1/1980-11/30/01 and NIH/NIBIB R01 EB001973
JSim: A Simulation Analysis Platform, 3/1/02-2/28/07.