### Probability Density Functions

```Propagation of Uncertainty
Jake Blanchard
Spring 2010
Uncertainty Analysis for Engineers
1
Introduction
We’ve discussed single-variable
probability distributions
 This lets us represent uncertain inputs
 But what of variables that depend on
these inputs? How do we represent their
uncertainty?
 Some problems can be done analytically;
others can only be done numerically
 These slides discuss analytical approaches

Uncertainty Analysis for Engineers
2
Functions of 1 Random Variable
Suppose we have Y=g(X) where X is a
random input variable
 Assume the pdf of X is represented by fx.
 If this pdf is discrete, then we can just
map pdf of X onto Y
 In other words X=g-1(Y)
 So fy(Y)=fx[g-1(y)]

Uncertainty Analysis for Engineers
3
Example
Consider Y=X2.
 Also, assume discrete pdf of X is as
shown below
 When X=1, Y=1; X=2, Y=4; X=3, Y=9

0.4
0.4
0.35
0.35
0.3
0.3
0.25
0.25
0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0
0
0
1
2
3
4
5
6
0
5
10
15
20
Uncertainty Analysis for Engineers
25
30
4
Discrete Variables

Example:
◦ Manufacturer incurs warranty charges for
system breakdowns
◦ Charge is C for the first breakdown, C2 for the
second failure, and Cx for the xth breakdown
(C>1)
◦ Time between failures is exponentially
distributed (parameter ), so number of failures
in period T is Poisson variate with parameter
T
◦ What is distribution for warranty cost for T=1
year
Uncertainty Analysis for Engineers
5
Formulation
e x
f ( x) 
 x  0,1, 2, ...
x!
x0
0
w  h( x )   x
x  1, 2, ...
C

 0

x
 ln(w)
 ln(C )

w0
w  C , C 2 , ...




e
w0


p ( w)  
   ln(w) ln(C ) 
e 
2
w

C
,
C
, ...
  ln(w)
!


ln(C ) 
 Uncertainty
Analysis for Engineers
6
Plots
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
0.4
1
1.5
2
2.5
3
3.5
x
4
4.5
5
0.35
0.3
0.25
C=2
=1
0.2
0.15
0.1
0.05
0
0
5
10
15
20
25
Uncertainty Analysis for Engineers
w
30
35
7
CDF For Discrete Distributions
If g(x) monotonically increases, then
P(Y<y)=P[X<g-1(y)]
 If g(x) monotonically decreases, then
P(Y<y)=P[X>g-1(y)]
 …and, formally,
F ( y)  F g 1 ( y) 

Y
 p (x )
X
1
x
i
xi  g ( y )
y
y
x
x
Uncertainty Analysis for Engineers
8
Another Example

Suppose Y=X2 and X is Poisson with
parameter 
Y  X  g( X )
2
1
g (Y )  X  Y
px

 t

py

 t

x
x!
e  t
y
 y !
e
 t
x  0,1,2,3,...
y  0,1,4,9,...
Uncertainty Analysis for Engineers
9
Continuous Distributions

If fx is continuous, it takes a bit more work
f
FY ( y ) 
g 1 ( y )
x
( x)dx 
x  g 1 ( y )
f
x
( x)dx

x  g 1  y 
dg 1 ( y )
dx 
dy
dy


1
dg
( y)
1
FY ( y )   f x g  y 
dy
dy

y
or
1
dF
dg
f y ( y) 
 f x g 1
dy
dy
 
Uncertainty Analysis for Engineers
10
Example
Y
X 

X  g 1 ( y )     Y
dg 1

dy
im agine
Normal distribution
Mean=0, =1
2

1
1  X    
fx 
exp 
 
2 
 2    
  y2 
1

fy 
exp
2 
 2 
fy 
  y2 
1

exp
2
 2 
Uncertainty Analysis for Engineers
11
Example Y  ln(X )

X is
lognormal
Normal
distribution
X  g 1 ( y )  exp(Y )
dg 1
 exp(Y )
dy
im agine
2

1
 1  ln(x)    
 
fx 
exp 

2  x
 2 
 
2

1
1  y    
  exp(y )
fy 
exp 
2  exp(y )
 2    
2

1
1  y    
 
fy 
exp 
2 
 2    
Uncertainty Analysis for Engineers
12
If g-1(y) is multi-valued…
k
 
fY ( y )   f x g i1
i 1
dg 1
dy
Exam ple
U  cS 2
S 
u
c
dS
1

du 2 cu
  u

u  1
  fs  

f u   f s 


c  2 cu
  c 

S  l ognorm al( ,  )
Uncertainty Analysis for Engineers
13
Example (continued)
2

1
 1  ln(s )    
 
fs 
exp 

2  s
 2 
 
lognormal
2
  
 

u
  ln
  

  1
  1   c 
1
fu 
exp 
 
2

u
  2 cu
 
2 
 
 
c

 

2

1
 1  lnu   lnc   2  
 
fu 
exp 
2
2 2 u
 2 
 
u  lnc   2
 u  2
Uncertainty Analysis for Engineers
14
Example
FV 2
Z
 aV 2
1400d
im agine
v
1
 v  0
f v  exp
v0
 v0 
v
Z
a
dV
1

dz 2 az
  z

 z 1
z  1
  fv  


f z   f v 
 f v 




a  2 az

 a  2 az
  a 

z

1 1
a

exp
 v0
2 az v0








Uncertainty Analysis for Engineers
15
A second example
Suppose we are making strips of sheet
metal
 If there is a flaw in the sheet, we must
 We want an assessment of how much
waste we expect
 Assume flaws lie in line segments (of
constant length L) making an angle  with
the sides of the sheet
  is uniformly distributed from 0 to 

Uncertainty Analysis for Engineers
16
Schematic
L

w
Uncertainty Analysis for Engineers
17
Example (continued)

Whenever a flaw is found, we must cut
out a segment of width w
w  h   L sin  
f  U 0,  
 w
 w  sin  
L
1
2 1/ 2 

d 1   w   
 1      
dw L   L   


1
L2  w2
Uncertainty Analysis for Engineers
18
Example (continued)
 g-1
is multi-valued
</2
f1  w  
f 2 w  
1
 L w
2
2
>/2
1
 L w
2
0w L
2
f w  f1  w   f 2  w  
0w L
2
 L w
2
2
Uncertainty Analysis for Engineers
19
Results
5
4.5
4
3.5
pdf
3
2.5
2
1.5
1
L=1
0.5
0
0.1
0.2
0.3
0.4
0.5
w
0.6
0.7
0.8
0.9
1
1
0.9
0.8
0.7
0.6
cdf
0.5
0.4
0.3
0.2
0.1
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
w Analysis for Engineers
Uncertainty
1
20
Functions of Multiple Random
Variables
Z=g(X,Y)
 For discrete variables

fz 
f
x, y
g ( xi , y j )  z
( xi , y j )
If we have the sum of random variables
 Z=X+Y

fz 
f
xi  y j  z
x, y
( xi , y j ) 
 f x , z  x 
x, y
i
i
all xi
Uncertainty Analysis for Engineers
21
Example

Z=X+Y
0.7
0.6
0.4
0.3
0.2
0.45
0.1
0.4
0
0
0.5
1
1.5
2
2.5
3
3.5
0.35
0.3
x
fy
fx
0.5
0.25
0.2
0.15
0.1
0.05
0
0
5
10
15
20
25
30
35
y
Uncertainty Analysis for Engineers
22
Analysis
X
Y
Z
P
Z-rank
1
10
11
.08
1
1
20
21
.04
4
1
30
31
.08
7
2
10
12
.24
2
2
20
22
.12
5
2
30
32
.24
8
3
10
13
.08
3
3
20
23
.04
6
3
30
33
.08
9
Uncertainty Analysis for Engineers
23
Result
0.3
0.25
fz
0.2
0.15
0.1
0.05
0
0
5
10
15
20
25
30
35
Z
Uncertainty Analysis for Engineers
24
Example

Z=X+Y
0.7
0.6
fx
0.5
0.4
0.3
0.2
fy
0.1
0
0
0.5
1
1.5
2
x
2.5
3
0.45
0.4
3.5 0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
y
Uncertainty Analysis for Engineers
25
Analysis
X
Y
Z
P
Z-rank
1
2
3
.08
1
1
3
4
.04
2
1
4
5
.08
3
2
2
4
.24
2
2
3
5
.12
3
2
4
6
.24
4
3
2
5
.08
3
3
3
6
.04
4
3
4
7
.08
5
Uncertainty Analysis for Engineers
26
Compiled Data
z
fz
3
.08
4
.28
5
.28
6
.28
7
.08
fz
0.3
0.25
0.2
0.15
0.1
0.05
0
0
1
2
3
4
z
5
6
7
8
Uncertainty Analysis for Engineers
27
Example
Z  X Y

vt 

x
fx
exp(vt)
x and y are integers
x!
y

 t
fy 
exp(  t )
y!
f z   f x ( x) f y ( z  x)  
all x
vt   t 
x!( z  x)!
allx
fz  t
exp    v t 

v   
exp    v t 
x
z
zx
x
allx
zx
x!( z  x)!
Uncertainty Analysis for Engineers
28
Example (continued)
v   
x

  

zx
z
 x!( z  x)!
z!
allx


  v t 

z
fz
z!
exp    v t 
The sum of n independent
Poisson processes is Poisson
Uncertainty Analysis for Engineers
29
Continuous Variables
Z  g( X ,Y )
Fz ( z )  
f
x, y
g ( x , y ) z
( x, y )dxdy
1
g
Fz ( z ) 
f
x, y
( x, y )dxdy

x  g 1 ( z , y )  g 1
 z
dg 1
Fz ( z )    f x , y ( g , y )
dzdy
dz
  
1
z 
1
dg
Fz ( z )    f x , y ( g 1 , y )
dydz
dz
  
Uncertainty Analysis for Engineers
30
Continuous Variables

1
dg
f z ( z )   f x , y ( g 1 , Y )
dY
dz


dg 1
  f x, y ( X , g )
dX
dz

1
if
Z  aX  bY
Z  bY
X
a
dg 1 1

dz
a

1
Z  bY
f z   f x, y (
, Y )dY
a
a

Uncertainty Analysis for Engineers
31
Continuous Variables (cont.)

1
Z  bY
f z   f x, y (
, Y )dY
a
a


1
Z  aX
f z   f x, y ( X ,
)dX
b
b

x, y independent 

1
Z  bY
fz   fx (
) f y (Y )dy
a
a

Uncertainty Analysis for Engineers
32
Example
W  U  V ; U ,V  0
 u 
fu 
exp

2 m u
 2m 
1
 v 
fv 
exp

2 m v
 2m 
1

fw 



f u (u ) f v ( w  u )du  


1
 w 1
fw 
exp

2m
 2m    u
1
 u 
  (w  u) 
exp
exp


du
2 m u
 2m  2 m( w  u )
 2m 
1
1
du
wu
du
 w
fw 
exp

2 m
 2m  0 u ( w  u )
1
fw 
1
 w
exp

2m
 2m 
w
Uncertainty Analysis for Engineers
33
In General…

If Z=X+Y and X and Y are normal dist.

fz 
f
x
( z  y ) f y ( y )dy


fz 


2
2



 y  y  
1
1  z  y  x 
1
1
  dy
 
exp 
exp 

x
 2   y  
2  x
 2 
  2  y


2
2




y


 z  y  x  1
1

1
y
 dy
  
fz 
exp 

2 x y   2 
x
2   y  




fz 


1
2  x2   y2

2
 




z




1
x
y  
exp 
 2   2  2  
x
y
 
 
Then Z is also normal with
z  x   y
 2   2  2
UncertaintyzAnalysis forx Engineersy
34
Products
Z  XY
Z
X
Y
X 1

Z Y

1
z
f z ( Z )   f X ,Y ( , y )dy
Y
y

im agineX i all l ognorm aland
n
Z   Xi
i 1
n
ln(Z )   ln(X i )
i 1
n
Z    X
i 1
i
n
    X2
2
Z
i 1
i
Uncertainty Analysis for Engineers
35
Example

W, F, E are lognormal
WF
C
E
1
ln(C )  ln(W )  ln(F )  ln(E )
2
1
C  W  F  E
2
1 
     E 
2 
2
C
2
W
2
2
F
Uncertainty Analysis for Engineers
36
Central Limit Theorem

The sum of a large number of individual
random components, none of which is
dominant, tends to the Gaussian
distribution (for large n)
Uncertainty Analysis for Engineers
37
Generalization

More than two variables…
Z  g ( x1 , x2 , x3 ,..., xn )




f Z ( z )   ...  f x1 ,...,xn
1

g
g 1 , x2 , x3 ,..., xn
dx2 dx3 ...dxn
z


Uncertainty Analysis for Engineers
38
Moments

Suppose Z=g(X1, X2, …,Xn)








E ( Z )   ...  z f X 1 , X 2 ,...,X n ( X 1 , X 2 ,..., X n )dX1dX 2 ...dX n
E ( Z )   ...  g ( X 1 , X 2 ,..., X n ) f X1 , X 2 ,...,X n ( X 1 , X 2 ,..., X n )dX1dX 2 ...dX n
im agine
Y  aX  b




E (Y )   Y f y ( y )dy   (ax  b) f x ( x)dx




E (Y )  a  x f x ( x)dx  b  f x ( x)dx  aE( X )  b
Uncertainty Analysis for Engineers
39
Moments

  ax  b  
Var (Y )  E Y  Y  
2

2

f x ( x)dx
Y


Var (Y ) 
2


ax

b

aE
(
x
)

b
f x ( x)dx



Var (Y )  a 2
2


x

E
(
x
)
f x ( x)dx


Var (Y )  a 2Var ( X )
Uncertainty Analysis for Engineers
40
im agine
Moments
Y  aX1  bX 2
E (Y )  aE( X 1 )  bE( X 2 )
 
Var (Y ) 
  y   
2
f x1 , x2 ( x1 , x2 )dx1dx2
y
  
 
Var (Y ) 
  ax  bx
2  a x1  b x2
1

2
f x1 , x2 ( x1 , x2 )dx1dx2
  
 
Var (Y )  a 2
  x   
2
1
x1
f x1 , x2 ( x1 , x2 )dx1dx2
  
 
 b2
  x
2   x2

2
f x1 , x2 ( x1 , x2 )dx1dx2
  
 
 2ab 
 x
1


  x1 x2   x2 f x1 , x2 ( x1 , x2 )dx1dx2
  
Var (Y )  a 2Var ( X 1 )  b 2Var ( X 2 )  2abCov( X 1 , X 2 )



Cov( X 1 , X 2 )  E X 1   X 1 X 2   X 2  E (Uncertainty
X 1 X 2 ) Analysis
 E( X
)E( X )
for1Engineers 2
41
Approximation
Y  g( X )

E (Y ) 
 g( X ) f
x
( X )dX

dg
g ( X )  g ( x )   X   x 
dx

dg 

E (Y )    g (  x )   X   x   f x ( X )dX
dx 
 


dg
E (Y )   g (  x ) f x ( X )dX    X   x 
f x ( X )dX
dx




dg
 X   x  f x ( X )dX
E (Y )  g (  x )  f x ( X )dX 

dx 

E (Y )  g (  x )
Uncertainty Analysis for Engineers
42
Approximation

Var (Y ) 
 g ( X )   
2
y
f x ( X )dX

dg
g ( X )  g ( x )   X   x 
dx

Var (Y ) 
2
dg




g
(

)

X




x
y  f x ( X ) dX
 x
dx


Var (Y ) 
2
dg 



X


f x ( X )dX
x


dx 
 dg 
Var (Y )   
 dx 
2 
2


X


f x ( X )dX
x


 dg
Var (Y )  Var  X 
 dx




x x 
2
Uncertainty Analysis for Engineers
43
Second Order Approximation
Y  g( X )

E (Y ) 
 g( X ) f
x
( X )dX

2
dg 1
d
g
2
g ( X )  g ( x )   X   x    X   x 
dx 2
dx2

2

1
d
g
2
E (Y )    g (  x )   X   x 
f ( X )dX
2  x
2
dx 
 

1 d 2g
2


E (Y )  g (  x ) 
X


f x ( X )dX
x
2 
2 dx 
1 d 2g
E (Y )  g (  x ) 
2 dx2
Var ( x)
x x
Uncertainty Analysis for Engineers
44
Approximation for Multiple Inputs
Y  g ( X 1 , X 2 , X 3 ,..., X n )

E (Y )  g  X1 ,  X 2 ,  X 3 ,..., X n
 g 

Var (Y )    
i 1
 X i 
n

1 n 2  2 g 
   xi  2 
2 i 1  xi 
2
2
Xi
Uncertainty Analysis for Engineers
45
Example
WF
C
E
Example 4.13
 Do exact and then use approximation and
compare
 Waste Treatment Plant – C=cost,
W=weight of waste, F=unit cost factor,
E=efficiency coefficient

median
cov
W
2000 ton/y
.2
F
\$20/ton
.15
E
1.6
.125
Uncertainty Analysis for Engineers
46
Solving…
W  lnWmedian   7.6009
F  lnFmedian   2.9957
E  lnEmedian   0.4700
 W  ln 1  covW2   0.19804
 F  ln 1  cov2F   0.149166
 E  ln 1  cov2E   0.124516
1
lnC   lnW   lnF   lnE 
2
1
C  E lnC   W  F  E  10.36
2
1 2
2
2
 C   W   F   E  0.25563
4
1 

C  exp C   C2   32,620
2 

 C  C exp C2   1  8477
Uncertainty Analysis for Engineers
47
Approximation
1 2 2g 1 2 2g 1 2 2g
E (C )  g W ,  F ,  E    W
 F
 E
2
W 2 2
F 2 2
E 2
g W ,  F ,  E  
W  F
E
W  2039.6;  F  20.223;  E  1.6124
 W  407.915;  F  3.033;  E  0.2016
W  F
32620 32483
 32,483; error 
 0.4%
32620
E
2g 2g

0
W 2 F 2
 2 g 3W  F

2
E
4 E5 / 2
W  F 1 2  2 g
 E
 32673
2
 E 2 E
error 
32673 32620
 0.16%
32620
Uncertainty Analysis for Engineers
48
Variance
2  g 
2  g 
2  g 
Var (C )   W 
  F 
 E

 W 
 F 
 E 
2

2  F
Var (C )   W
 
E

 C  8370
2
2


   F2  W

 
E


2
2

   E2  W  F
 2 3 / 2

 E




2
8477 8370
error 
 1.3%
8477
Uncertainty Analysis for Engineers
49
```