Chapter 4 Chapter 4 Tim Low tim.low@uct.ac.za Room 5.65 University of Cape Town Wednesday 12 th August 2015 Chapter 4 Random variables Some Definitions I A sample space is a set of all the elementary events that are possible outcomes of a random experiment I Elementary events may be expressed quantitatively or qualitatively I To manipulate events defined on a sample space mathematically, it is necessary to assign a numerical value to each elementary event I For example, consider a random experiment in which a coin is tossed. We could assign a “0” to the event that a head is observed and a “1” to the event that a tail is observed Chapter 4 Random variables Definition of a random variable I Once numerical values have been assigned, let X “stand for” the numerical values of the elementary events I X is then called a random variable because it can take on different values depending on the outcome of a random experiment I Random variables are denoted by capital letters I X is a variable because it can take on the various different values in the sample space I X is random because the particular value it takes on depends on the outcome of a random experiment which is not known in advance Chapter 4 Random variables Definition of a random variable I When dealing with random variables, events are defined as subsets of the real line. Eg. of events: X = 1 ; 5 < X < 10 I We can assign probabilities to these events e.g. P[X = 1] ; Pr[5 < X < 10] I The particular values that a random variable may assume are denoted by small letters. Eg. P[X = x] is the probability that the random variable X takes on the value x. If there is only 1 random variable this can be abbreviated as P(x). For rolling a die: P(x) = 1/6 for x=1, 2, 3, 4, 5 and 6. Chapter 4 Random variables Example Example 5C A car salesperson is scheduled to see two clients today. She sells only two models of cars, an executive (E) and basic (B) model. Each executive model sold earns the salesperson a commission of R2000, while each basic model sold earns her only R1000. If the sale is lost (L), no commission is earned. Suppose P(E)=0.2, P(B)=0.3 and P(L)=0.5, and that sales are independent of each other. Let the r.v. X be the total commission earned today. What values can X take on, and with what probabilities? Chapter 4 Random variables Discrete and Continuous Random Variables I Discrete random variables Take on isolated values along the real line Eg: The number of spectators at a soccer match The number of occupied tables at a restaurant I Continuous random variables: Can be measured to any degree of accuracy Eg. The distance a car travels on one litre of petrol The time that a customer waits in the queue at Steers Chapter 4 Random variables Discrete and Continuous Random Variables Example 6C I Which of the following are random variables? Which of the random variables are discrete and which are continuous? Write down the set of values that each random variable can take on. a The number of customers arriving at a supermarket during the morning b The number of letters in the Greek alphabet c The opening price of gold in New York on Monday next week d The number of seats that will be sold for a performance of a play in a theatre with a capacity of 328 seats e The length of time you have to wait at an autobank f The ratio between the diameter and circumference of a circle g The last digit of a randomly selected telephone number Chapter 4 Random variables Probability Mass Functions (PMF) I I Discrete random variables are represented by PMFs A function p(x) is a PMF if it satisfies the following conditions: 1. p(x) is defined for all values of x but p(x) 6= 0 at a finite set of points 2. P 0 ≤ p(x) ≤ 1 3. p(x) = 1 I Probabilities for discrete random variables are found by calculating the values of the PMF p(x) at the points of interest and summing them: P[a ≤ X ≤ b] = b X x=a p(x) or P[a < X < b] = b−1 X x=a+1 p(x) Chapter 4 Random variables Examples Example 11A (a) Check that the following function satisfies the conditions for a PMF: x p(x) = 15 x = 1, 2, 3, 4, 5 = 0 Otherwise (b) Find P[2 ≤ X ≤ 4] (c) Sketch p(x) Chapter 4 Random variables Examples Eg. 9C The Minister of Environment Affairs has to decide on a fishing quota for the forthcoming season. Currently, the biomass of fish is estimated to be 20 m tonnes. The fish may have a good breeding season (with probability 0.3) and produce 10 m tonnes of young, or have a bad breeding season and produce only 1 m tonnes. A so called “warm-water event” may occur with probability 0.1, and kill 15 m tonnes of fish, otherwise 1 m tonnes of fish will die. Find the probability mass function for X, the biomass of fish before setting the quota (assuming all events are independent). If the minister bases his decision using a policy that the biomass must remain 10 m tonnes or more with probability 0.8, what should his decision be? Chapter 4 Random variables Examples Eg. 10C The hostile merger bid by Minorco on Consgold in 1989 was, at one point, considered highly likely to fail by the financial media. They quoted a 12-1 chance of failure. Express the anticipated outcome of the merger as a probability mass function Eg. 2A Consider a random experiment that consists of tossing an unbiased coin three times. Write out the elements in S. Find the PMF of the random variable X, the number of heads observed in the random experiment Chapter 4 Random variables Examples Eg. 13C Find the sample space for the random experiment which consists of rolling a pair of dice. Find the probability mass function for the random variable X defined to be the sum of the values on the dice and Y defined to be the product of the values. Find P[X ≥ 10] and P[Y ≥ 13]. The outcomes of tossing the 2 die are: (1, 1) (1, 2) (1, 3) (1, 4) (2, 1) (2, 2) (2, 3) (2, 4) (3, 1) (3, 2) (3, 3) (3, 4) (4, 1) (4, 2) (4, 3) (4, 4) (5, 1) (5, 2) (5, 3) (5, 4) (6, 1) (6, 2) (6, 3) (6, 4) (1, 5) (2, 5) (3, 5) (4, 5) (5, 5) (6, 5) (1, 6) (2, 6) (3, 6) (4, 6) (5, 6) (6, 6) Chapter 4 Random variables Probability Density Functions (PDF) I I Continuous random variables are represented by PDFs A function f (x) is a PDF if it satisfies the following conditions: 1. f (x) is defined for all values of x 2. 0 ≤ f (x) ≤ ∞ R∞ 3. −∞ f (x)dx = 1 i.e. the “area under the curve” for a pdf will equal 1. Chapter 4 Random variables Probability Density Functions (PDF) I I For continuous random variables, the PDF f (x) is constructed in such a way that probabilities of events are found by integration The probability that X falls between a and b is found by calculating the area under the graph of f (x) between a and b. Chapter 4 Random variables Probability Density Functions (PDF) I NB: For discrete random variables, the PMF p(x) is the probability that the r.v. X takes on the value x. Note, however, that for continuous r.v.s, the PDF f(x) is NOT the probability that X takes on x. I The probability that a continuous random variable will assume any particular value exactly is zero. I It is only meaningful to talk about X assuming a value within a particular interval. P[X = a] = Pr [X = b] = 0 P[a ≤ X ≤ b] = P[a < X ≤ b] = P[a ≤ X < b] = P[a < X < b] Chapter 4 Random variables Examples Eg. 21B In a certain risky sector of the share market, the proportion of companies that survive (i.e. are not delisted) a year is a continuous random variable lying in the interval from zero to one. A statistician examines the data collected over past years and suggests that the function f (x) = 20x 3 (1 − x) 0 ≤ x ≤ 1 = 0 Otherwise might be useful in modeling X, the annual proportion of companies that survive. (a) Check that f (x) is a probability density function. (b) What is the probability that between 30% and 50% of the companies survive a year? (c) What is the probability that less than 10% of the companies survive a year? Chapter 4 Random variables Examples Eg. 25C (a) Find the value of k so that the function f (x) = = k(x 2 − 1) 1 ≤ x ≤ 3 0 Otherwise may serve as a pdf. (b) Find the probability that X lies between 2 and 3 Chapter 4 Random variables Examples Eg. 27C The probability density function of a random variable X is given by: f (x) = kx(1 − x 2 ) 0 ≤ x ≤ 1 = 0 Otherwise (a) Show that the value of k must be 4 (b) Calculate Pr [0 < X < 21 ] Chapter 4 Random variables Examples A continuous random variable X has probability density function 0.25 for 1 ≤ x ≤ b f (x) = 0 otherwise (a) Find the value of b (b) Find the probability that X > 2 Chapter 4 Random variables Examples A random variable 4x f (x) = 4(1 − x) 0 X can be described by the function defined as follows: for 0 < x < 12 for 12 ≤ x < 1 otherwise (a) Draw a graph of the function f(x). (b) Show that f(x) is a p.d.f for the random variable X. (c) Find P[ 14 < X < 34 ] Chapter 4 Random variables Examples Eg. 29C A small pool building company is equally likely to be able to complete 2 or 3 pool contracts each month. The company receives between 1 and 4 contracts to build pools each month, with probabilities P(1) = 0.1, P(2) = 0.2, P(3) = 0.5, P(4) = 0.2. At the beginning of this month the company has two contracts carried forward from the previous month. The random variable X of interest is the number of contracts to be carried forward to next month. Find the probability mass function of X. In particular, what is the probability that no contracts will be carried forward to next month? Assume that the number of contracts is independent of the number of pools completed. Also, to simplify the problem, assume that the contracts for a month are made at the beginning of the month.