II_Probabilities

advertisement
PROBABILITIES
Probabilities
• Basic concepts:
• Random experiment:
• All possible outcomes have to be known in advance
• The result of a particular experimen tcannot be predicted (randomness).
• The experiment can be repeated under identical conditions
• Sample space Ω:
• Set of all possible outcomes
• Events
• A sub-set of the sample space, i.e. a set of possible otucomes
• Singular event:
• A sub-set of the sample space with one element
Probability model
1. Set S of possible outcomes
a) Throw the coin, S = (pitch, toss)
b) Throw the dice, S = (1, 2, 3, 4, 5, 6)
2. Probabilites Pi
a) Throw the coin, S = (pitch, toss)
P(pitch) = P(toss) = 1/2
b) Throw the dice, S = (1, 2, 3, 4, 5, 6)
P(1) = P(2) = P(3) = P(4) = P(5) = P(6) = 1/6
Probabilities
• Dice 1, 2, 3, 4, 5, 6
• P(1) = P(2) = P(3) = P(4) = P(5) = P(6) = 1/6
• Two dice are thrown
W2
1
W1
3
4
5
6
1
1/6
2
1/6
3
Model
2
1/36
1/6
4
1/6
5
1/6
6
1/6
1/6 1/6 1/6 1/6 1/6 1/6
Probabilities
1.
P(both dice show 1) = P(1)  P(1) = 1/6  1/6 = 1/36
W2
1
W1
Model
2
3
4
5
6
1
1/6
2
1/6
3
1/6
4
1/6
5
1/6
6
1/6
1/6 1/6 1/6 1/6 1/6 1/6
Probabilities
2.
Event E: get a „2“ and a „3“: P(E) = 2  P(2)  P(3) = 2  1/6  1/6 =
1/18
Event F: first dice a „2“, second dice a „3“, P(F) = 1/6  1/6 = 1/36
W2
1
W1
Model
2
3
4
5
6
1
1/6
2
1/6
3
1/6
4
1/6
5
1/6
6
1/6
1/6 1/6 1/6 1/6 1/6 1/6
Probabilities
3.
P(double) = P(double 1) + ... + P(double 6) = 6  1/36 = 1/6
W2
1
W1
Model
2
3
4
5
6
1
1/6
2
1/6
3
1/6
4
1/6
5
1/6
6
1/6
1/6 1/6 1/6 1/6 1/6 1/6
Probabilities
4.
P(sum of both dice is 7) = 6  1/36 = 1/6
W2
1
W1
Model
2
3
4
5
6
1
1/6
2
1/6
3
1/6
4
1/6
5
1/6
6
1/6
1/6 1/6 1/6 1/6 1/6 1/6
Probabilities
• Two hunters try to shoot a fox.
• Each hunter strikes with probability 1/3.
• What is the probability, that the fox survives?
Each hunter does not strike with probability 2/3
P(fox survives) = P(both hunters do no strike) = 2/3 ∙ 2/3 = 4/9
Further probability exercises
PROBABILITIES
Factorial, binomial coefficient and binomial distribution
Probabilities
Factorial:
• A number of students is called to the black board. How many orderings are
possible?
Factorial
In R: factorial()
Number of students
Orderings
Number of possible
orderings
0! := 1
1
(A)
A
1
1! = 1
2
(A, B)
AB; BA
2
2! = 1∙2 = 2
3
(A, B, C)
CAB; CBA;
ACB; BCA;
ABC; BAC
3 ∙2 = 6
3! = 1∙2 ∙3 = 6

n


n ∙(n-1) ∙∙2 ∙1
n! = 1∙2 ∙3 ∙ ∙n
Probabilities
• Binomial coefficient
Choose 6 numbers out of 49. How many outcomes are there if the
ordering does NOT matter and if numbers can be selected only once?
First number:
49 choices
Second number:
48 choices
First and 2nd number:
49 · 48 choices

6 numbers:
49 · 48 · 47 · 46 · 45 · 44 choices
Is this the solution?
1. selection:
2. selection:
{7; 18; 5; 43; 1; 22}
{18; 7; 5; 43; 1; 22}
How many orderings are there?
Final solution of question above:
No! – Why?
Both selections are equal,
since they differ only with respect to the order
6!
49  48  47  46  45  44
6  5  4  3  2 1
Probabilities
49  48  47  46  45  44   43  42    2  1
49  48  47  46  45  44
49 !


6  5  4  3  2 1
6 !  49  6 !
6 !  43  42    2  1
Claim:
Definition:
 49 
49 !
:  
6 !  49  6 !  6 
Binomial coefficient (In R: choose(n,k) )
n
n!
  :
 k  k !  n  k !
n
   0
k 
für k  n
n n
      1
0  n
is the number of ways k things can be chosen from n things.
Here, the ordering of the k things is not of interest and each
element can be chosen only once.
n  n 
   

k
n

k
  

n  n 
   
  n
1   n  1
Probabilities
• Binomial coefficient
Inheritance (PKU)
S:
m
w
m
w
m
m
Phenotype:
affected
unaffected
PKU is autosomal reccesive hereditary
disease.
Pedigree:
m: mutant allele
w: wildtype allel (= „normal“ allele)
Probabilities
• Binomial distribution
P(child is ill)= 1/2 ∙ 1/2 =1/4
P(child is not ill)= 1- P(child is ill)= 3/4
S:
m
w
m
w
?
Probabilities
• Binomial distribution
S:
m
w
m
w
m
w
m
w
S:
?
?
P(first child ill, 2nd child not ill) = 1/4 ∙ 3/4 =3/16
P(one child ill, one child not ill) = 2 ∙ 1/4 ∙ 3/4 =6/16
Probabilities
S:
m
w
?
m
w
?
?
?
?
P 2 children ill , 3 children healthy S 
5
   
