Shivoham
Shivoham

Reputation: 23

Monte Carlo Method crash?

I have a big problem trying to implement Monte Carlo Method to this function:

D=log(T)

Where T is a measured time, so T>0, and, obviously, it has a normal distribution.

I have 10 measured values of T in the experiment, so I calculate:

m_T (mean of T)  = 3.0 seconds
s_T (standard deviation of T)= 1.5 seconds

And, with this parameters I simulate T and, then, D:

T = Normal(m_T, s_T)
D=log(Normal(m_T, s_T)

But in D the program returns an error. When I depurate I find that the error is because Normal (m_T, s_T) have some NEGATIVE values, so log(NEGATIVE) crash!

I’m blocked, I don’t know how to continue… any suggestion? Thank you very much!

Upvotes: 0

Views: 329

Answers (2)

csgillespie
csgillespie

Reputation: 60502

A couple of comments:

  1. obviously, it has a normal distribution. This isn't obvious in the slightest. What might be better would be to use a Log Normal distribution. I strongly suspect that a truncated normal isn't what you are after. Using your parameters, we get the figure are the end. Notice that it has a rather high probability at x=0.

  2. Instead, you want to use Log-Normal, exponential, or some other more suitable distribution. You can match the moments from the true distribution to your observed values or use their maximum likelihood estimators.

enter image description here

Upvotes: 0

Javier
Javier

Reputation: 12398

By definition, the normal distribution always yields a finite probability for negative values. Then what you have measured (time) has not strictly a normal distribution.

A truncated normal distribution assigns a probability of 0 to every value that do not fall in a certain bound, but by ignoring values below 0 your will modify the mean and variance of the distribution.

Upvotes: 1

Related Questions