Chapter 2: Random Variables In this chapter we will cover: 1. Discrete Random variables, ( § 2.1 Rice) 2. Continuous Random variables, ( § 2.2 Rice) 3. Functions of a random variable ( § 2.3 Rice) Random Variables 1. A random variable is a number whose value is determined by chance 2. The number of heads in three coin tosses is a random variable 3. The time till the next magnitude 8 earth-quake is a random variable. 4. Example 2 is a discrete random variable since the answer must be a discrete integer value i.e., 0 , 1 , 2 . . . . Since time is continuous (3) is a continuous random variable Example: coin toss • For the three coin tosses the sample space is Ω = { hhh, hht, htt, hth, ttt, tth, thh, tht } • The random variable X is then 3 when hhh occurs, 2 when hht or thh or hth occurs • That is X = 2 if and only if ω ∈ { hht, thh, hth } , hence P ( X = 2) = P ( { hht, thh, hth } ) . • We can therefore work out the probability of seeing X = 0 , 1 , 2 , 3 These are P ( X = 0) = 1 8 , P ( X = 1) = 3 8 , P ( X = 2) = 3 8 , P ( X = 3) = 1 8 • This is called the probability mass function for X . It is also called the frequency function. 1
Probability mass function • A general discrete random variable which values x 1 , x 2 , x 3 , · · · • The probability mass function is p ( x i ) = P ( X = x i ) • From the rules of probability we must have that 0 ≤ p ( x i ) ≤ 1 and � p ( x i ) = 1 i Cumulative distribution function • As an alternative to the mass function you can also defined the cumulative distribution function (cdf) • Defined by F ( x ) = P ( X ≤ x ) Prob. Mass Fn. Cumulative Distribution 1.0 ● 0.35 ● 0.30 0.8 0.25 0.6 Probability Probability 0.20 ● 0.15 0.4 0.10 0.2 0.05 ● 0.0 0.00 0 1 2 3 −1 0 1 2 3 4 x 2
Cumulative distribution function • Cumulative distribution functions are often denoted by capital letters e.g. F ( x ) • Frequency functions by lowercase letters e.g. f ( x ) • The CDF is non-decreasing and satisfies x →−∞ F ( x ) = 0 , lim lim x →∞ F ( x ) = 1 Bernoulli Random variables 1. A Bernoulli random variable takes only two possible values 0 or 1 2. The probability it takes the value 1 is p , the probability it takes value 0 is 1 − p . 3. Its frequency function is p if x = 1 p ( x ) = 1 − p if x = 0 0 otherwise 4. This can also be written as p ( x ) = p x (1 − p ) 1 − x for x = 0 , 1 and 0 otherwise Exercise Sketch the frequency and cdf for the random variable X where P ( X = − 1) = 1 10 , P ( X = 0) = 1 10 , P ( X = 1) = 3 10 , P ( X = 2) = 2 10 , P ( X = 3) = 0 , P ( X = 4) = 3 10 3
Exercise Whats the probability mass function for the cdf below? Cumulative Distribution 1.0 ● ● 0.8 ● ● 0.6 ● Probability ● 0.4 ● ● 0.2 ● ● 0.0 0 2 4 6 8 10 x Recommended Questions From § 2.5 of Rice you should do 1, 3, 5 (a), 7 Indicator random variables 1. If A is an event, then there is a probability p that the event happens, and 1 − p that is doesn’t happen 2. This can be coded as a random variable by taking the value 1 if it does happen and 0 if it does not. 3. Formally defined the indicator random variable I A ( ω ) by � 1 ω ∈ A I A ( ω ) = 0 ω / ∈ A 4. Then I A ( ω ) is a Bernoulli r.v. for any A . 4
The Binomial distribution 1. Suppose that n independent experiments, each either ‘success’ or a ‘failure’, are run 2. Further suppose that for each experiment there is a fixed probability p of ‘success’ 3. The number of successes in n experiments is called a binomial random variable 4. Its frequency function is � n � p k (1 − p ) n − k p ( x ) = k for x ∈ { 0 , 1 , · · · , n } . The Binomial distribution Some frequency functions when n = 10 for different values of p p=0.1 p=0.5 0.4 ● ● ● 0.20 ● ● 0.3 probability probability 0.2 ● ● ● 0.10 0.1 ● ● ● 0.00 ● ● 0.0 ● ● ● ● ● ● ● ● ● 0 2 4 6 8 10 0 2 4 6 8 10 x x p=0.3 p=0.9 0.4 ● ● ● ● 0.3 0.20 ● probability probability 0.2 ● ● 0.10 ● 0.1 ● ● ● 0.00 ● 0.0 ● ● ● ● ● ● ● ● ● ● 0 2 4 6 8 10 0 2 4 6 8 10 x x The Binomial distribution 1. The mode is the x value with the highest probability. What is it in each of the cases shown above? 2. What is the relationship between the p = 0 . 1 and p = 0 . 9 case? 5
The Tay-Sachs disease • Couples can be carriers of Tay-Sach disease • Each child has a probability 0 . 25 of having the disease and this is independent across different children • If the couple have 4 children, the number that will have the disease is Binomial (4 , 0 . 25) • These are P ( k = 0) = 0 . 316 , P ( k = 1) = 0 . 422 , P ( k = 2) = 0 . 211 , P ( k = 3) = 0 . 047 , P ( k = 4) = 0 . 004 The Tay-Sachs disease • What would these probabilities be if the probability of a single child having the disease is 0 . 5 ? • What is the mode (i.e the most likely number)? The geometric distribution • The geometric distribution is also constructed from independent Bernoulli trials • On each trial a ‘success’ occurs with probability p • The geometric random variable counts the number of trials before the first success happens • The frequency function is p ( k ) = (1 − p ) k − 1 p for k = 1 , 2 , 3 , · · · . 6
The geometric distribution Here are some numerical examples for different values of p . p=0.1 p=0.5 0.6 0.6 ● 0.4 0.4 probability probability ● 0.2 0.2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.0 ● 0.0 ● ● ● ● ● ● ● ● ● ● ● 5 10 15 5 10 15 x x p=0.3 p=0.6 0.6 0.6 ● 0.4 0.4 probability probability ● ● 0.2 0.2 ● ● ● ● ● ● ● ● ● 0.0 ● 0.0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 5 10 15 5 10 15 x x Exercise 1. Which is more likely (i) 9 heads from 10 throws or (ii) 18 heads from 20 throws, of a fair coin 2. If X is a geometric random variable with p = 0 . 5 for what value of k is P ( X ≤ K ) ≈ 0 . 99 The hypergeometric distribution • Suppose we have an urn with n balls, r black and n − r white. • Let X be the number of black balls drawn when taking m balls without replacement. X has a hypergeometric distribution. • Its frequency function is �� n − r � r � k m − k P ( X = k ) = � n � m • Thus the probability of winning a lottery is hypergeometric 7
The Poisson distribution • This has a frequency function P ( X = k ) = λ k k ! exp( − λ ) for k = 0 , 1 , 2 , · · · . • This can be thought of as a limit of binomial trials as n gets large, and p is small, where λ = np . The Poisson and binomial distributions Comparing numerically some Poisson and binomial distributions, the black is the Binomial, the red the Poisson. n=5, p=0.1, lambda=0.5 n=20, p=0.5, lambda=10 0.6 ● ● ● ● ● 0.15 0.4 ● ● ● ● probability probability ● ● 0.10 ● ● ● ● ● ● ● 0.2 ● 0.05 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.00 ● ● ● ● 0.0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 1 2 3 4 5 0 5 10 15 20 x x n=5, p=0.1, lambda=0.5 n=100, p=0.1, lambda=10 ● ● ● 0.12 ● ● ● ● ● ● ● ● ● 0.20 ● ● ● ● ● 0.08 probability probability ● ● ● ● ● ● ● 0.10 ● ● ● ● 0.04 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.00 0.00 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 2 4 6 8 10 0 20 40 60 80 100 x x Examples • Modelling the number of telephone calls coming into an exchange if the exchange has a large number of customers which act more or less independently • Modelling the number of α particles emitted from a radio active source • Modelling the number of large accidents by an insurance company 8
Recommend
More recommend