Monte Carlos Simu. Slides Stats
Monte Carlos Simu. Slides Stats
Monte Carlos Simu. Slides Stats
random variable?
Why is the method called Monte Carlo?
SOURCE: http://pics.hoobly.com/full/AA7G6VQPPN2A.jpg
Web links:
http://www.riskglossary.com/link/monte_carlo_method.htm
http://physics.gac.edu/~huber/envision/instruct/montecar.htm
a function h(X):
sample X: [x1,x2,,xn];
Calculate [h(x1),h(x2),,h(xn)]; use to approximate
statistics of h.
Example: X is U[0,1]. Use MCS to find mean of X2
x=rand(10); y=x.^2; %generates 10x10 random matrix
mean=sum(y)/10
x =0.4017 0.5279 0.1367 0.3501 0.3072 0.3362 0.3855
0.3646 0.5033 0.2666
mean=0.3580
SOURCE:
http://www.sz-wholesale.com/uploadFiles/041022104413s.jpg
Basic Monte
Carlo
Given a random variable X and
Obtaining distributions
Histogram: y=randn(100,1); hist(y)
25
20
15
10
0
-3
-2
-1
1
0.9
0.8
0.7
F(x)
0.6
0.5
0.4
0.3
0.2
0.1
0
-3
[f,x]=ecdf(y);
-2
-1
Histogram of average
x=rand(100); y=sum(x)/100; hist(y)
35
30
25
20
15
10
5
0
0.42
0.44
0.46
0.48
0.5
0.52
0.54
0.56
0.58
Histogram of average
x=rand(1000); y=sum(x)/1000; hist(y)
140
120
100
80
60
40
20
0
0.46
0.47
0.48
0.49
0.5
0.51
0.52
0.53
Distribution of x
x=rand(10000,1);
x2=x.^2;
hist(x2,20)
2500
2000
1500
1000
500
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Other distributions
Other distributions available in matlab
For example, Weibull distribution
600
f ( x) ba b x b 1e x / a
for x 0
500
400
r=wblrnd(1,1,1000);
hist(r,20)
300
200
100
10
12
14
Correlated Variables
Cov( X , Y ) E[ X x Y y ]
Cov( X , Y )
xy
x y
Example
mu = [2 3];
sigma = [1 1.5; 1.5 3];
r = mvnrnd(mu,sigma,20);
5
plot(r(:,1),r(:,2),'+')
4.5
4
3.5
3
2.5
2
1.5
1
0.5
0
0.5
1.5
2.5
3.5
r = mvnrnd(mu,sigma,20);
sum(r)/20
ans =2.3327 2.2184
5
4
2
2
-1
-2
-1
0.5
1.5
2.5
3.5
-2
0.5
1.5
2.5
3.5
4.5
Evaluating probabilities of
failure
Failure is defined in terms of a limit state
function that must satisfy g(r)>0, where r is a
Pf m / N
vector of random variables.
Probability of failure is estimated as the ratio of
number of negative gs, m, to total MC sample
size, N
The accuracy of the estimate is poor unless N
Pf (1 Pf )
is much larger than 1/Pf
P
For small Pf
Pf
1
m
problems probability
of failure
1. Derive formula for the standard
deviation of estimate of Pf
2. If x is uniformly distributed in
[0,1], use MCS to estimate the
probability that x2>0.95 and
estimate the accuracy of your
estimate from the formula.
3. Calculate the exact value of the
answer to Problem 2 (that is
without MCS).
Reading assignment
Ravishankar, Bharani, Smarslok B.P., Haftka R.T., Sankar B.V.
(2010)Error Estimation and Error Reduction in Separable
Monte Carlo Method AIAA Journal ,Vol 48(11), 2225
2230 .