Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Lesson 4: Discrete Probability Distributions Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-1 Outline Random variables and probability distribution Features of univariate probability distribution Binomial Probability Distribution Hypergeometric Probability Distribution Poisson Probability Distribution Features of bivariate probability distribution Conditional distribution Conditional expectation Covariance and Correlation Coefficient Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-2 Random Variables and probability distribution A random variable is a numerical value determined by the outcome of an experiment. A random variable is often denoted by a capital letter, e.g., X or Y. A probability distribution is the listing of all possible outcomes of an experiment and the corresponding probability. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-3 Types of Probability Distributions A discrete probability distribution can assume only certain outcomes (need not be finite) – for random variables that take discrete values. The number of students in a class. The number of children in a family. A continuous probability distribution can assume an infinite number of values within a given range – for random variables that take continuous values. The time it takes an executive to drive to work. The amount of money spent on your last haircut. The distance students travel to class. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-4 Types of Probability Distributions Probability distribution may be classified according to the number of random variables it describes. Number of random variables Ka-fu Wong © 2007 Joint distribution 1 Univariate probability distribution 2 Bivariate probability distribution 3 Trivariate probability distribution … … n Multivariate probability distribution ECON1003: Analysis of Economic Data Lesson4-5 Discrete Random Variables Can only take on a countable number of values Examples: Roll a die once Let X be the number of times “4” comes up (then X could be 0, or 1 time) Roll a die twice Let X be the number of times “4” comes up (then X could be 0, 1, or 2 times) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-6 Discrete Random Variables Can only take on a countable number of values Examples: Toss a coin once. Let X be the number of heads (then X = 0 or 1) Toss a coin 5 times. Let X be the number of heads (then X = 0, 1, 2, 3, 4, or 5) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-7 Example 1: Tossing coin(s) Discrete Probability Distribution Experiment: Toss 1 Coin. Let X = # heads. Show P(x) , i.e., P(X = x) , for all values of x: 2 possible outcomes T H Probability Distribution X-value Probability 0 1/2 =0.5 1 1/2 =0.5 0.5 0.4 0.3 0.2 0.1 0 Ka-fu Wong © 2007 0 ECON1003: Analysis of Economic Data 1 Lesson4-8 Example 1: Tossing coin(s) Discrete Probability Distribution Experiment: Toss 2 Coins. Let X = # heads. Show P(x) , i.e., P(X = x) , for all values of x: 4 possible outcomes T T T Probability Distribution X-value Probability 0 1/4 =0.25 1 1/2 =0.5 2 1/4 =0.25 H 0.5 H T 0.4 0.3 H 0.2 H 0.1 0 Ka-fu Wong © 2007 0 Data 1 ECON1003: Analysis of Economic 2 Lesson4-9 Example 1: Tossing coin(s) Discrete Probability Distribution Consider a random experiment in which a coin is tossed three times. Let x be the number of heads. Let H represent the outcome of a head and T the outcome of a tail. The possible outcomes for such an experiment will be: TTT, TTH, THT, THH, HTT, HTH, HHT, HHH. Thus the possible values of x (number of heads) are x=0: x=1: x=2: x=3: Ka-fu Wong © 2007 TTT TTH, THT, HTT THH, HTH, HHT HHH P(x=0) =1/8 P(x=1) =3/8 P(x=2) =3/8 P(x=3) =1/8 ECON1003: Analysis of Economic Data Lesson4-10 Features of a Univariate Discrete Distribution Let x1,…,xN be the list of all possible outcomes (N of them). The main features of a discrete probability distribution are: The probability of a particular outcome, P(xi), is between 0 and 1.00. The sum of the probabilities of the various outcomes is 1.00. That is, P(x1) + … + P(xN) = 1 The outcomes are mutually exclusive. That is, P(x1 and x2) = 0 and Outcome Prob. P(x1 or x2) = P(x1)+ P(x2) x1 P(x1) Generally, for all i not equal to k. x2 P(x2) P(xi and xk) = 0. … … P(xi or xk) = P(xi)+ P(xk) xN Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data P(xN) Lesson4-11 Features of a Univariate Discrete Distribution Can the following be a probability distribution of a random variable? x Prob. x Prob. 1 0.2 2 0.3 1 0.6 3 0.1 2 0.3 1 0.4 3 0.1 Ka-fu Wong © 2007 event Prob. 1 or 2 0.6 2 or 3 0.3 3 or 1 0.1 ECON1003: Analysis of Economic Data Lesson4-12 Cumulative Probability Function The cumulative probability function, denoted F(c), shows the probability that X is less than or equal to c F(c) = P(X≤c) In other words, F(c) = ∑x≤c P(X=x) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-13 Moments of a random variable The n-th moment is defined as the expectation of the n-th power of a random variable: E(Xn) E(X) First moment E(X2) Second moment The n-th centralized moment is defined as: E[X-E(X)]n E(X-m)2 Second centralized moment E(X-m)3 Third centralized moment Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-14 The Expectation (Mean) of Discrete Probability Distribution The expectation or mean of a discrete random variable X, is computed by the formula: E(x) Σ[xP(x)] x1P(x1 ) x 2P(x 2 ) ... x nP(x n ) Example: Toss 2 coins, x = # of heads, what is the expected value of x? P(0) = 0.25, P(1)=0.5, P(2)=0.25. E(X) = P(0)*0 + P(1)*1 + P(2)*2 = 1 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-15 Transformation of Random variables A transformation of random variable(s) results in a new random variable. For example, if X is a random variable, the following are also random variables: Z=2X Z=3+2X Z=X2 Z=log(X) Example: X = amount of insurance policy underwritten by an agent for the month Z = income earned for the month Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-16 Transformation of Random variables Example: Z=3+2X X = amount of insurance policy underwritten by an agent for the month Z = income earned for the month x P(x) z P(z) 1 P(1) 5 P(5) 2 P(2) 7 P(7) 3 P(3) 9 P(9) P(x) = P(3+2x) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-17 Expectation of a linear transformed random variable If a and b are constants and X is a random variable, then E(a) = a E(bX) = bE(X) E(a+bX) = a+bE(X) E(a bx) Σ[(a bx)P(a bx)] Σ[(a bx)P(x)] (a bx1 )P(x 1 ) (a bx 2 )P(x 2 ) ... (a bx n )P(x n ) aP(x1 ) bx1P(x1 ) aP(x 2 ) bx 2P(x 2 ) ... aP(x n ) bx nP(x n ) a[P(x 1 ) P(x 2 ) ... P(x n )] b[x1P(x1 ) x 2P(x 2 ) ... x nP(x n ) ] a bE(x) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-18 Expectation of a general functions of random variables If P(x) is the probability function of a discrete random variable X, and g(X) is some function of X , then the expected value of function g is E[g(x)] = g( E(x) ) = g( ∑x xP(x) ) ✓ Ka-fu Wong © 2007 E[g(x)] = E[g(x)] = ∑x g(x)P(x) ECON1003: Analysis of Economic Data Lesson4-19 Expectation of a general functions of random variables Experiment: Toss 2 Coins. Let X = # heads. X-value Probability 0 1/4 =0.25 1 1/2 =0.5 2 1/4 =0.25 g(x) = x2 E[g(x)] = g( E(x) ) = g( ∑x xP(x) ) = (0*0.25 + 1*0.5 + 2*0.25)2=12=1 ✓ E[g(x)] = E[g(x)] = ∑x g(x)P(x) = 02*0.25 + 12*0.5 + 22*0.25=1.5 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-20 Variance of a discrete random variable For univariate discrete probability distribution Var ( X ) E[(X μ)2 ] Σ[(x μ)2 P(x)] (x 1 μ)2 P(x1 ) (x 2 μ)2 P(x 2 ) ... (x n μ) 2 P(x n ) Example: Toss 2 coins, x = # of heads, what is the variance of x? P(0) = 0.25, P(1)=0.5, P(2)=0.25. E(X) = P(0)*0 + P(1)*1 + P(2)*2 = 1 V(X) = P(0)*(0-1)2 + P(1)*(1-1)2 + P(2)*(2-1)2 = 0.5 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-21 Variance of a linear transformed random variable If a and b are constants and X is a random variable, then Var(a) = 0 Var(bX) = b2Var(X) Var(a+bX) = b2Var(X) Var (a bX) E[ a bX (a bμ ) ]2 E[ bX bμ ]2 E[ b(X μ) ]2 E[ b2 (X μ)2 ] b2 E[ (X μ)2 ] b2 Var(X) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-22 The Binomial Distribution Probability Distributions Discrete Probability Distributions Binomial Hypergeometric Poisson Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-23 Bernoulli Distribution Consider only two outcomes: “success” or “failure” Let P denote the probability of success Let 1 – P be the probability of failure Define random variable X: x = 1 if success, x = 0 if failure Then the Bernoulli probability function is P(0) (1 P) and Ka-fu Wong © 2007 P(1) P ECON1003: Analysis of Economic Data Lesson4-24 Bernoulli Distribution Mean and Variance P(0) (1 P) and P(1) P The mean is µ = P μ E(X) xP(x) (0)(1 P) (1)P P X The variance is σ2 = P(1 – P) σ 2 E[(X μ)2 ] (x μ)2 P(x) X (0 P)2 (1 P) (1 P)2 P P(1 P) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-25 Sequences of x Successes in n Trials The number of sequences with x successes in n independent trials is: C(n,x) = n!/([x!(n-x)!] where n! = n*(n – 1)*(n – 2)* . . . *1 and 0! = 1 These sequences are mutually exclusive, since no two can occur at the same time Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-26 Binomial Probability Distribution The binomial distribution has the following characteristics: An outcome of an experiment is classified into one of two mutually exclusive categories, such as a success or failure. The data collected are the results of counts in a series of trials. The probability of success stays the same for each trial. The trials are independent. For example, tossing an unfair coin three times. H is labeled success and T is labeled failure. The data collected are number of H in the three tosses. The probability of H stays the same for each toss. The results of the tosses are independent. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-27 Binomial Probability Distribution To construct a binomial distribution, let n be the number of trials x be the number of observed successes p be the probability of success on each trial The formula for the binomial probability distribution is: P(x) = C(n,x) p x(1- p)n-x Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-28 Binomial Probability Distribution The formula for the binomial probability distribution is: P(x) = C(n,x) p x(1- p)n-x TTT, TTH, THT, THH, HTT, HTH, HHT, HHH. C(n,x) = n!/([x!(n-x)!] X=number of heads The coin is fair, i.e., P(head) = 1/2. P(x=0) = C(3,0) 0.5 0(1- 0.5)3-0 =3!/(0!3!) (1) (1/8)=1/8 P(x=1) = C(3,1) 0.5 1(1- 0.5)3-1 =3!/(1!2!) (1) (1/8)= 3/8 P(x=2) = C(3,2) 0.5 2(1- 0.5)3-2 =3!/(2!1!) (1) (1/8)= 3/8 P(x=3) = C(3,3) 0.5 3(1- 0.5)3-3 =3!/(3!0!) (1) (1/8)= 1/8 When the coin is not fair, simple counting rule will not work. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-29 The density functions of binomial distributions with n=20 and different success rates p P(x) = C(n,x) px(1- p)n-x Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-30 Example: Binomial P(x) = C(n,x) px(1- p)n-x x = number of students who will receive scholarships among those who have a semester GPA>3.5 n = 4 , p = 0.1 , q = 1 – p = 1 - 0.1 = 0.9 Find the probability that 2 of the 4 students among those who have a semester GPA>3.5 will receive scholarships. 4! p(2) P(x=2)= (0.1)2 (0.9)4-2 =6(0.1)2 (0.9)2 =0.0486 2!(4-2)! Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-31 Example: Binomial P(x) = C(n,x) px(1- p)n-x After Asian Financial Crisis, Thailand’s Department of Labor reports that 20% of the workforce is unemployed. From a sample of 14 workers, calculate the following probabilities: Exactly three are unemployed. At least three are unemployed. At least one are unemployed. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-32 Example: Binomial P(x) = C(n,x) px(1- p)n-x The probability of exactly 3: P(3) C(14,3)(.2)3 (1 .2)11 (364)(.008 )(.0859) .2501 The probability of at least 3 is: P(x 3) C(14,3)(.20)3 (.80)11 ... C(14,14)(.20)14 (.80) 0 .250 .172 ... .000 .551 The probability of at least one being unemployed: P(x 1) 1 P(0) 1 C(14,0)(.20) 0 (1 .20)14 1 .044 .956 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-33 Mean & Variance of the Binomial P(x) = C(n,x) px(1- p)n-x Distribution The mean is found by: n m xP( x) np x 0 The variance is found by: n 2 ( x m ) 2 P ( x) np (1 p ) x 0 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-34 Example: Binomial P(x) = C(n,x) px(1- p)n-x Since p =.2 and n=14. Hence, the mean is: m= n p = 14(.2) = 2.8. The variance is: 2 = n p (1- p ) = (14)(.2)(.8) =2.24. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-35 Using Binomial Tables P(x) = C(n,x) px(1- p)n-x N x … p=.20 p=.25 p=.30 p=.35 p=.40 p=.45 p=.50 10 0 1 2 3 4 5 6 7 8 9 10 … … … … … … … … … … … 0.1074 0.2684 0.3020 0.2013 0.0881 0.0264 0.0055 0.0008 0.0001 0.0000 0.0000 0.0563 0.1877 0.2816 0.2503 0.1460 0.0584 0.0162 0.0031 0.0004 0.0000 0.0000 0.0282 0.1211 0.2335 0.2668 0.2001 0.1029 0.0368 0.0090 0.0014 0.0001 0.0000 0.0135 0.0725 0.1757 0.2522 0.2377 0.1536 0.0689 0.0212 0.0043 0.0005 0.0000 0.0060 0.0403 0.1209 0.2150 0.2508 0.2007 0.1115 0.0425 0.0106 0.0016 0.0001 0.0025 0.0207 0.0763 0.1665 0.2384 0.2340 0.1596 0.0746 0.0229 0.0042 0.0003 0.0010 0.0098 0.0439 0.1172 0.2051 0.2461 0.2051 0.1172 0.0439 0.0098 0.0010 Examples: n = 10, x = 3, P = 0.35: P(x = 3|n =10, p = 0.35) = .2522 n = 10, x = 8, P = 0.45: P(x = 8|n =10, p = 0.45) = .0229 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-36 Finite Population A finite population is a population consisting of a fixed number of known individuals, objects, or measurements. Examples include: The number of students in this class. The number of cars in the parking lot. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-37 Hypergeometric Distribution The hypergeometric distribution has the following characteristics: There are only 2 possible outcomes. The probability of a success is not the same on each trial. It results from a count of the number of successes in a fixed number of trials. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-38 Example: Hypergeometric Distribution In a bag containing 7 red chips and 5 blue chips you select 2 chips one after the other without replacement. 6/11 7/12 5/12 R2 R1 5/11 B2 7/11 R2 B1 4/11 B2 The probability of a success (red chip) is not the same on each trial. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-39 Hypergeometric Distribution The formula for finding a probability using the hypergeometric distribution is: C ( S , x)C ( N S , n x) P( x) C ( N , n) where N is the size of the population, S is the number of successes in the population, x is the number of successes in a sample of n observations. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-40 Hypergeometric Distribution Use the hypergeometric distribution to find the probability of a specified number of successes or failures if: the sample is selected from a finite population without replacement (recall that a criteria for the binomial distribution is that the probability of success remains the same from trial to trial) the size of the sample n is greater than 5% of the size of the population N . Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-41 The density functions of hypergeometric distributions with N=100, n=20 and different success rates p (=S/N). Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-42 Example: Hypergeometric Distribution The University Examination Board has a list of 10 reported cheating cases. Suppose only 4 of the reported cheating cases are real cheating and the University Examination Board will only be able to investigate five of the cheating cases. What is the probability that three of five reported cheating cases randomly selected to be investigated are real cheating cases? Number of reported cases, N=10 Number of real cheating cases out of 10, S=4 Number of cases investigated, n=5 C (4,3)C (10 4,5 3) P(3) C (10,5) C (4,3)C (6,2) 4(15) .238 C (10,5) 252 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-43 Example: Hypergeometric Distribution ■ 3 different computers are checked from 10 in the department. 4 of the 10 computers have illegal software loaded. What is the probability that 2 of the 3 selected computers have illegal software loaded? ■ N = 10, S=4, n=3, x=2 P(x 2 ) C(S,x)C(N-S, n-x) C( 4,2 )C( 6,1 ) ( 6 )( 6 ) 0.3 C(N,n) C( 10,3 ) 120 The probability that 2 of the 3 selected computers have illegal software loaded is 0.30, or 30%. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-44 Poisson Probability Distribution The formula for the binomial probability distribution is: P(x) = C(n,x) p x(1- p)n-x The binomial distribution becomes more skewed to the right (positive) as the probability of success become smaller. The limiting form of the binomial distribution where the probability of success p is small and n is large is called the Poisson probability distribution. Let l=np, i.e., p=l/n. limn C(n,x) (l/n)x(1- l/n)n-x = [lxe-l]/x! Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-45 The Poisson Distribution Apply the Poisson Distribution when: You wish to count the number of times an event occurs in a given continuous interval The probability that an event occurs in one subinterval is very small and is the same for all subintervals The number of events that occur in one subinterval is independent of the number of events that occur in the other subintervals There can be no more than one occurrence in each subinterval The average number of events per unit is l (lambda) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-46 Poisson Probability Distribution The Poisson distribution can be described mathematically using the formula: P( x) lx e l x! where l is the mean number of successes in a particular interval of time, e is the constant 2.71828, and x is the number of successes. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-47 Poisson Distribution Characteristics Mean μ E(x) λ Variance and Standard Deviation σ 2 E[( X m ) 2 ] λ σ λ where l = expected number of successes per unit Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-48 Poisson Probability Distribution The mean number of successes l can be determined in binomial situations by n p, where n is the number of trials and p the probability of a success. The variance of the Poisson distribution is also equal to n p. X, the number of success generally has no specific upper limit. Probability distribution always skewed to the right. Becomes symmetrical when l gets large. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-49 Example: Poisson Probability Distribution The Sylvania Urgent Care facility specializes in caring for minor injuries, colds, and flu. For the evening hours of 610 PM the mean number of arrivals is 4.0 per hour. What is the probability of 2 arrivals in an hour? P( x) Ka-fu Wong © 2007 lx e l x! 4 2 e 4 .1465 2! ECON1003: Analysis of Economic Data Lesson4-50 Example: Poisson Probabilities x = P( x) lx e l x! number of Cleveland air traffic control errors during one week m = 0.4 (expected number of errors per week) Find the probability that 3 errors will occur in a week. e-0.4 (0.4)3 p(3) P(x = 3) = = .0072 3! Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-51 Several Poisson Distributions As l gets large, the probability distribution becomes symmetric. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-52 Using Poisson Tables l X 0 1 2 3 4 5 6 7 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 0.9048 0.0905 0.0045 0.0002 0.0000 0.0000 0.0000 0.0000 0.8187 0.1637 0.0164 0.0011 0.0001 0.0000 0.0000 0.0000 0.7408 0.2222 0.0333 0.0033 0.0003 0.0000 0.0000 0.0000 0.6703 0.2681 0.0536 0.0072 0.0007 0.0001 0.0000 0.0000 0.6065 0.3033 0.0758 0.0126 0.0016 0.0002 0.0000 0.0000 0.5488 0.3293 0.0988 0.0198 0.0030 0.0004 0.0000 0.0000 0.4966 0.3476 0.1217 0.0284 0.0050 0.0007 0.0001 0.0000 0.4493 0.3595 0.1438 0.0383 0.0077 0.0012 0.0002 0.0000 0.4066 0.3659 0.1647 0.0494 0.0111 0.0020 0.0003 0.0000 Example: Find P(X = 2) if l = .50 e l lX e 0.50 (0.50) 2 P( X 2) .0758 X! 2! Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-53 What distributions to use? Poisson considers the number of times an event occurs over an INTERVAL of TIME or SPACE. Note that we are not considering a sample of given number of observations. Thus, if we are considering a sample of 10 observations and we are asked to compute the probability of having 6 successes, we should not use Poisson. Instead, we should consider Binomial or Hypergeometric. Hypergeometric consider the number of successes in a sample when the probability of success varies across trials due to “without replacement” sampling strategy. To compute the Hypergeometric probability, one will need to know N and S separately. Suppose we know that the probability of success is 0.3. We are considering a sample of 10 observations and we are asked to compute the probability of having 6 successes. We cannot use Hypergeometric because we do not have N and S separately. Instead, we have to use Binomial. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-54 What distributions to use? Example In a shipment of 15 hard disks, 5 are defective. If 4 of the disks are inspected, what is the probability that exactly 1 is defective? First, we recognize that it is not Poisson because "4 of the disks are inspected" (i.e., sample size =4). Second, it is sampling without replacement because if we were to inspect four disks for defects, we will not want to sample with replacement. Third, both N (15 hard disks) and S (5 are defective) are given. Hence we will use Hypergeometric. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-55 What distributions to use? Example From an inventory of 48 cars being shipped to local automobile dealers, 12 have had defective radios installed. What is the probability that one particular dealership receiving 8 cars obtains all with defective radios? First, we recognize that it is not Poisson because 8 cars are “inspected" (i.e., sample size =8). Second, it is sampling without replacement because if we were to inspect all 8 cars for defects, we will not want to sample with replacement. Third, both N (48 cars) and S (12 have defective radio) are given. Hence we will use Hypergeometric. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-56 What distributions to use? Example The number of claims for missing baggage for a well-known airline in a small city averages nine per day. What is the probability that, on a given day, there will be fewer than three claims made? First, we recognize that it is likely Poisson because “on a given day”. Second, we are asked to compute the probability of the number of claims larger than some number. There is no limit on the number of claims that can arrive in a given day. Third, “average per day” is given. Hence we will use Poisson. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-57 What distributions to use? Example When a customer places an order with Rudy’s on-Line Office Supplies, a computerized accounting information system (AIS) automatically checks to see if the customer has exceeded his or her credit limit. Past records indicate that the probability of customers exceeding their credit limit is 0.05. Suppose that, on a given day, 20 customers place orders. What is the probability that zero customers will exceed their limits? First, we recognize that it is not Poisson because 20 customers place orders (i.e., sample size =20). Second, the probability of drawing a particular type of customers appears the same across trials because “the probability of customers exceeding their credit limit is 0.05”. Hence we will use Binomial. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-58 Features of a Bivariate Discrete Distribution If X and Y are discrete random variables, we may define their joint probability function as PXY(xi,yi) Let (x1,…,xR) and (y1,…,yS) be the list of all possible outcomes for X and Y respectively. The main features of a bivariate discrete probability distribution are: The probability of a particular outcome, PXY(xi,yi) is between 0 and 1. The sum of the probabilities of the various outcomes is 1.00. That is, PXY(x1,y1) + PXY(x2,y1) +…+ PXY(xR,y1) + + … + PXY(xR,yS) = 1 The outcomes are mutually exclusive. That is, if xi not equal to xk, or yi not equal to yk PXY((xi,yi) and (xk,yk)) = 0 and PXY((xi,yi) or (xk,yk)) = PXY(xi,yi) + PXY(xk,yk) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-59 Example: Bivariate Discrete Distribution X takes 3 possible values and Y takes 4 possible values. y1 y2 y3 y4 x1 P(x1,y1) P(x1,y2) P(x1,y3) P(x1,y4) x2 P(x2,y1) P(x2,y2) P(x2,y3) P(x2,y4) x3 P(x3,y1) P(x3,y2) P(x3,y3) P(x3,y4) joint probability Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-60 EXAMPLE: Bivariate distribution The joint distribution of the movement of Hang Seng Index (HSI) and weather is shown in the following table. Rainy Not Rainy Totals HSI falls 0.15 0.4 0.55 HSI rises 0.2 0.25 0.45 0.35 0.65 1.0 Totals Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-61 Hirshleifer, David; Shumway, Tyler (2003): “Good Day Sunshine: Stock Returns and the Weather ,” Journal of Finance, 58(2): 1009-32. Psychological evidence and casual intuition predict that sunny weather is associated with upbeat mood. This paper examines the relationship between morning sunshine in the city of a country's leading stock exchange and daily market index returns across 26 countries from 1982 to 1997. Sunshine is strongly significantly correlated with stock returns. After controlling for sunshine, rain and snow are unrelated to returns. Substantial use of weather-based strategies was optimal for a trader with very low transactions costs. However, because these strategies involve frequent trades, fairly modest costs eliminate the gains. These findings are difficult to reconcile with fully rational price setting. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-62 Marginal Distributions Average out the impact of y on the probability. Y X Rainy Not Rainy Totals HSI falls 0.15 0.4 0.55 HSI rises 0.2 0.25 0.45 0.35 0.65 1.0 Totals The marginal probability function of X. PX(x) = yPXY(x, y) = PXY(x, y1) +PXY(x, y2) +…+ PXY(x, yn) P(HSI falls)= P(HSI falls and rainy) + P(HSI falls and not rainy) P(HSI rises)= P(HSI rises and rainy) + P(HSI rises and not rainy) The double sum xyPXY(x, y) = P(HSI falls and rainy) + P(HSI falls and not rainy)+ P(HSI rises and rainy) + P(HSI rises and not rainy) = P(HSI falls)+P(HSI rises)= 1 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-63 Marginal Distributions Y X Rainy Not Rainy Totals HSI falls 0.15 0.4 0.55 HSI rises 0.2 0.25 0.45 0.35 0.65 1.0 Totals The marginal probability function of X. yPXY(x, y) = PX(x). The marginal probability function of Y. xPXY(x, y) = PY(y). The double sum yxPXY(x, y) = 1 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-64 Conditional Distributions Y X Rainy Not Rainy Totals HSI falls 0.15 0.4 0.55 HSI rises 0.2 0.25 0.45 0.35 0.65 1.0 Totals The conditional probability function of X given Y: PX|Y=y(x ) = P(X = x | Y = y) = PXY(x,y)/PY(y) if P(Y = y) > 0 PX|Y=y(x ) =0 if P(Y = y) = 0 Note that PX|Y=y(x ) when P(Y = y) = 0 is undefined using the top formula. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-65 Conditional Distributions Y X Rainy Not Rainy Totals HSI falls 0.15 0.4 0.55 HSI rises 0.2 0.25 0.45 0.35 0.65 1.0 Totals For each fixed y this is a probability function for X, i.e. the conditional probability function is non-negative and XPX|Y=y(x ) = PX|Y=y(x1 ) + PX|Y=y(x2 ) = PX,Y(x1, y)/ PY(y) + PX,Y(x2, y)/ PY(y) =[PX,Y(x1, y) + PX,Y(x2, y)]/ PY(y) =1. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-66 Conditional Distributions Y X Rainy Not Rainy Totals HSI falls 0.15 0.4 0.55 HSI rises 0.2 0.25 0.45 0.35 0.65 1.0 Totals By the definition of conditional probability, PX|Y=y(x ) = PX,Y(x, y)/ PY(y). E.g., P(HSI rises| Rainy) = 0.2/0.35. When X and Y are independent, PX|Y=y(x ) is equal to PX(x). Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-67 Example: Conditional Distributions Y X HSI falls HSI rises Totals Rainy Not Rainy Totals 0.15 0.4 0.55 0.15/0.35 0.4/0.65 0.2 0.25 0.45 0.2/0.35 0.25/0.65 0.35 0.65 1.0 1.0 1.0 0.4/0.55 1.0 0.25/0.45 1.0 P(Y|HSI falls) 0.15/0.55 P(Y|HSI rises) PX|Y=y(x ) = PX,Y(x, y)/ PY(y). 0.2/0.45 P(X|Rainy) P(X| Not Rainy) PY|X=x(y ) = PX,Y(x, y)/ PX(x). Are X and Y statistically independent? Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-68 Conditional Mean of Bivariate Discrete Probability Distribution For bivariate probability distribution, the conditional expectation or conditional mean E(X|Y) is computed by the formula: E( X | Y yi ) Σ X xPX |Y yi ( x) x1PX |Y yi ( x1 ) x2 PX |Y yi ( x2 )... xn PX |Y yi ( xn ) Unconditional expectation or mean of X, E(X) E(X) ΣY E ( X|Y yi ) PY ( yi ) E[ E ( X|Y )] E[ m X|Y ] Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-69 Law of iterated expectations For a bivariate random variables, X and Y: E(Y) = E[E(Y|X)] For a trivariate random variables, X, Y and Z E(Y|X,Z) = conditional mean given X and Z. E(Y|Z) = E[E(Y|X,Z)|Z] E(Y|X) = E[E(Y|X,Z)|X] E(Y) = E{E[E(Y|X,Z)|Z]} (note: taking expectations in several iterations.) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-70 Law of iterated expectations Given E(e|X) = 0, find E(eX). E(eX) = E[E(eX|X)] =E[E(e|X)X] =E[0*X] =0 Given E(Y|X,Z) = 0, E(XY) = 2, E(Z) =4, find E(XYZ). E(XYZ) = E[E(YXZ|X,Z)] = E[E(Y|X,Z) X Z] = E[ 0* X Z] = 0. Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-71 The Variance of discrete random variables For univariate discrete probability distribution Var ( X ) E[(X μ)2 ] Σ[(x μ)2 P(x)] (x 1 μ)2 P(x1 ) (x 2 μ)2 P(x 2 ) ... (x n μ)2 P(x n ) For bivariate discrete probability distribution Var(X) E[(X μX )2 ] Σ Y Σ X [(x - μX )2 PX, Y (x, y)] (x 1 - μX )2 PX, Y (x 1 , y1 ) ( x 2 - μX )2 PX, Y (x 2 , y1 ) ... ( x n - μX )2 PX, Y (x n , y1 ) ... (x 1 - μX )2 PX, Y (x 1 , y n ) ( x 2 - μX )2 PX, Y (x 2 , y n ) ... ( x n - μX )2 PX, Y (x n , y n ) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-72 The Covariance of a Bivariate Discrete Probability Distribution Covariance measures how two random variables co-vary. Cov(X, Y) E[(X μX )(Y μY )] Σ Y Σ X [(x - μX )(Y μY )PX, Y (x, y)] Cov(X, Y) E[(X μX )(Y μ Y )] E[XY μX Y μ Y X μX μ Y ] E[XY] μXE[Y] μ YE[X] μX μ Y E[XY] μX μ Y μ Y μX μX μ Y E[XY] μX μ Y E[XY] E[X]E[Y] Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-73 Covariance of linear transformed random variables If a and b are constants and X is a random variable, then Cov(a,b) = 0 Cov(a,bX) = 0 Cov(a+bX,Y) = bCov(X,Y) Cov(a bX, Y ) E[ a bX (a bμX ) ](Y μY ) E[ bX bμX ](Y μY ) E[ b(X μX ) ](Y μY ) b E(X μ)(Y μY ) bCov(X, Y) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-74 Variance of a sum of random variables If a and b are constants and X and Y are random variables, then Var(X+Y) = Var(X) + Var(Y) + 2Cov(X,Y) Var(aX+bY) =a2Var(X) + b2Var(Y) + 2abCov(X,Y) Var(X Y) E[ X Y (μX μY ) ]2 E[ (X μX ) (Y μ Y )]2 E[ (X μX )2 (Y μY )2 2(X μX )(Y μY )] E[ (X μX )2 ] E[(Y μ Y )2 2E[(X μX )(Y μY )] Var(X) Var(Y) 2Cov(X, Y) Var(aX bY) E[ aX bY (aμX bμ Y ) ]2 E[ (aX aμX ) (bY bμ Y )]2 E[ a2 (X μX )2 b 2 (Y μ Y )2 2(aX aμX )(bY bμ Y )] a2E[ (X μX )2 ] b 2E[(Y μ Y )2 2abE[(X μX )(Y μ Y )] a2 Var(X) b 2 Var(Y) 2abCov(X, Y) Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-75 Correlation coefficient The strength of the dependence between X and Y is measured by the correlation coefficient: Cov(X, Y) Corr(X, Y) Var(X)Var(Y) ρ=0 ρ>0 when X ρ = +1 ρ<0 when X ρ = -1 Ka-fu Wong © 2007 no linear relationship between X and Y positive linear relationship between X and Y is high (low) then Y is likely to be high (low) perfect positive linear dependency negative linear relationship between X and Y is high (low) then Y is likely to be low (high) perfect negative linear dependency ECON1003: Analysis of Economic Data Lesson4-76 Portfolio Analysis Let random variable X be the price for stock A Let random variable Y be the price for stock B Suppose a portfolio consists of a shares of stock A, and b shares of stock B. The market value, W, for the portfolio is given by the linear function W = aX + bY Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-77 Portfolio Analysis The mean value for W is E(W) = E(aX + bY) = aE(X)+bE(Y) The variance for W is Var(W)= a2 Var(X) + b2 Var(Y) + 2abCov(X,Y) Var(W)= a2 Var(X) + b2 Var(Y) + 2abCorr(X,Y)[Var(X)Var(Y)]1/2 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-78 Example: Investment Returns Return per $1,000 for two types of investments P(xiyi) Economic condition Investment Passive Fund X Aggressive Fund Y .2 Recession - $ 25 - $200 .5 Stable Economy + 50 + 60 .3 Expanding Economy + 100 + 350 E(x) = μx = (-25)(.2) +(50)(.5) + (100)(.3) = 50 E(y) = μy = (-200)(.2) +(60)(.5) + (350)(.3) = 95 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-79 Computing the Standard Deviation for Investment Returns P(xiyi) Economic condition Investment Passive Fund X Aggressive Fund Y 0.2 Recession - $ 25 - $200 0.5 Stable Economy + 50 + 60 0.3 Expanding Economy + 100 + 350 σ X (-25 50)2 (0.2) (50 50)2 (0.5) (100 50)2 (0.3) 43.30 σ y (-200 95)2 (0.2) (60 95)2 (0.5) (350 95)2 (0.3) 193.71 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-80 Covariance for Investment Returns P(xiyi) Economic condition Investment Passive Fund X Aggressive Fund Y .2 Recession - $ 25 - $200 .5 Stable Economy + 50 + 60 .3 Expanding Economy + 100 + 350 Cov(X, Y) (-25 50)(-200 95)(.2) (50 50)(60 95)(.5) (100 50)(350 95)(.3) 8250 Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-81 Interpreting the Results for Investment Returns The aggressive fund has a higher expected return, but much more risk μy = 95 > μx = 50 but σy = 193.21 > σx = 43.30 The Covariance of 8250 indicates that the two investments are positively related and will vary in the same direction Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-82 Portfolio Example Investment X: Investment Y: μx = 50 μy = 95 σx = 43.30 σy = 193.21 σxy = 8250 Suppose 40% of the portfolio (P) is in Investment X and 60% is in Investment Y: E(P) .4 (50) (.6) (95) 77 σ P (.4) 2 (43.30) 2 (.6)2 (193.21) 2 2(.4)(.6)( 8250) 133.04 The portfolio return and portfolio variability are between the values for investments X and Y considered individually Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-83 Lesson 4: Discrete Probability Distributions - END - Ka-fu Wong © 2007 ECON1003: Analysis of Economic Data Lesson4-84