Download RANDOM VARIABLES

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
Transcript
RANDOM VARIABLES
Definitions
Exercise 1
A coin is thrown twice.The sample space is S = {(H, H); (H, T ); (T, H); (T, T )}
We may want to consider how many times it was a head. Then we assign a number to each
event. Here the number will be the number of heads.
Let C be the number of heads which appear, and M to be 1 if both coins match and 0
otherwise. Any outcome of the coin flips uniquely determines C and M . C can take the values
0,1 and 2 and M the values 0 an 1. We use the notation [C = 2] for the event that there are
two heads. Similarly, [C ≥ 1] is the event that there is at least one heads, and [C ∈ {0, 2}] is
the event that there are an even number of heads.
Reminder: an event is a collection of outcomes satisfying a given condition.
1. Complete the following:


(H, H)



(H, T )
C:

(T, H)



(T, T )
7→ . . .
7→ . . .
7→ . . .
7→ . . .


(H, H)



(H, T )
M:
(T, H)



(T, T )
7→ . . .
7→ . . .
7→ . . .
7→ . . .
2. Calculate P (C ≥ 1) and P (H = 0).
Definition 1
A random variable over a given sample space is a function that maps every outcome
to a real number.
! Random variable is a misnomer: it is actually a function.
Indicator random variables describe experiments to detect whether or not something happened. The random variable M is an example of an indicator variable, indicating whether or
not all three coins match.
! Random variable (functions) are often called X (upper-case X) so the values it takes
would be X(x). So not only is a random variable not a variable and not random (it is a
function about random events) but it uses capital X which must not be confused with a
variable x. We will follow the notation uses at MIT by prof. Albert R. Meyer and avoid using
X. A general random variable will be named R instead and usually we name it using a letter
related to what it measures
1
Exercise 2
5 cards are drawn from a deck of 52. Let H be the random variable that counts the number
of Hearts and A the random variable that counts the number of Aces.
1. Calculate P (H = 0).
2. Calculate P (H = 3).
3. Calculate P (H ≤ 3).
4. Calculate P (A = 3).
Definition 2
An indicator random variable is a random variable that maps every outcome to
either 0 or 1.
Indicator random variables are also called Bernoulli or characteristic random variables.
Typically, indicator random variables identify all outcomes that share some property : outcomes with the property are mapped to 1, and outcomes without the property are mapped
to 0.
Definition 3
The probability density function (pdf) for a random variable R is the function
fR : range(R) → [0, 1] defined by: fR (x) = P (R = x)
The probability density function is alsoX
sometimes called the distribution function.
A consequence of this definition is that
fR (x) = 1 since we are summing the probabilx
ities of all outcomes in the sample space.
Exercise 3
A coin is tossed three times. Let C be the random variable which counts the heads. Let the
density function be fC (x) = P (C = x)
Give the range and domain of fC .
calculate
1. fC (0) ; fC (1) ; fC (2) ; . . .
2. P (0.4 ≤ C ≤ 3)
3. P (C < 2)
Suppose that we roll two fair independent dice. We can regard the numbers that turn up
as random variables, D1 and D2 . For example, if the outcome is w = (3, 5), then D1 (w) = 3
and D2 (w) = 5. Let T = D1 + D2 . Then T is also a random variable, since it is a function
mapping each outcome to a real number, namely the sum of the numbers shown on the two
dice. For outcome w = (3, 5), we have T (w) = 3 + 5 = 8. Define S as follows:
(
1 if T = 7
S=
0 if T 6= 7.
2
That is, S = 1 if the sum of the dice is 7, and S = 0 if the sum of the dice is not 7. For
example, for outcome w = (3, 5), we have S(w) = 0, since the sum of the dice is 8. Since
S is a function mapping each outcome to a real number, S is also a random variable. In
particular, S is an indicator random variable, since every outcome is mapped to 0 or 1. The
definitions of random variables T and S illustrate a general rule:
any function of random variables is also random variable.
Exercise 4
1. What are the range and domain for each of the random variables defined above?
2. Let fT (x) = P (T = x) give the minimum and maximum value of fT (x)
Definition 4
The cumulative distribution function for a random variable R, is the function
FR : R → [0; 1] defined by
X
FR (x) = P (R ≤ x) =
fR (y)
y≤x
y∈ range(R)
3. Describe FT (x)
Summarise all results in a table:
x
fT (x)
FT (x)
...
...
...
4. Draw the graphs of fT and FT .
Exercise 5
In a game, one must spin a dial as shown in the figure.
A
If the dial halts with part A under the arrow the player wins, otherwise the
player loses. In a game the player spins the dial twice.
Let C be the random variable counting the number of times the player wins.
1. What is the sample space?
2. What values can C take?
3. Calculate the probability that a player never wins: i.e. P (C = 0)
4. Calculate P (C = 1), P (C = 2)
3
5. Summarise all results in a table:
C
P(C)
6. Represent graphically this distribution
7. Represent graphically the cumulative distribution function of C
Exercise 6
A bag contains three 10 cts coins, four 20cts coins and 1 50cts coin. Two coins are drawn
(with equal probability) from the bag. Let T be the total amount of these two coins.
1. What is the sample space?
2. What values can T take?
3. Give the values of fT (x) for all x in the range of T i.e., give a complete description of the
distribution.
4. Draw a diagram of T
5. Calculate P (T ≤ 50)
6. Draw FT
Exercise 7
A political commission has 15 members, 9 liberals and 6 socialists. 3 people are chosen at
random from this commission. Let C be the random variable which counts how many liberals
have been chosen.
1. What is the sample space?
2. Find all values for C.
3. Find the distribution function of C
4. Find the cumulative distribution function of C
Important Distributions:
Bernoulli Distribution
Let B be a Bernoulli (indicator) random variable with P (B = 0) = p and P (B = 1) = 1 − p
A Bernoulli density function is thus
fB (0) = P (B = 0) = p
fB (1) = P (B = 1) = 1 − p
and the cumulative Bernoulli distribution function is
FB (0) = P (B ≤ 0) = p
FB (1) = P (B ≤ 1) = 1
Exercise 8
Roll a dice. Let D = 1 if the score is 6 and D = 0 otherwise. Describe fD and FD .
4
Uniform Distribution
If U be a random variable that can take N different values such that P (U = k) =
k between 0 and N .
Then a uniform density function is
fu (k) = P (U = k) =
1
N
for any
1
N
and the cumulative uniform distribution function is
FU (k) = P (U ≤ k) =
k
N
Exercise 9
Roll a dice. Let D be the score of the dice. Describe fD and FD .
Binomial Distribution
This distribution is very important in many areas of natural sciences.
A binomial random variable S which counts the number of successes in a series of independent Bernoulli trials leads to binomial distributions.
Let n be the number of trials and the probability of success for one trial is p. Then
fS (k) = Cnk · pk · (1 − p)n−k
If p = 1 − p =
1
2
we have
fS (k) = Cnk · 2−n
Exercise 10
In order to explain the formula, consider H to be the number of heads on n independent
tosses of an unbiased coin.
Describe fH and FH .
Next, roll a dice and let D = 1 of the score is 5 or 6 and D = 0 otherwise.
Describe fD and FD .
Exercise 11
A fair dice has 4 sides with a 1 printed on them and 2 sides with a 0 printed on them. The
dice is rolled until a 1 shows up or until it scores four consecutive 0’s. Let C be the random
variable which counts the number of tosses.
1. Describe the distribution of C.
2. Draw a bar chart representation of C
Exercise 12
An urn contains three balls numbered 1, 2 and 3. A ball is picked, its number noted and it is
then put back in the urn. The operation is repeated until a ball already picked is picked again.
Let P be the number of times a ball is picked.
1. Describe the distribution of C.
5
2. Draw a bar chart representation of C
Exercise 13
Pick 5 cards out of 52.
1. What is the probability that you pick two aces?
2. Play ten times: what is the probability that you pick two aces
(a) 6 times?
(b) once?
(c) at least once?
(d) at least 9 times?
Exercise 14
In the following, state the type of distribution:
1. A coin is tossed several times. Consider the result Heads or Tails.
2. A dice is rolled several times. Consider the score.
3. A dice is rolled several times. Consider how many times a 6 appears.
4. An urn contains 5 black balls and 4 white ones. Three ball are randomly simultaneously
picked . Consider how many black balls are picked.
5. An urn contains 5 black balls and 4 white ones. A ball is randomly picked, observed and
put back in. This operation is repeated three times. Consider how many black balls are
picked.
Expectation
Definition 5
The expectation of a random variable is the average of all possible values of a
random variable, where the values is weighted according to the probability that it
will appear.
Let S be the sample space and R a random variable. The Expectation E(R) is
calculated in the following way:
E(R) =
X
R(s) · P (R = s)
s∈S
or equivalently
E(R) =
X
x · fR (x)
x∈range(R)
The expectation is sometimes also called the average or the expected value or the
mean value.
6
Exercise 15
Two coins are tossed in a money game. The player wins 5.- if the coins are both Heads, 2.if only one coin is Heads and 1.- if both coins are Tails.
1. Calculate the expected winning.
2. How much should the bet be if this game is to be a zero-sum game?
Exercise 16
Let R and S be random variables and let k be a real number. Show that
E(k · R) = k · E(R)
E(R + S) = E(R) + E(S)
This is called the linearity of expectation.
Exercise 17
If R is a binomial random variable, calculate E(R).
Exercise 18
Roll 2 dice. Score 1 if the total is greater than or equal to 6 and 0 otherwise.
1. Calculate the expected value.
2. Play 100 times. Calculate the probability that the total score is exactly 50.
3. Calculate the expected score.
Exercise 19
Two coins are simultaneously randomly picked from a hat containing two 50 cts pieces and
three 10 cts pieces. Let V be the random variable which counts the total value of the two coins.
1. Find the values that V can take.
2. Describe fV and FV
3. Calculate E(V )
Exercise 20
A sample of 3 objects is randomly chosen from a box containing 20 objects. The box contains
4 faulty objects. Calculate the expectation of faulty objects one will pick.
Exercise 21
A pub game.
The leader of the game rolls three dice. A player can bet on any result (1,2,3,4,5 or 6). If
exactly one dice shows the chosen number, the player gets back his bet plus an equal amount. If
two dice show the chosen number, the player gets his bet back plus twice the same amount. If
the three dice show the chosen number, the player gets his bet back plus three times the same
amount. If the chosen number does not show up, the game leader keeps the money.
Let W be how much the player wins (or loses, in which case W takes negative values).
Calculate E(W ) for a bet of 1£.
7
Variance and Standard Deviation
The expectation of a random variable gives no information about how it is spread around the
average value. This information is given by the variance and standard deviation.
Definition 6
Let R be a random variable and µ = E(R). The variance is
V ar(R) = E (R − µ)2
or
E(R2 ) − (E(R))2
Exercise 22
Show that the two expression in the definition of variance are equal.
Exercise 23
Let R be a random variable that takes n values, x1 , . . . xn and pi = P (R = xi ). Show that
V ar(R) =
n
X
(xi − µ)2 · pi
i=1
Definition 7
Let R be a random variable. The standard deviation σ of R is
σ(R) =
p
V ar(R)
Exercise 24
For each of the following distributions, calculate the mean µ, the variance and the standard
deviation σ.
1.
R
2
3
11
P (R)
1
3
1
2
1
6
S
2.
P (S)
−5 −4
1
4
1
8
1
2
1
2
1
8
3.
T
1
1
4
5
P (T )
2
5
1
10
1
5
3
10
Exercise 25
A rugby team has observed that each training day produces casualties that satisfy the following probability: (C is the number of casualties.)
C
0
1
2
3
4
5
P (C) 0.85 0.07 0.04 0.02 0.01 0.01
1. Calculate the daily casualty average.
2. Calculate the standard variation.
3. Calculate the probability that on any particular day the difference between the number of
accidents and the mean is greater than one standard deviation.
8
Exercise 26
During a television game 100 envelopes are distributed out of which 10 have a voucher which
gives right to a free gift. A person receives 3 envelopes. Let R be the random variable that
counts how many vouchers a given person receives.
1. Describe the density function of R.
2. Calculate E(R) and σ(R).
Exercise 27
Colour blindness is a hereditary disease transmitted by women but only men can have it. 8%
of the world male population is, to some extend, colour blind.
1. Calculate the probability that out of four randomly picked males, exactly three are colour
blind.
2. Only one of the famous four Dalton bandits was colour blind. Is this consistent with your
answer to the previous question?
Exercise 28
In the following, determine b, then determine a such that E(R) = 0.
R
P (R)
−5 −2 a
1
2
9
1
3
b