2
5
  
2
ill
ill
orderings
1

4

1
 
4
1

4
healthy
healthy
healthy
3

4
3

4
3
4

3
 
4
2
3
An experiment with two (->“binomial“) possible
outcomes („success“ and „failure“) is
independently repeated n times
p: probability of event 1 („success“) per
experiment
n: number of experiments
k: number of successes
Binomial distribution (In R: dbinom(k,n,p) ):
n
n k
B n, k , p      pk  1  p 
k 
Probabilities
• Binomial distribution
S:
m
w
?
m
w
?
?
Density function
?
?
p = 1/4 (affected)
 (1-p) = 3/4 (not affected)
 5
0
5
P0 affectedchildren S     1 4  3 4
 0
P1 affectedchild
 5
1
4
S     1 4  3 4
1
 0,237
 0,396
 5
2
3
P2 affected children S     1 4  3 4  0,264
2
 
 5
3
2
P3 affected children S     1 4  3 4  0,088
 3
 5
4
1
P4 affected children S     1 4  3 4  0,015
 4
 5
5
0
P5 affected children S     1 4  3 4  0,001
 5
Probabilities
• Binomial distribution
Densityf function
Distribution function
F
1
0.40
0.8
0.30
0.6
0.20
0.4
0.2
0.10
0
0
0.00
0
1
2
3
4
5
Number of affected children
1
2
3
Number of affected children
4
5
Probabilities
• Random variable
Probability model
S
function
X
Real numbers
R
x
1
2
y
z
3
?
4
5
Probability P
X: Random variable
Probabilities
• Random variable: function X that assigns a real number to an event
S
Examples for possible random variables X, Y
X:
X
X
X
Y:
P
1
20
number of edges



3
4
0
red  1
brown  2
Y

1
Y

2
Probabilities
• Random variable
S
X:
number of edges
Question:
P(X = 3) = ?
(sloppy)
correct:
P( aS | X(a) = 3) =
1
P
20
5
20
Use the sloppy notation!
Probabilities
S
X:
Number of edges
P(X < 0) =
8
2

20 5
P(X = 0) =
P(X  2) =
5
1

20 4
7
P(X = 4) =
20
P(X = 3) =
P
1
20
P(X  3) =
0
P(X = 5) =
2
5
2
5
13
20
P(X  0) =
0
P(X = 2) =
0
P(X  4) =
1
P(X  5) =
1
F
f
1.0
0.4
0.8
0.3
0.6
0.2
0.4
0.1
0.2
0.0
0
1
2
Density
Distribution function: F(a) = P(X  a)
3
4
5
X
0.0
0
1
2
Distribution function
3
4
5
X
Probabilities
• Statistical measures
Sample
Model
Mean
Expectation
 xi
x
1
n
x
 h ix i
μ
Empircal variance
s2 
1
n 1
 x i  x 
2
Emp. standard deviation

Example
s  s2
 p ixi
xi
0
pi
2/5
3
1/4
4
7/20
μ  0  2 5  3  1 4  4  7 20  2.15
Variance
σ2 
 pi x i  μ
2
σ 2  2  0  2.152  1  3  2.152
5
4
 7  4  2.152  3.23
20
Standard deviation

σ  σ2
σ  1.80
Probabilities
• Binomial distribution
n
n k
B n, k , p      pk  1  p 
k 
Expectation:
μ  np
Variance:
σ 2  n  p  1  p 
Standard deviation:
σ

n  p  1  p
Probabilities
• Continuous random variable
0°
Random variable W: angle
P: all angles equally likely
P(W = 180°) = ?
precision: 1°
 360 possibilities with P=1/360
precision: 0.1°
 3600 possibilities with P=1/3600
precision: 0.01°
 36000 possibilities with P=1/36000

n possibilities with P=1/n
1
n

0
n
P(W = 180°) = 0
Probabilities
• Continuous random variable
0°
Distribution function: F(a) = P(W  a)
F
1
0.8
F(0) = P(W  0°) =
0
F(90) = P(W  90°) =
F(180) = P(W  180°) =
1
4
1
2
F(270) = P(W  270°) =
3
4
F(360) = P(W  360°) = 1
0.6
0.4
0.2
0
0
90
180
270
360
X
Probabilities
• Continuous random variable
Distribution function F
F
1
0.8
0.6
1
0.4
0.2
0
0
90
180
270
360
X
Density function f
f
f  F
1
360
0
90
180
270
360
X
Probabilities
• Random variable
discrete
μ
Expectation
Variance
continuous
2
σ 
 pi  xi
μ

 x  f x dx

 pi  x i  μ
2
2
σ 

 x  μ

2
 f x dx
Probabilities
• Random variable
Density function f
f
1
360
Expectation?
Conjecture: 180
0
μ
90

 x  f x  dx

180

270
360
360
 x  f x  dx
0
X
1


360
360
 x dx
0
360
1

360
 x2 
 
 2  0
1

360
 360 2
 360


 0 
 180
 2

2


Download