Contact

Gnumeric · Analysis and modeling · Intermediate

Run and check a Monte Carlo simulation

Run a bounded uniform Monte Carlo model, compare simulated statistics with theory, and retain reports without expecting identical random results.

Documentation-qualified exercise; native application verification pending · Editorial standards

Use Tools > Simulation to sample random input cells repeatedly and summarize dependent outputs. Validate a simple model against known bounds and theoretical statistics before trusting a more complicated simulation.

Scope and a model with a known answer

This exercise follows the Gnumeric 1.12.62 GTK desktop source and upstream 1.12 simulation manual, using English controls. It is documentation-qualified, not a native execution report or an installed 1.12.57 runtime claim. Use a disposable .gnumeric workbook.

Enter A1=Uniform input, B1 with =RAND(), A2=Base, B2=100, A3=Width, B3=20, A4=Output and B4 with =B2+B3*B1. The random input represents a uniform value from zero up to, but not including, one. The output is therefore in [100,120).

Before simulation, temporarily replace B1 with 0, 0.5 and 0.999 in turn. Expected outputs are 100, 110 and 119.98. Restore =RAND() afterward. These deterministic boundary checks establish that the formula is wired correctly; they do not verify the quality of a random generator.

Configure one simulation round

  1. Choose Tools > Simulation to open Risk Simulation.
  2. On Variables set Input variables to B1 and Output variables to B4. B2 and B3 are fixed parameters, not random input cells for this run.
  3. On Options set First round # to 1, Last round # to 1, and Iterations to 1000. Set a reasonable Max time, such as 60 seconds for this tiny model.
  4. On Output choose a new sheet so the generated report cannot overwrite the model.
  5. Click OK to run, then inspect the Summary tab and the output report.

A round and an iteration are different. This setup performs one round containing 1000 samples. Multiple rounds can serve other purposes, including parameter changes with SIMTABLE, but no SIMTABLE is needed for this exercise.

If the run exceeds its time limit, it has not produced a successful completed report. The manual describes increasing the allowed time, reducing iterations or simplifying the model as possible responses. Preserve your model and diagnose the cause rather than presenting partial or absent output as a finished simulation.

Reconcile the output without demanding exact equality

For Y=100+20U with uniform U, the theoretical mean is 110, variance is 400/12≈33.3333, and standard deviation is 20/√12≈5.7735. Every sampled output should remain within the model’s bounds. Its observed minimum and maximum will normally be inside those bounds rather than exactly 100 and 120.

The report includes Min, Mean, Max, Std. Dev., Variance, Count and confidence-related fields. Verify Count reflects the requested completed iterations. Compare the sampled mean and spread with theory, allowing random sampling variation. Do not require a mean of exactly 110 or a standard deviation of exactly 5.7735.

For 1000 independent draws, the theoretical standard error of the mean is about 0.1826, so a rough 95% mean interval has a half-width around 0.358. This is a scale for judging Monte Carlo precision, not a hard pass/fail tolerance. An interval about the estimated mean is not an interval containing 95% of individual output values.

Repeat and change one parameter

Save the first report and run the same setup again to a separate output sheet. Expect different random samples and slightly different summary statistics. A native reproducibility claim would require a documented seed mechanism; this exercise makes none.

Change B3 from 20 to 40 and run again. The theoretical output range becomes [100,140), mean 120, variance 1600/12≈133.3333 and standard deviation about 11.547. The standard deviation doubles while variance quadruples. These changes test the model’s sensitivity without promising identical standardized draws between runs.

Preserve results and recover

The versioned simulation implementation writes numeric summary values to the report. Later RAND recalculation in the model does not recreate the same sample history or automatically make that saved report describe a new run. Label reports with parameters, iteration count and run date, and save the workbook with its model and report sheets.

Close and reopen the file. Verify report values remain readable and the model still contains =RAND(), not a leftover boundary-test constant. If results fall outside the expected range, inspect the output reference, width, base and input formula before increasing the sample count. More iterations do not repair the wrong model.

Official references

Gnumeric Simulation Analysis, captured 20 October 2026; official 1.12.62 source archive, simulation.ui and tools/simulation.c. Theoretical expectations are independently calculated; no native random output is claimed.