Download lecture 8

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Statistics wikipedia , lookup

History of statistics wikipedia , lookup

Probability wikipedia , lookup

Transcript
COM2023
Mathematics Methods for Computing II
Lecture 7& 8
Gianne Derks
Department of Mathematics (36AA04)
http://www.maths.surrey.ac.uk/Modules/COM2023
Autumn 2010
Use channel 04 on your EVS handset
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Discrete random variables
Discrete random variable: example. . .
Probability Mass Function . . . . . . . .
Probability Mass Function: Examples .
Biased die example revisited . . . . . . .
The distribution function . . . . . . . . .
Distribution function: Example 1 . . . .
Distribution function: Example 2 . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
4
5
6
7
8
9
10
Continuous random variables
11
Probability density function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Probability density function: sketch 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Probability density function: sketch 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1
Overview
●
Introduction to distributions:
◆ Discrete case
●
●
probability mass function
distribution function
◆ Continuous case (introduction)
●
probability density function
Discrete random variables (§4.1)
Discrete random variable: example
A biased die has the following probabilities for its outcomes:
x
1
2
3
4
5
6
P (X = x)
2
12
2
12
1
12
5
12
1
12
1
12
The outcome is called a random variable, denoted by X, its value is usually denoted by x, where in
this example x takes the values 1, . . . , 6, hence discrete values.
An overview of the probabilities is given by the probability mass function, this is the full table above.
Recall that the sum of all probabilities must be 1 and that all probabilities have to be between 0 and 1.
2
Probability Mass Function
In general:
The discrete random variable X takes discrete values x1 , x2 , . . . with probabilities p(x1 ), p(x2 ), . . .,
i.e.
p(xi ) = P ({X = xi }) for i = 1, 2, . . .
Then p(x) is called the probability mass function or pmf of X.
Two Properties of the pmf
●
0 ≤ p(x) ≤ 1;
●
p(x1 ) + p(x2 ) + p(x3 ) + . . . = 1.
Example
A fair die is thrown and X is the outcome. What is the pmf of X?
1 2 3 4 5 6
x
p(x)
1
6
1
6
1
6
1
6
1
6
1
6
Probability Mass Function: Examples
●
●
●
What is the probability mass function (pmf) of the number of heads in three tosses of a fair coin?
x
0
1
2
3
p(x)
1
8
3
8
3
8
1
8
A coin is tossed repeatedly and X is the number of tosses needed until the first ‘head’ is
obtained. What is the pmf of X?
x
1
2
3
4
5
...
p(x)
1
2
1
4
1
8
1
16
1
32
...
A pmf is specified by
n
...
n
1
...
2
p(x) = cx, for x = 1, 2, 3, 4,
where c is a constant. Find the value of c.
Answer: Use that p(x1 ) + . . . + p(x4 ) = 1, then we get c =
3
1
10 .
Biased die example revisited
The random variable X associated with a biased die has the following pmf:
x
1
2
3
4
5
6
p(x)
2
12
2
12
1
12
5
12
1
12
1
12
Now consider the events Ey to be the events that the random variable X takes a value less or equal
to y, for y = 1, . . . , 6. What is the probability P (Ey ) for y = 1, . . . , 6?
We get the following table
y
1
2
3
4
5
6
P (Ey )
2
12
4
12
5
12
10
12
11
12
12
12
Note that the values are between 0 and 1 and that they are increasing.
The distribution function
Given a discrete random variable X. To find the distribution function, consider the event
Ey = {X = xi | xi ≤ y},
(i.e., the random variable X takes a value less or equal to y.)
The cumulative probability distribution function,
or for short distribution function is
F (y) = P (Ey ) = P (X ≤ y) =
X
p(xj ) = p(x1 ) + . . . + p(xj0 ),
xj ≤y
where the index j0 is such that xj0 ≤ y and xj0 +1 > y.
Properties of the distribution function
●
0 ≤ F (y) ≤ 1;
●
F (−∞) = 0 and F (+∞) = 1;
●
the graph of F is increasing, i.e., if y1 < y2 then F (y1 ) ≤ F (y2 ).
4
Distribution function: Example 1
Find the probability mass function and distribution function of a fair four-sided die.
The pmf is:
x
1
2
3
4
p(x)
1
4
1
4
1
4
1
4
The distribution function is
y
1
2
3 4
F (y)
1
4
1
2
3
4
1
What are F (0.5), F (2.5), F (3.7), and F (5)?
Answer: F (0.5) = 0, F (2.5) = F (2) = 12 , F (3.7) = F (3) = 43 , F (5) = 1.
Distribution function: Example 2
The probability mass function (pmf) of a discrete random variable X is specified by
p(x) = cx
for
x = 31 , 23 , 1,
where c is a constant.
Find the value of c and obtain the distribution function of X.
●
Using that p(x1 ) + p(x2 ) + p(x3 ) = 1, we get c = 12 .
●
The distribution function is
y
F (y)
1
3
1
6
Note: F (−1) = 0, F ( 73 ) = 16 , F ( 54 ) = 12 , F (2) = 1, etc.
5
2
3
1
2
1
1
Continuous random variables (§4.2)
Probability density function
A continuous random variable X takes values x in a range −∞ < x < ∞. We can only ask for the
probability that x is in some interval, hence for P (a ≤ X ≤ b).
The probability density function or pdf is a function f (x) such that
●
the function is positive and all values are less or equal to 1:
0 ≤ f (x) ≤ 1 for all x;
●
the total area under the function is 1:Z
∞
f (x)dx = 1;
−∞
●
for any a ≤ b, the probability that X takes values between a and b is the area under the graph
of f between a and b:
Z b
P (a ≤ X ≤ b) =
f (x) dx.
a
Probability density function: sketch 1
The probability that X takes a value between 3.5 and 5.5 is the shaded area.
6
Probability density function: sketch 2
The probability that X takes a value less or equal 6 is the shaded area.
7