Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I initially have ran a large, say 1000 (to be changed later) number of monte carlo simulations (mcRun), and I want to see when the average data result starts to converge to a reasonable value.

So I basically first ran 1000 simulations, and took average data based on 0 to first 10%(100), then average data based on 0 to 20%(200) and so on. So just to show the data:

For[n = 0, n < 10, n++, Print [data[n]]]

{622.917} {583.165} {564.45} {570.583} {584.956} {583.185} {579.662} {572.974} {570.253} {558.536}

So how to plot this data where Y is data[0] to data[9] and X is 0.1 mcRun, 0.2mcRun...1 mcRun. Or possibly 3D animate later using Manipulate? as I will have more sensitivity analysis to be done later.

share|improve this question
I'm not sure it this is what you mean, but have you tried ListPlot[Mean[y[[;; #]]] & /@ Range[1000]]? It plots the average of the first n elements where n ranges from 1 to 1000. You can adjust the step size to give the average of the first 10, 20, 30 etc.. elements. – E.O. Nov 22 '12 at 2:00

For example:

(*Dumbish MonteCarlo simm to calculate Pi*)
mcpi[n_Integer] :=  4 Total[Boole[Norm@# < 1] & /@ RandomReal[{-1, 1}, {n, 2}]]/n;
(*Use up to 10^8 points*)
   Accumulate[mcpi /@ ConstantArray[#, #]] Array[1/# &, #],
   Epilog -> {Red, Thick, Dashed, Line[{{1, Pi}, {#, Pi}}]},
   AxesLabel -> {TraditionalForm[Sqrt[n]], ""}] &@10000

Mathematica graphics

share|improve this answer
Yes something similar where I am looking for vary the number of simulations until something that starts to converge to get an idea if my models do converge and if so, how many simulations are roughly needed. – sebastian c. Nov 22 '12 at 13:10
@sebastianc. each point in the plot above represents "one more simulation". So the last point represents the mean of 10^4 simulations (each of them containing 10^4 points) – Dr. belisarius Nov 22 '12 at 13:29
HI @belisarius, could you provide a simpler example, I already have my data, but the simulation number with change and it is already built into my calculations, prefer to get a simpler plotting solution that trying to work out what yours does? – sebastian c. Nov 22 '12 at 23:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.