Distribusi Probabilitas
Distribusi Probabilitas
Chapter
Basic Probability and Discrete
Probability Distributions
Chapter Topics
Basic probability concepts
Sample spaces and events, simple probability, joint
probability
Conditional probability
Statistical independence, marginal probability
Bayes’s Theorem
Chapter Topics
(continued)
Impossible event
e.g.: Club & diamond on one card
draw
Complement of event
For event A, all events not in A
Denoted as A’
e.g.: A: queen of diamonds
A’: all cards in a deck that are
not queen of diamonds
Special Events
(continued)
Mutually exclusive events
Two events cannot occur together
e.g.: -- A: queen of diamonds; B: queen of clubs
Events A and B are mutually exclusive
Collectively exhaustive events
One of the events must occur
The set of events covers the whole sample space
e.g.: -- A: all the aces; B: all the black cards; C: all the diamonds; D:
all the hearts
Events A, B, C and D are collectively exhaustive
Events B, C and D are also collectively
exhaustive
Contingency Table
A Deck of 52 Cards
Red Ace
Not an Total
Ace
Ace
Red 2 24 26
Black 2 24 26
Total 4 48 52
Sample Space
Tree Diagram
Event Possibilities
Ace
Red
Cards Not an Ace
Full
Deck
Ace
of Cards
Black
Cards Not an Ace
Probability
Probability is the numerical 1 Certain
measure of the likelihood
that an event will occur
Value is between 0 and 1
.5
Sum of the probabilities of
all mutually exclusive and
collective exhaustive events
is 1
0 Impossible
Computing Probabilities
The probability of an event E:
number of event outcomes
P( E )
total number of possible outcomes in the sample space
X
T e.g. P( ) = 2/36
(There are 2 ways to get one 6 and the other 4)
A
Properties of Probability
P( A B C ) P(( A B) C )
P( A B) P(C ) P(( A B) C )
P( A) P( B) P( A C ) P(C )
P(( A C ) ( B C ))
P( A) P( B) P( A C ) P(C )
P(( A C ) P( B C )) P( A B C )
Properties of Probability
P(i 1 Ai ) P( Ai ) P( Ai A j )
n
i i j
P( A A A ) ....
i j k
i j k
1 n 1 n
P(i 1 Ai )
Computing Joint Probability
The probability of a joint event, A and B:
P(A and B) = P(A B )
number of outcomes from both A and B
total number of possible outcomes in sample space
Event
Event B1 B2 Total
A1 n(A1 and B1) n(A1 and B2) n(A1)
A2 n(A2 and B1) n(A2 and B2) n(A2)
Joint Probability
Marginal (Simple) Probability
Joint Probability Using
Contingency Table
Event
Event B1 B2 Total
A1 P(A1 and B1) P(A1 and B2) P(A1)
A2 P(A2 and B1) P(A2 and B2) P(A2)
Joint Probability
Marginal (Simple) Probability
Computing Compound
Probability
Probability of a compound event, A or B:
P( A or B ) P( A B )
number of outcomes from either A or B or both
total number of outcomes in sample space
E.g. P(Red Card or Ace)
4 Aces + 26 Red Cards - 2 Red Aces
52 total number of cards
28 7
52 13
Compound Probability
(Addition Rule)
P(A1 or B1 ) = P(A1) + P(B1) - P(A1 and B1)
Event
Event B1 B2 Total
A1 P(A1 and B1) P(A1 and B2) P(A1)
A2 P(A2 and B1) P(A2 and B2) P(A2)
Event
Event B B’ Total
A P(A and B) P(A1 and B’) P(A)
A’ P(A’ and B) P(A’ and B’) P(A)
P ( A and B)
P( A | B)
P( B)
Conditional Probability Using
Contingency Table
Color
Type Red Black Total
Ace 2 2 4
Non-Ace 24 24 48
Total 26 26 52
P( E | F ) P ( EF )
P(F )
P ({( b ,b )})
P ({( b ,b ),( b , g ),( g ,b )})
13// 44 1 / 3
Example
Bety can either take a course in mathematics
or in statistics. If She takes the statistic
course, then she will receive an A grade with
probability ½ , while if she takes the math
course then she will receive an A grade with
prob. 1/3 . Bety decides to base her
decision on the flip of fair coin. What is
the prob that Bety will get an A in math ?
Solution
If we let F be the event that Bety takes math
and E denote the event that she receives an
A in whatever course she takes, then the
prob is P(EF) = P(E|F)P(F) = 1/3.1/2 =
1/6.
P(F) =1/2 , because Bety decides to base her
decision on the flip of fair coin.
Example
Suppose that each of three men at the party
throws his hat into the center of the room.
The hats are first mixed up and then each
man randomly selects a hat. What is the
probability that none of the three men selects
his own hat ?
Solution
Let us denote by Ei ,i=1,2,3, the event that
the ith man selects his own hat. The
probability that none selects his own hat is
1 P ( E1 E2 E3 )
Now we compute
P( E1 E2 E3 )
P ( Ei ) 13 , i 1,2,3
P ( Ei E j ) P ( Ei | E j ) P ( E j )
12 13 1
6
P ( Ei E j Ek ) P ( Ek | Ei E j ) P ( Ei E j )
1. 16
3
P (i 1 Ei ) 3 13 3 16 16 2
3
Conditional Probability and
Statistical Independence
Conditional probability:
P ( A and B)
P( A | B)
P( B)
Multiplication rule:
P( A and B) P( A | B) P( B)
P( B | A) P( A)
Conditional Probability and
Statistical Independence
(continued)
C1 C2
C2
P R .50 P C | R .4 P C | R .10
P R |C ?
Bayes’s Theorem
Using Contingency Table
(continued)
P C | R P R
P R | C
P C | R P R P C | R P R
.4 .5
.2
.8
.4 .5 .1 .5 .25
Example
In answering a question on a multiple choice
test, a student either knowns the answer of
he guesses . Let p be the prob that she
knows the answer. There are m multiple-
choice alternatives. What is the conditional
that a student knew the answer to a question
given that she answered it correctly ?
Solution
Let C and K denote respectively the event
that the student answers the question
correctly and the event that she actually
knows the answer. Now
P( K | C ) P (C|K ) P ( K )
P ( C | K ) P ( K ) P ( C | K ' ) P ( K ')
1 p
p 1/ m 1 p
Example
A laboratory blood test is 95 percent effective in
detecting a certain disease when it is, in fact
present. However, the test also yields a “ false
positive” result for 1 percent of the healthy
persons tested.
If 0.5 percent of
the population actually has the disease, what is
the prob a person has the disease given that his
test result is positive ?
Solution
Let D be the event that the tested person has
the disease, and E the event that his test
result is positive.
P( D | E ) P ( E|D ) P ( D )
P ( E | D ) P ( D ) P ( E | D ') P ( D ')
0.950.005
0.950.005 0.10.995
0.323
Random Variable
Random Variable
Outcomes of an experiment expressed numerically
e.g.: Toss a die twice; count the number of times
the number 4 appears (0, 1 or 2 times)
Discrete Random Variable
Discrete random variable
Obtained by counting (1, 2, 3, etc.)
Usually a finite number of different values
e.g.: Toss a coin five times; count the number of
tails (0, 1, 2, 3, 4, or 5 times)
Discrete Probability
Distribution Example
Event: Toss two coins Count the number of tails
Probability Distribution
Values Probability
T 0 1/4 = .25
1 2/4 = .50
T 2 1/4 = .25
T T
Example
Suppose we toss a coin having a prob p of
coming up heads, until the first head appears.
Letting N denote the number of flips
required, then assuming that the outcome of
successive flips are independent, N is a
random variable taking on one of the values
1,2,3,…with respective probabilities
Solution
P(N=1) = P(H) = p;
P(N=2) = P({T,H}) = (1-p)p ;
:
P(N=n) = P({T,…,T,H})= (1-p) n-1 p,
n>=1
As a check, note that
P {N n} P{N n}
n 1 n 1
p (1 p ) n 1
n 1
1
Discrete Probability Distribution
List of all possible [Xj , p(Xj) ] pairs
Xj = value of random variable
P(Xj) = probability associated with value
Mutually exclusive (nothing in common)
Collectively exhaustive (nothing left out)
0 P X j 1 P X 1j
Summary Measures
Expected value (the mean)
Weighted average of the probability distribution
E X X jP X j
j
0 2.5 1 .5 2 .25 1
Summary Measures
(continued)
Variance
Weight average squared deviation about the mean
E X X j P X j
2 2 2
e.g. Toss two coins, count number of tails,
compute variance
X j P X j
2 2
0 1 .25 1 1 .5 2 1 .25 .5
2 2 2
Covariance and its Application
N
XY X i E X Yi E Y P X iYi
i 1
XY
XY
Computing the Mean for
Investment Returns
Return per $1,000 for two types of investments
Investment
P(XiYi) Economic condition Dow Jones fund X Growth Stock Y
.2 Recession -$100 -$200
.5 Stable Economy + 100 + 50
.3 Expanding Economy + 250 + 350
37,900 Y 194.68
Computing the Covariance for
Investment Returns
Investment
P(XiYi) Economic condition Dow Jones fund X Growth Stock Y
.2 Recession -$100 -$200
.5 Stable Economy + 100 + 50
.3 Expanding Economy + 250 + 350
23, 300
121.35194.68 0.986
If the value of X increase, then the value of Y
increase too.
Cumulative Distribution Function
f ( xi )
F ( x) P( X x) xi
f (t )dt
x
Example
Consider the The median lifetime is
distribution of lifetimes ,
X (in months), of a F (m) 0.5
particular type of
m3
2
component. We will 1 e 0.5
assume that the CDF
has the form 3
m 2
ln(0.5)
( 3x ) 2 m
ln(0.5) 1/ 2
F ( x) 1 e ;x 0
3
m 2.498 months
It is desired to find the
F ( x) 0.1
percentile : 1 e 3
0.1
x 2
3
ln(0.9)
Thus if the components
are guaranteed for one x 3[ ln(0.5)] 1/ 2
month, slightly more
than 10% will need to x 0.974 months
be replaced
Important Discrete
Probability Distributions
Discrete Probability
Distributions
X ! n X !
P X : probability of X successes given n and p
X : number of "successes" in sample X 0,1, , n
p : the probability of each "success"
n : sample size Tails in 2 Tosses of Coin
X P(X)
0 1/4 = .25
1 2/4 = .50
2 1/4 = .25
Proof of the Probability
Note that, by the binomial theorem, the
probabilities sum to one, that is
n
n x
p ( x) p (1 p) n x
x 0 x
( p (1 p)) n
Binomial Distribution
Characteristics
Mean
E X np
E.g. np 5 .1 .5
np 1 p 0 1 2 3 4 5
E.g.
np 1 p 5 .1 1 .1 .6708
Expectation
n
n x
E ( X ) x p (1 p )
n x
x 0 x
n
n!
( n x )!( x 1)! p x (1 p ) n x
x 1
n
np x 1
( n 1)!
( n x )!( x 1)! p x 1
(1 p ) n x
n 1
np
k 0
( n 1)!
( n 1 k )!( k )! p k (1 p ) n k 1
np
Variance
n
n x
E ( X ( X 1)) x( x 1) p (1 p ) n x
x 0 x
n
( n x )!n(!x 2 )! p x (1 p ) n x
x2
n
n(n 1) p 2
x2
( n 2 )!
( n x )!( x 2 )! p x 2 (1 p ) n x
n2
n(n 1) p 2
k 0
( n 2 )!
( n 2 k )!( k )! p k (1 p ) n k 2
n(n 1) p 2
Binomial Distribution in PHStat
PHStat | probability & prob. Distributions |
binomial
Example in excel spreadsheet
Microsoft Excel
Worksheet
Example
S uppose that an airplane engine will fall,
when in flight, with prob 1-p independently
from engine to engine; suppose that the
airplane will make a succesful flight if at least
50 percent of its engines remain operative.
For what values of p is a four-engine plane
preferable to a two-engine plane ?
Solution
The probaility that a four-engine plane makes
a successful flight is
4
4 x
x p 1 p 4 x
6 p 2
(1 p ) 2
4 p 3
(1 p ) p 4
x2
x 1
Solution
Hence the four-engine is safer if
6 p (1 p) 4 p (1 p) p 2 p(1 p) p
2 2 3 4 2
3p 2 0
p 2
3
Hence, the four-engine plane is safer when the
engine success probability is at least as large as 2/3 ,
whereas the two-engine plane is safer when this
probability falls below 2/3
Poisson Distribution
Poisson Process: P( X x |
Discrete events in an “interval” e- x
The probability of One Success
in an interval is stable x!
The probability of More than
One Success in this interval is 0
The probability of success is
independent from interval to
interval
e.g.: number of customers arriving in 15 minutes
e.g.: number of defects per case of light bulbs
Poisson Probability
Distribution Function
e X
P X
X!
P X : probability of X "successes" given
X : number of "successes" per unit
: expected (average) number of "successes"
e : 2.71828 (base of natural logs)
e.g.: Find the probability of 4 e 3.6 3.64
customers arriving in 3 minutes P X .1912
4!
when the mean is 3.6.
Poisson Distribution in PHStat
PHStat | probability & prob. Distributions |
Poisson
Example in excel spreadsheet
Microsoft Excel
Worksheet
Poisson Distribution
Characteristics
Mean .6
P(X) = 0.5
E X .4
.2
N 0 X
XiP Xi 0 1 2 3 4 5
i 1
P(X) = 6
Standard Deviation .6
.4
and Variance .2
2
0 X
0 2 4 6 8 10
Approximate a binomial to poisson
P( X i) n!
1
( n i )!i! n
i n i
n
n ( n 1)...( n i 1) i 1 / n n
ni i! (1 / n )i
i
e i!
1 / n n
e ; (1 / n) 1; i n ( n 1)...( n i 1)
n i 1
Expectation
E( X ) e x1
x x
xe
x! ( x 1)!
x 0 x 1
e
x 1
x1
( x 1)!
e e
Variance
E ( X ( X 1)) 1 e x2
x x
x ( x 1) e
x! ( x 2 )!
x 0 x 2
1 e
x 2
( x 2 )!
x2
1 e e
1
Hypergeometric Distribution
“n” trials in a sample taken from a finite
population of size N
Sample taken without replacement
Trials are dependent
Concerned with finding the probability of “X”
successes in the sample where there are “A”
successes in the population
Hypergeometric Distribution
Function
A N A E.g. 3 Light bulbs were
X n X selected from 10. Of the 10
P X
there were 4 defective. What
N
is the probability that 2 of the
n 3 selected are defective?
P X : probability that X successes given n, N , and A
n : sample size 4 6
N : population size 2 1
P 2 .30
A : number of "successes" in population 10
X : number of "successes" in sample 3
X 0,1, 2, , n
Hypergeometric Distribution
Characteristics
Mean
A
E X n
N
Variance and Standard Deviation
nA N A N n Finite
2
Population
N2 N 1 Correction
Factor
nA N A N n
N 2
N 1
Hypergeometric Distribution in
PHStat
PHStat | probability & prob. Distributions |
Hypergeometric …
Example in excel spreadsheet
Microsoft Excel
Worksheet
Expectation
( x ) 2 / 2 2
E( X ) 1
2
xe dx
1
2 ( x )e ( x ) 2 / 2 2
d x
( x ) 2 / 2 2
1
2
e dx
0
Variance
E X
2 1
2
( x 2
) e
( x ) 2 / 2
d
x
2 y2 / 2
2
2
y e dy
2
2
Jointly Distributed Random Variables
The joint probability mass function of X and Y
is p(x,y)=P(X=x,Y=y)
The probability mass function of X
p ( x, y )
p ( x) y
f x, y dy
xf ( x)dx yf ( y )dy
E ( X ) E (Y )
E ( X 1 ... X n ) E ( X 1 ) ... E ( X n )
Example
As another example of the usefulness of
equation above, let us use it to obtain the
expectation of a binomial r.v.
1, succes
Xi ; E ( X i ) p ; V ( X i ) pq
0, failed
X X 1 ... X n
E ( X ) E ( X 1 ) ... E ( X n ) np
V ( X ) V ( X 1 ) ... V ( X n ) npq
Example
At a party N men throw their hats into the
center of a room. The hats are mixed up and
each man randomly selects one. Find the
expected number of men that select their own
hats
Solution
Letting X denote the number of men that
select their own hats, we can best compute
E(X) by noting that X = X1+…+XN ; where Xi is
indicator function if the ith man select his own
hat. So P(Xi = 1) = 1/N. And so E(Xi) = 1/N.
Hence We obtain that E(X) = 1. So, no matter
how many people are at the party, on the
average exactly one of the men will select his
own hat.
Independent R.V
X and Y are independent
if E ( XY ) xyf ( x, y)dxdy
xyf ( x) f ( y )dxdy
p ( x, y ) p ( x ) p ( y )
xf ( x)dx yf ( y )dy
f ( x, y ) f ( x ) f ( y )
E ( X ) E (Y )
Covariance and Variance of Sums of
Random Variables
= E(XY)-E(X)E(Y)
If X and Y are independent Cov(X,Y) = 0
Properties of Covariance
Cov(x,X) = Var(X)
Cov(cX,Y) = c Cov(X,Y)
Cov(X,Y+Z)= E[X(Y+Z)]-E[X]E[Y+Z]
= E[XY]-E[X]E[Y] + E[XZ]-E[X]E[Z]
= (Cov(X,Y) + Cov(X,Z)
The last property easily generalizes to give
Cov X i , Y j Cov (X i , Y j )
Variance of Sum Variabel
n n n
Var X i Cov X i , X i
i 1 i 1 j 1
n n
Cov( X i , X j )
i 1 j 1
n n n
Cov( X i , X i ) Cov( X i , X j )
i 1 i 1 j i
n n n
V ( X i ) 2 Cov( X i , X j )
i 1 i 1 j i
Proposition
Suppose that X1,…,Xn are independent and
identically distributed with expected value µ
and variance σ2. Then
Cov( X , X i X ) Cov( X , X i ) Cov( X , X )
1n Cov( X i X i , X j ) Var ( X )
j i
2
n 0 2
n
Example
Sums of independent Poisson Random
Variables : Let A and Y be independent
Poisson random variables wirh respective
means λ1 and λ2 . Calculate the distribution of
X + Y.
Solution : Since the event {X+Y = n} may be
written as the union of the disjoint events
{X=k,Y=n-k}, 0≤k≤n, we have
n
P ( X Y n) P{ X k , Y n k }
k 0
n
P{ X k }P{Y n k }
k 0
n
e 1 1k
k! e 2 n2k
( n k )!
k 0
n
1 2
e
n!
n!
k !( n k )!
k
1
nk
2
k 0
e 12
n!
1 2 n