Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 39

Statistics

ME537 Numerical Methods for Engineers


University of Gaziantep
Faculty of Engineering
Dr. Mustafa Özakça
Lecture 1997

file: stat.ppt p.1


Why statistics in a course on
numerical methods?
• Inputs on models are – receptor specific
• body weight
typically variable and
• ingestion rate
uncertain – chemical specific
– media specific
• Henry’s law constant
• hydraulic conductivity
• decay rate
• organic carbon content
• toxicity values
• wind speed
– landuse specific
• industrial
• commercial

file: stat.ppt p.2


Why statistics in a course on
numerical methods?

• Inputs on models are typically variable and


uncertain
• Best represented by probability distributions
• Tools for estimating values
• Quantifying uncertainty
• Tool for risk assessment

file: stat.ppt p.3


Random Variables
• Discrete
– variable can only attain a finite number of
values.
• Continuous
– variable can be from zero to infinity.

file: stat.ppt p.4


Probability
number of successes m
Probability of Occurrence  
total number of trials n

m
 lim 
n n

file: stat.ppt p.5


The following properties are associated with
probability.

1. Probability is a nonnegative number.


2. If an event is certain, then m and n are equal and p(x) = 1
3. Mutually exclusive
p(A+B) = p(A) + p(B)

In other words, the probability of A or B is the sum of the


probability of either event. For example, the probability of 2
or 4 on the throw of a dice is:
p(2) + p(4) = 1/6 + 1/6 = 1/3

file: stat.ppt p.6


4. If events are independent
p(AB) = p(A) . p(B)

The occurrence of one does not affect the occurrence of


the other. For example, the probability that 2 and 4 will
occur in two dice simultaneously thrown is:

p(2,4) = p(2) . p(4) . 2


= (1/6) . (1/6) . (2)
= 1/18

file: stat.ppt p.7


Density Function
The density function is defined as the function
which yields the probability that the random
variable takes on any one of its values.

Density function
Probability of Occurrence

for a continuous
random variable
p(x) = f(x)

x
file: stat.ppt p.8
Density function for a discrete
random variable

1/
6
f(x)

# on dice
file: stat.ppt p.9
Cumulative Distribution
Function, F(x)
Allows us to determine
the probability
that x is less than
or equal to a
F(x)

Continuous
function

x
file: stat.ppt p.10
For a continuous variable
a a

F (x  a)  F (a )   p( x ) dx   f ( x ) dx  P( x  a )
 

For a discrete variable


F ( x  a )  p( x1 )  p( x 2 )  p( a )

file: stat.ppt p.11


Cumulative distance: Discrete function
F(x)

5/6

2/3

1/2

1/3

1/6

0 1 2 3 4 5 6

# on dice file: stat.ppt p.12


a
F ( x  a )   p( xi )


where xi  a
a
F ( x  a ) can be expressed as:
 f ( x)dx
0
Probability of Occurrence

which is the
area under
the density
p(x) = f(x)

function
a x
file: stat.ppt p.13
Samples and Populations
• Sample- a random selection of items from a
lot or population in order to evaluate the
characteristics of the lot or population
– mean
– expected value
– variance

file: stat.ppt p.14


Mean or Expected Value
  E (x)   xf (x) dx. continuous
n
  E (x)   xi p(xi )
i 1 discrete

In the case of a discrete sample, is this


the mean?

file: stat.ppt p.15


Example:
Expected value on dice
6
E ( x )   xi p( x )
i 1

 1  1  1  1  1  1
 1   2   3   4   5   6 
 6  6  6  6  6  6
 35
.

...end of problem

file: stat.ppt p.16


Example:
Let x = # of hours of a light bulb.
Find the expected life.

 20,000 x  100

f ( x)   x 3
 0 elsewhere

  E (x)   xf (x) dx.


20,000
  E (x)   x( 3 ) dx
100
x

file: stat.ppt p.17


Example (cont.)

 20,000 x  100

f ( x)   x 3
 0 elsewhere


20,000
  E (x)   x( 3 )dx
100
x
 200
...end of problem

file: stat.ppt p.18


Variance
Describes the “spread” or shape of the
distribution

1 2 3 0 1 2 3 4

file: stat.ppt p.19


The following equations describe the
discrete and continuous cases for variance.

 2  E[( x   ) 2 ]   ( x   ) 2 f ( x ) discrete
x


2
 ( x   ) f ( x )dx continuous


file: stat.ppt p.20


Example:
Let x = number of orders received per day
Probability density function: Company A

x 1 2 3

f(x) 0.3 0.4 0.3

Probability density function: Company B

x 0 1 2 3 4

f(x) 0.2 0.1 0.3 0.3 0.1

file: stat.ppt p.21


Probability density function: Company A
x 1 2 3

f(x) 0.3 0.4 0.3

  E ( x )  1( 0.3)  2(0.4)  3(0.3)


 2.0

Probability density function: Company B

x 0 1 2 3 4

f(x) 0.2 0.1 0.3 0.3 0.1

  E ( x )  0(0.2)  1(0.1)  2(0.3)  3(0.3)  4(01


.)
 2.0
file: stat.ppt p.22

Variance 2  

( x   ) 2
f ( x )dx

Company A
 2  (1  2) 2 ( 0.3)  (2  2) 2 (0.4)  (3  2) 2 (0.3)
 0.6

Company B
 2  (0  2) 2 (0.2)  (1  2) 2 (01
. )  (2  2) 2 (0.3)
 (3  2) 2 (0.3)  (4  2) 2 (01
.)
 16
