Monte Carlo simulationΒΆ

Using the probability distribution the probability distribution of a random vector \inputRV, we seek to evaluate the following probability:

P_f = \Prob{g\left( \inputRV \right) \leq 0}

Here, \inputRV is a random vector, \model the function known as limit state function which enables the definition of the event \cD_f = \{\vect{x} \in \Rset^{\inputDim} \, / \, \model(\inputRV) \le 0\}.

If we have the set \left\{ \vect{x}_1,\ldots,\vect{x}_\sampleSize \right\} of \sampleSize independent samples of the random vector \inputRV, we can estimate \widehat{P}_f as follows:

\widehat{P}_f = \frac{1}{\sampleSize} \sum_{i=1}^\sampleSize \mathbf{1}_{ \left\{ \model(\vect{x}_i) \leq 0 \right\} }

where \mathbf{1}_{ \left\{ \model(\vect{x}_i) \leq 0 \right\} } describes the indicator function equal to 1 if \model(\vect{x}_i) \leq 0 and equal to 0 otherwise; the idea here is in fact to estimate the required probability by the proportion of cases, among the \sampleSize samples of \inputRV, for which the event \cD_f occurs.

By the law of large numbers, we know that this estimation converges to the required value P_f as the sample size \sampleSize tends to infinity.

The Central Limit Theorem allows one to build an asymptotic confidence interval using the normal limit distribution as follows:

\lim_{\sampleSize\rightarrow\infty}\Prob{P_f\in[\widehat{P}_{f,\inf},\widehat{P}_{f,\sup}]} = \alpha

with

\widehat{P}_{f,\inf} = \widehat{P}_f - q_{\alpha}\sqrt{\frac{\widehat{P}_f(1-\widehat{P}_f)}{\sampleSize}},
\widehat{P}_{f,\sup} = \widehat{P}_f + q_{\alpha}\sqrt{\frac{\widehat{P}_f(1-\widehat{P}_f)}{\sampleSize}}

and q_\alpha is the (1+\alpha)/2-quantile of the standard normal distribution.

One can also use a convergence indicator that is independent of the confidence level \alpha: the coefficient of variation, which is the ratio between the asymptotic standard deviation of the estimate and its mean value. It is a relative measure of dispersion given by:

\textrm{CV}_{\widehat{P}_f}=\sqrt{ \frac{1-\widehat{P}_f}{\sampleSize \widehat{P}_f}}\simeq\frac{1}{\sqrt{\sampleSize\widehat{P}_f}}\mbox{ for }\widehat{P}_f\ll 1

It must be emphasized that these results are asymptotic and as such needs that \sampleSize\gg 1. The convergence to the standard normal distribution is dominated by the skewness of \mathbf{1}_{ \left\{ \model(\vect{x}_i) \leq 0 \right\} } divided by the sample size \sampleSize, it means \frac{1-2P_f}{\sampleSize\sqrt{P_f(1-P_f)}}. In the usual case P_f\ll 1, the distribution is highly skewed and this term is approximately equal to \frac{1}{\sampleSize\sqrt{P_f}}\simeq\textrm{CV}_{\widehat{P}_f}/\sqrt{\sampleSize}. A rule of thumb is that if \textrm{CV}_{\widehat{P}_f}<0.1 with \sampleSize>10^2, the asymptotic nature of the Central Limit Theorem is not problematic.

(Source code, png)

../../_images/monte_carlo_simulation-1.png

The method is also referred to as Direct sampling, Crude Monte Carlo method, Classical Monte Carlo integration.