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
STAB22 Statistics I Lecture 17 1 Random Variables Random Variable (RV) takes single value for every outcome of an experiment X H ,H 2 X H ,T 1 Eg. X = # of heads in 2 fair coin flips XT ,H 1 XT ,T 0 Probability Model describes all possible values & related probabilities of RV Centre of RV (Expected Value or Mean) E X xP x x P(x) 0 ¼ 1 ½ 2 ¼ Sum 1 all x Spread of RV (Variance & Std. Deviation) 2 2 Var ( X ) x P x & SD ( ) Var ( X ) all x 2 Example In roulette, $1 bet on “even” wins $1 if ball falls on even number; odds of winning are 47.37% Random Variable X = win/loss of $1 bet What are the possible values of X? What is the distribution of X? What is the expected value of X? 3 Linear Transformations Often need to change values of RV E.g. Let X = # of Heads in X 2 X 1 X 1 X 0 2 fair coin flips Gamble offers $4 for every Head, but have to pay $5 to play. Let Y = # net gamble gain If X=0, Y=−5+4∙0=−5 If X=1, Y=−5+4∙1=−1 If X=2, Y=−5+4∙2=+3 → Generally: Y = −5 + 4∙X H ,H H ,T T ,H T ,T X value Y value Prob 0 −5 ¼ 1 −1 ½ 2 +3 ¼ Sum (change only RV values, not probs) 1 4 Centre & Spread of Linear Transformations Don’t need to calculate centre & spread of linear transformation RV from scratch If Y = a∙X + b (for any a, b), then E Y E a X b a E X b Var Y Var a X b a 2 Var X SD Y | a | SD X E.g. For previous gamble E(X)=1 → → E(Y) = E(4∙X − 5) = 4∙E(X) − 5 = 4 − 5 = −1 5 Example Tomorrow’s temperature in °C is RV X with E(X) = 5, SD(X) = 2. Find mean & st.dev. of tomorrow’s temperature in °F Note: [°F] = [°C] · 9/5 + 32 6 Combining Random Variables Often, we need to combine RV’s E.g. Let X = # Heads in two coin flips, and Y = # Heads in another coin flip Define Z = X + Y (# Heads in all 3 flips) Find probability model of Z by considering all possible combinations of X + Y x P(x) 0 ¼ 1 ½ 2 ¼ z & y P(y) 0 ½ 1 ½ P(z) 7 Centre & Spread of Combination of RV’s Again, don’t need to calculate centre & spread of combination of RV’s from scratch For any two RV’s X, Y E X Y E X E Y For two independent RV’s X, Y Var X Y Var X Var Y SD X Y Var X Var Y Note: RV’s are independent if value of one does not affect probabilities of the other 8 Combinations of Normal RV’s For Normal & independent RV’s in particular, means & st. dev.’s are all we need to know to calculate probabilities of combinations If X1 is Normal(µ1,σ1), X2 is Normal(µ2,σ2), and they are independent, then X 1 X 2 is Normal 1 2 , 12 22 Use this result to calculate probabilities of combination using Normal distribution 9 Example John & Mary will run a 5K race; their times are indep. Normal w/ means of 30 & 35min, and st. dev.’s of 3 & 4min, respectively Find prob. that their total time is <60min Find prob. that Mary is faster 10 Bernoulli Trial Bernoulli Trial: trial with only 2 outcomes E.g. True/False, Yes/No, Heads/Tails P(Success) = p, P(failure) = 1−p Value 1 0 Prob p 1‒p E.g. Fair coin flip, let Success = Heads Usually labeled Success (1) and Failure (0) P(1) = ½, & P(0) = 1− ½ = ½ Bernoulli trials form basis of many common probability models 11 Binomial Model Several Bernoulli trials, but only interested in total number of successes Example: # students who vote Yes for a proposal Binomial Setting: 1. Fixed number (n ) of Bernoulli trials 2. Same probability of success (p ) for each trial 3. Bernoulli trials are independent Binomial Random Variable: X = # of successes in a Binomial setting 12 Binomial Distribution If X follows Binomial distribution with n trials and probability of success p X takes values from 0 to n (i.e. 0,1,…,n) Probabilities given by formula P ( X x) n Cx p x (1 p ) n x , for x 0,1,..., n n! where: n Cx , n ! n (n 1) 2 1 x ! n x ! Or, simply use software (StatCrunch: Stat > Calculators > Binomial) 13 Example Multiple choice test has 10 questions, each with 4 choices: A,B,C or D. Student has not studied at all, but thinks he will give it a shot (i.e. answer at random). What is the probability model of his score? Does it fit the Binomial? Number of trials? Are they independent? Probability of success? Is the score a binomial RV? 14 Binomial Example Find probability student’s test score is 5/10 Find probability student passes (score ≥5/10) 15