Numerical vs. Monte-Carlo Simulations

In summary: I'm not sure how it works, and what range of values it generates. But I used it before for other formulas, and it gave accurate results compared to the numerical ones.This is a good thing to check, but it is a check of convergence, not accuracy. Numerical methods are much more subtle than that and require more care if you want high precision.
  • #36
S_David said:
In the first figure, I didn't generate ##10^6## samples. In the attached figure I did. Does this change anything before going to implement your suggestion?
No. It still shows the same key features, but it is smaller and harder to see. The range is not infinite and the curve is not smooth. This is to be expected in any random number generator, but it is a source of numerical error.

If we are lucky then the sampling distribution will show some small bias.
 
  • Like
Likes EngWiPy
Physics news on Phys.org
  • #37
OK, I did your suggestion, and got the attached figures for the mean and standard deviation. What can we infer from this?
 

Attachments

  • ExpMean.jpg
    ExpMean.jpg
    16.7 KB · Views: 593
  • Expstd.jpg
    Expstd.jpg
    15.6 KB · Views: 559
  • #38
Also attached are the qq plot for the means and standard deviations calculated above
 

Attachments

  • ExpMeanQQ.jpg
    ExpMeanQQ.jpg
    14.5 KB · Views: 544
  • ExpstdQQ.jpg
    ExpstdQQ.jpg
    15.8 KB · Views: 529
  • #39
So it looks like the RNG is not too bad but the sampling distribution does show a bit heavier tails than normal and a bit of right skew.

Can you do a qq plot of the ySim against the exponential distribution instead of the normal distribution?

Also, what is the mean and standard deviation of the sampling distribution of the mean?
 
  • #40
Dale said:
So it looks like the RNG is not too bad but the sampling distribution does show a bit heavier tails than normal and a bit of right skew.

Q1: Can you do a qq plot of the ySim against the exponential distribution instead of the normal distribution?

Q2: Also, what is the mean and standard deviation of the sampling distribution of the mean?

I didn't understand your questions. For Q1: What do you mean by qq plotting ySim against the exponential distribution? and how? I qq plot ySim alone and got the attached figure.

I also didn't understand Q2. Sorry, but can you elaborate, please.
 

Attachments

  • Exp11.jpg
    Exp11.jpg
    15.5 KB · Views: 498
  • #41
OK, for Q2: the mean and the standard deviation of the mean are 1.0001 and 0.0309, respectively.
 
  • #42
S_David said:
OK, for Q2: the mean and the standard deviation of the mean are 1.0001 and 0.0309, respectively.
OK, that is essentially unbiased.
 
  • #43
So, what is the implication of this on my result?
 
  • #44
S_David said:
I didn't understand your questions. For Q1: What do you mean by qq plotting ySim against the exponential distribution? and how? I qq plot ySim alone and got the attached figure
So the qq plots you have posted so far plot against the normal distribution. The ySim values are not normally distributed so the qq plot should be done against the exponential distribution.
 
  • #45
It should be some sort of an option to plot against different distributions.
 
  • Like
Likes EngWiPy
  • #46
Right. I did it, and got the attached figure.
 

Attachments

  • ExpExp.jpg
    ExpExp.jpg
    14.3 KB · Views: 630
  • #47
Good. Do you see the deviations on the upper right and how there is some discrete steps where there are 4 points with the same vertical position? The errors from that are not well characterized. So I think you can justify not using the Monte Carlo.

It appears that there is not much, if any, bias in the sampling distribution, but the asymmetric numerical errors make those results suspicious.
 
  • Like
Likes EngWiPy
  • #48
I need to use Monte Carlo simulations as an independent verification of my results. To the best of my knowledge in my field, unless there is some numerical approximation in the mathematical analysis, Monte Carlo simulations give accurate results. I'm not sure why it's not the case here. I'm concerned that my paper will be rejected because of this simulation only, as I think the mathematical analysis is correct. I forgot if we discussed this before, but is the Monte Carlo simulation procedure I described in the other thread (see post #5) correct?
 
  • #49
Any comment on this? Is it acceptable to say on a scientific article that the small discrepancy in results is due to some inaccuracy in the simulations?
 
  • #50
S_David said:
Is it acceptable to say on a scientific article that the small discrepancy in results is due to some inaccuracy in the simulations?

What is the small discrepancy? 1 part in 1 million? 1 part in 1 billion? Is there some reason you are using an exponential distribution and not a uniform distribution for your sampling? If you post just the MC integration code, we might be able to see a problem with it.
 
  • #52
mfig said:
What is the small discrepancy? 1 part in 1 million? 1 part in 1 billion? Is there some reason you are using an exponential distribution and not a uniform distribution for your sampling? If you post just the MC integration code, we might be able to see a problem with it.

See this thread for more details. The discrepancy is shown on the figure attached on post #41. Mathematica code can be found on post #35.
 
  • #53
S_David said:
Mathematica code can be found on post #35.

Thanks, but I was asking about the Monte-Carlo code for the integration. If you post this code, someone might be able to see a shortcoming in the code, or explain the discrepancy.
 
  • #54
I explained the steps of Monte-Carlo simulations on post # 35 I believe. The rest are just semantics. Monte-Carlo is not for the integration by the way. But rather simulation of the same metric as the integration tries to evaluate. This is the idea behind it; to have two independent methods to evaluate the same quantity. I don't have the code at hand right now, but I will try to post it if necessary.
 
  • #55
S_David said:
Monte-Carlo is not for the integration by the way.

I see. I was under the impression you were comparing the results of some numerical integration technique to a MC integration method. Now that I know there are other, unseen, codes involved somewhere along the way I see no way of relating the results of the numerical integration technique mentioned in the first post to the results of some other simulation involving a MC technique somehow. :(

Good luck!
 
  • #56
S_David said:
Any comment on this? Is it acceptable to say on a scientific article that the small discrepancy in results is due to some inaccuracy in the simulations?
I wouldn't even report the Monte Carlo results. I don't trust them. There are too many unknowns and uncontrolled errors.
 
  • #57
Dale said:
I wouldn't even report the Monte Carlo results. I don't trust them. There are too many unknowns and uncontrolled errors.

But it's a good practice in my field to verify the numerical results. Most reviewers don't follow the mathematical derivations, and judge by the results and the general trend.
 
  • #58
Isn't your whole concern that the Monte Carlo simulation does not verify your result?

In any case, the Monte Carlo is also a numerical result, so how can you use one numerical result to verify another. Since the two methods disagree then there are two possibilities, either you made a mistake in the code or numerical errors are causing the disagreement. If the disagreement is due to numerical errors then the problem is in the Monte Carlo since it does not control numerical errors.
 
  • #59
Dale said:
Isn't your whole concern that the Monte Carlo simulation does not verify your result?

In any case, the Monte Carlo is also a numerical result, so how can you use one numerical result to verify another. Since the two methods disagree then there are two possibilities, either you made a mistake in the code or numerical errors are causing the disagreement. If the disagreement is due to numerical errors then the problem is in the Monte Carlo since it does not control numerical errors.

If the discrepancy is huge or not constant, then yes, I would say there is something wrong definitely. But the discrepancy is very small and constant. By numerical I meant plotting a mathematical equation vs. averaging which is the case in Monte Carlo simulations. Both are two different and independent methods to evaluate the same results. Monte Carlo is a verification in this sense. You are right though, I might have made a mistake. In that case I haven't found it.
 

Similar threads

Replies
13
Views
2K
Replies
4
Views
2K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
34
Views
4K
Replies
5
Views
3K
Replies
8
Views
3K
Back
Top