Download Lecture 4

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
no text concepts found
Transcript
Random Variables
Example
In an opinion poll, 50 people are sampled to ask if they agree
with certain issue. If you record a ’1’ for agree and ’0’ for
disagree. The sample space contain 250 sample points
S = {101 · · · 000
010 · · · 000
···}
We might only interested in the number of people who agree
X = Number of 1s recorded out of 50.
Random variable
I
Definition: A random variable is a function from a sample
space S into real numbers.
I
A discrete random variable is a real-valued function on
discrete sample space.
I
Discrete random variables can take finite or countable
infinite number of values.
Example 1: Tossing 3 fair coins
Suppose that an experiment consists of tossing 3 fair coins. If
we let Y denote the number of heads that appear, then Y is a
random variable taking on one of the values 0,1,2 and 3 with
respective probabilities
P(Y = 0) = P({T , T , T }) =
1
8
3
8
3
P(Y = 2) = P({T , H, H}, {H, T , H}, {H, H, T }) =
8
1
P(Y = 3) = P({H, H, H}) =
8
P(Y = 1) = P({T , T , H}, {T , H, T }, {H, T , T }) =
Example 2: Tossing two dice
Define X (s) = Sum of the numbers of two dice. Then X (s) is a
random variable on sample space S.
S = {s : 11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26,
31, 32, 33, 34, 35, 36, 41, 42, 43, 44, 45, 46,
51, 52, 53, 54, 55, 56, 61, 62, 63, 64, 65, 66}.
s
11
12
13
14
···
65
66
X (s)
2
3
4
5
···
11
12
Example continued
1
36 .
I
PX (X (s) = 2) = P({s : X (s) = 2}) = P({11}) =
I
PX (X (s) = 4) = P({s : X (s) = 4}) = P({13, 31, 22}) =
3
36 .
x
2
3
4
5
6
7
···
11
12
PX (X (s) = x)
1
36
2
36
3
36
4
36
5
36
6
36
···
2
36
1
36
We call PX induced probability function on χ. We can verify that
PX is a probability measure on χ.
Probability mass function (pmf)
I
The probability mass function for X is the function f
defined on the real line by
f (x) = PX (X = x) = P(s : X (s) = x).
P
I
Two properties: (i) f (x) ≥ 0 for all x and (ii)
I
We will simplify PX to P when there is no confusion. We
x
f (x) = 1.
will always use capital letters to denote random variables
and lower case letters to represent the realized value of the
random variable.
Example: pmf for binomial random variables
Suppose you toss a coin 5 times. Let
X = {the number of heads obtained}.
For example:
{s : X (s) = 2} = {HHTTT, HTHTT, HTTHT, HTTTH, THHTT,
THTHT, THTTH, TTHHT, TTHTH, TTTHH}.
Assume (a) the trials are independent and (b) the probabilities
of getting head on each trial are the same. Then for each of the
outcomes in {X = 2}, the probability is (1/2)2 (1/2)3 .
5
2
3
P(X = 2) = 10 × (1/2) (1/2) =
(1/2)2 (1/2)3 .
2
Binomial distribution
In general, assume n experiments are performed, for each trial,
the probability of getting head (‘success’) is p.
n k
f (k ) = P(X = k ) =
p (1 − p)n−k , for k = 0, 1, 2, · · · , n.
k
Then X is said to have binomial distribution with parameters n
and p, having pmf f (k ) for k = 0, 1, · · · , n. If n = 1, X is said to
have Bernoulli distribution with parameter p.
n
X
k=0
n X
n k
f (k ) =
p (1 − p)n−k = (p + (1 − p))n = 1.
k
k=0
Example: pmf for Geometric distribution random
variables
Suppose we toss a coin until a head appear. Let
X =number of tosses required to get a head
p =probability of a head on each toss.
Since the toss are independent and X = k means that we get
k − 1 tails before we get a head on the k−th trial,
f (k ) = P(X = k) = (1 − p)k−1 p,
We can see that
∞
∞
X
X
f (k ) =
(1 − p)k−1 p =
k=1
k=1
k = 1, 2, 3, · · · .
p
= 1.
1 − (1 − p)
Cumulative Distribution Function (CDF)
Definition: The cumulative distribution function or CDF of a
random variable X , denoted by FX (x) is defined by
FX (x) = PX (X ≤ x) for all x.
A random variable is discrete if FX (x) is a step function of x.
Example: Tossing two dice
Let X = sum of the numbers of two dice.


0, −∞ < x < 2;





 1 , 2 ≤ x < 3;


 36
3
FX (x) =
36 , 3 ≤ x < 4;



..


.





1, 12 ≤ x < ∞.
CDF plot
The CDF plot is as follows:
CDF function
The function F (x) is a CDF if and only if the following three
conditions hold
(a) limx→−∞ F (x) = 0 and limx→∞ F (x) = 1.
(b) F (x) is a non-decreasing function of x.
(c) F (x) is right-continuous. i.e, for every number x0 ,
limx↓x0 F (x) = F (x0 ).
Example: CDF for geometric random variable
FX (x) = P(X ≤ x) =
[x]
X
P(X = i)
i=1
 P
[x]
i
[x]

i=1 (1 − p) p = 1 − (1 − p) , if x ≥ 1;
=
 0,
if x < 1.
where [x] is the largest integer no larger than x.