.

1 2 3 0 1 2 3 4

...end of problem file: stat.ppt p.23


Third moment
measure of asymmetry

If symmetric  ( x   ) 3
f ( x ) dx
S= 0 

+ -
Often referred
to as skewness, s

file: stat.ppt p.24


Fourth moment,
measure of flatness


4
( x   ) f ( x )dx


small kurtosis

large kurtosis

file: stat.ppt p.25


Monte Carlo Technique
A technique for modeling processes that
involve random variables.

You need:

• a random variable and its probability distribution


• a sequence of random numbers

file: stat.ppt p.26


Suppose x is a random number that
describes the demand per day of a
commodity where:

01. x0
0.2 x 1

f ( x)  
0.4 x2
0.3 x3

file: stat.ppt p.27


Cumulative distribution function

0 x 0
0.1 0 x 1

F (x)  0.3 1 x  2
0.7 2  x 3

10
. x 3

file: stat.ppt p.28


The task is to generate values of x (demand)
such that the relative frequency of each value of
k will be equal to its probability.

Need a sequence of random numbers

Will use the “MIDSQUARE” technique

file: stat.ppt p.29


Monte Carlo Method
1. Take a 4 digit number (preferably selected
at random)
2. Square the number
3. Take 4 digits starting at the third from the
left.
4. Record
5. Square -------- etc

file: stat.ppt p.30


ie. Select 1653

(1653)2 = 53640976

Select 6409

1653, 6409, 0752, ......... 0  x  9999

file: stat.ppt p.31


ENGR 351 Numerical Methods for Engineers
Random numbers

Monte Carlo Excel


Using the random number function =rand()

6922 47914084 0.6922 0.351035 0.506976 0.062371


9140 83539600 0.914 0.61144 0.223697 0.755061
5396 29116816 0.5396 0.492761 0.143406 0.661436
1168 1364224 0.1168 0.964795 0.597764 0.169609
3642 13264164 0.3642 0.269986 0.851376 0.944191
2641 6974881 0.2641 0.718226 0.571283 0.109774
9748 95023504 0.9748 0.401943 0.77973 0.305236
235 55225 0.0235 0.953922 0.934942 0.937367
552 304704 0.0552 0.301322 0.279323 0.095127
3047 9284209 0.3047 0.543647 0.44348 0.453443
2842 8076964 0.2842 0.365798 0.632637 0.476239
769 591361 0.0769 0.909206 0.338302 0.354158
5913 34963569 0.5913 0.851988 0.67051 0.398465
9635 92833225 0.9635 0.238579 0.286329 0.536336
8332 69422224 0.8332 0.585925 0.248756 0.565883
4222 17825284 0.4222 0.454564 0.244167 0.745273
8252 68095504 0.8252 0.375883 0.179672 0.540868
955 912025 0.0955 0.749491 0.766341 0.075105
9120 83174400 0.912 0.25066 0.450009 0.818404
1744 3041536 0.1744 0.172349 0.745362 0.753676
415 172225 0.0415 0.111162 0.407399 0.064557
1722 2965284 0.1722 0.461135 0.274751 0.227784
9652 93161104 0.9652 0.361817 0.543096 0.282072
1611 2595321 0.1611 0.06993 0.956483 0.438041
5953 35438209 0.5953 0.282377 0.829095 0.211325

average 0.454512 0.473998 0.516195 0.439272


standard deviation 0.343788 0.260592 0.251293 0.280533

file: stat.ppt p.32


Recall that we are studying the following
system:
Suppose x is a random number that
describes the demand per day of a
commodity where:

0.1 x 0
0.2 x 1

f ( x)  
0.4 x 2
0.3 x 3

file: stat.ppt p.33


The “middle” digits are considered random.
Since the study of demand requires 4 subsets.
Using:

x Random
0 0 - 999 (10%)
1 1000 - 2999 (20%)
2 3000 - 6999 (40%)
3 7000 - 9999 (30%)

Number 7324 x=3


6409 x=2 file: stat.ppt p.34
x Random
0 0 - 999
1 1000 - 2999
2 3000 - 6999
3 7000 - 9999 Random Ct.
#
9140 3
5396 2
1168 1
3642 2

Total: 8

file: stat.ppt p.35


Example: Generate numbers with class
Probability of hydraulic conductivity
Ground surface dh
v  K
dx
Soil samples at site:
depth

K(cm/s) f(x)

10-5(silty sand)0.4
10-4 0.35
10-3(sand) 0.15
10-2 0.07
10-1(gravel) 0.03

file: stat.ppt p.36


Soil samples at site:

K(cm/s) f(x) Random #

10-5(silty sand)0.4 0-3999


10-4 0.35 4000 - 7499
10-3(sand) 0.15 7500 - 8999
10-2 0.07 9000 - 9699
10-1(gravel) 0.03 9700 - 9999

file: stat.ppt p.37


Soil samples at site:

K(cm/s) f(x) Random #

10-5(silty sand) 0.4 0-3999


10-4 0.35 4000 - 7499
10-3(sand) 0.15 7500 - 8999
10-2 0.07 9000 - 9699
10-1(gravel) 0.03 9700 - 9999

Node Random # K (cm/s)


(1,1)
(2,1)
(3,1)
(4,1)
(5,1)
file: stat.ppt p.38
end of lecture

file: stat.ppt p.39

You might also like