Special Lecture: Random Variables http://www.psych.uiuc.edu/~jrfinley/p235/ DON’T FORGET TO SIGN IN FOR CREDIT! Announcements • Assessment Next Week Same procedure as last time. AL1: Monday, Rm 289 between 9-5 BL1: Wednesday, Rm 289 between 9-5 Can schedule a specific time by contacting TA Remember: Bring photo ID • Get as far through the material in ALEKS as you can before the test. You should aim to be at least halfway through the Inference slice. Random Variables • Random Variable: variable that takes on a particular numerical value based on outcome of a random experiment • Random Experiment (aka Random Phenomenon): trial that will result in one of several possible outcomes can’t predict outcome of any specific trial can predict pattern in the LONG RUN that is, each possible outcome has a certain PROBABILITY of occurring Random Variables • Examples: # of heads in 3 coin tosses a student’s score on the ACT points scored by Illini basketball team in first game of the season mean snowfall in February in Urbana height of the next person to walk in the door Random Variable Example & Notation • X= how many years a UIUC psych grad student takes to complete PhD this is our random variable • xi=some particular value that X can take on i=1 --> x1=smallest possible value of X i=k --> xk=largest possible value of X • so for example: x1=4 years x2=5 years x3=6 years ... xk=x7=10 years Discrete vs. Continuous Random Variables • Discrete Finite number of possible outcomes ex: ACT score • Continuous Infinitely many possible outcomes ex: temperature in Los Angeles tomorrow • ALEKS problems: only calculating expected value and variance for DISCRETE random variables Probability Distributions • Probability Distribution: the possible values of a Random Variable, along with the probabilities that each outcome will occur Discrete: Probability • Graphic Depictions: Values of X Probability Continuous: Values of X Probability Distributions • Probability Distribution: the possible values of a Random Variable, along with the probabilities that each outcome will occur • Graphic Depictions: Probability Discrete: Values of X • Table: Discrete: Value of X: Probability: X1 p1 X2 p2 ... ... Xk pk Expected Value (aka Expectation) of a Discrete Random Variable • Expected Value: central tendency of the probability distribution of a random variable k E(X) x i pi i1 Expected Value (aka Expectation) of a Discrete Random Variable • Expected Value: k E(X) x i pi i1 Value of X: Probability: X1 p1 X2 p2 ... ... Xk pk E(X) = x1p1 + x2p2 + ... + xkpk Note: the Expected Value is not necessarily a possible outcome... Expected Value example • Say you’re given a massive set of data: well-being scores for all senior citizens in Champaign County possible scores: 0-3 • Random Variable: X=Well-being score of a Champaign County senior P (Probability) Expected Value example 0.45 0.40 0.35 0.30 0.25 0.20 0.15 0.10 0.05 0.00 0.40 0.30 0.20 0.10 0 1 2 3 X (Well-being score) Value of X: Probability: X1 p1 X2 p2 X3 ... ... p3 X4k p4k Well-being score: Probability: 0 0.10 1 0.20 2 0.40 3 0.30 E(X) = x1p1 + x2p2 + x3p3 + x4p4 E(X) = (0)(.1) + (1)(.2) + (2)(.4) + (3)(.3) =1.9 Variance of a Discrete Random Variable • Variance (of Random Variable): measure of the spread (aka dispersion) of the probability distribution of a random variable k Var(X) (x i E(X)) pi 2 i1 Expected Value & Variance: ALEKS Example Rando m varia bles (9 new topic areas, to be completed by February 27) One random variable (7 topic areas) Classification of variables and levels of measurement Discrete versus continuous variables Discrete probability distribution: Basic Discrete probability distribution: Word problems Cumu lative distribution function Exp ectation and variance of a random variable Rules for expectation and variance of random variables Two random va riables (2 topic areas) Marginal distributions of two discrete random variables Joint distributions of dependent or independent random variables Expected Value & Variance: ALEKS Example QuickTime™ and a decompressor are needed to see this picture. Expected Value & Variance: ALEKS Example P (Probability) 0.40 0.35 0.35 0.30 0.25 0.25 0.25 0.20 0.15 0.10 0.15 0.05 0.00 E(X) 3 4 5 6 Value of X Xi 3 4 5 6 pi 0.35 0.25 0.15 0.25 xipi 1.05 1 0.75 1.5 E(X)= 4.3 k E(X) x i pi i1 Expected Value & Variance: ALEKS Example P (Probability) 0.40 0.35 0.35 0.30 0.25 0.25 0.25 0.20 0.15 0.10 0.15 0.05 0.00 E(X) 3 4 5 Value of X 6 k Var(X) (x i E(X)) 2 pi i1 X Xii 33 44 55 66 ppii 0.35 0.35 0.25 0.25 0.15 0.15 0.25 0.25 xxiippii X Xii-E(X) -E(X) (X (Xii-E(X)) -E(X))22 1.05 -1.3 1.05 -1.3 2 1.69 11 -0.3 -0.3 0.09 0.75 0.7 0.75 0.7 0.49 1.5 1.5 = 1.7 1.7 2.89 E(X)= 4.3 Expected Value & Variance: ALEKS Example P (Probability) 0.40 0.35 0.35 0.30 0.25 0.25 0.25 0.20 0.15 0.10 0.15 0.05 0.00 E(X) 3 4 5 Value of X 6 k Var(X) (x i E(X)) 2 pi i1 Xi 3 4 5 6 pi 0.35 0.25 0.15 0.25 xipi Xi-E(X) (Xi-E(X))2 (Xi-E(X))2pi 1.05 * -1.3 1.69 = 0.592 1 -0.3 0.09 0.023 0.75 0.7 0.49 0.074 1.5 1.7 2.89 0.723 E(X)= 4.3 Var(X)= 1.41 Properties of Expectation & Variance of a Random Var. Expected Value of a Constant • E(a) = a Value of X: X1 Probability: p1 Value of a: Probability: a 1.00 a*1=a Value of 5: Probability: 5 1.00 5*1=5 Adding a constant • E(X+a) = E(X) + a • Var(X±a) = Var(X) • How is this relevant to anything? TRANSFORMING data. • Ex: say you had data on the initial weights of all patients in a clinical trial for a new drug to treat depression... Adding a Constant P (Probability) 0.35 0.30 0.30 0.25 0.25 0.20 0.20 0.15 0.10 0.15 0.10 0.05 0.00 100 120 140 160 180 200 Value of X (weight in pounds) Value of X (Weight in pounds): Probability: 100 0.10 120 0.15 140 0.30 160 0.25 180 0.20 E(X)=146 lb. But wait!! The scale was off by 20 lb! Have to add 20 to all values... Adding a Constant P (Probability) 0.35 0.30 0.30 0.25 0.25 0.20 0.20 0.15 0.10 0.15 0.10 0.05 0.00 100 120 140 160 180 200 Value of X (weight in pounds) Value of X (Weight in pounds): Probability: 100 0.10 120 0.15 140 0.30 160 0.25 180 0.20 160 0.30 180 0.25 200 0.20 E(X)=146 lb. Value of X (Weight in pounds): Probability: 120 0.10 E(X)= 166 lb. =146+20 140 0.15 E(X+a) = E(X) + a Adding a Constant P (Probability) (Probability) P 0.35 0.35 0.30 0.30 0.30 0.30 0.25 0.25 0.25 0.25 0.10 0.10 0.25 0.20 0.20 0.20 0.20 0.15 0.15 0.30 0.15 0.15 0.10 0.10 0.20 0.15 0.10 0.05 0.05 0.00 0.00 100 100 120 120 140 140 160 160 180 180 200 200 Value (weightinin pounds) Value of of X (weght pounds) Note: the whole distribution shifts to the right, but it doesn’t Value of X change(Weight shape!in The variance (spread) 120 stays the140same. 160 pounds): 100 180 Probability: 0.10 0.15 0.30 0.25 0.20 180 0.25 200 0.20 Var(X±a) = Var(X) E(X)=146 lb. Value of X (Weight in pounds): Probability: 120 0.10 E(X)= 166 lb. =146+20 140 0.15 160 0.30 E(X+a) = E(X) + a Multiplying by a Constant • E(aX) = a*E(X) • Var(aX) = a2*Var(X) • How is this relevant to anything? TRANSFORMING data. • Ex: say you had data on peoples’ heights... Multiplying by a Constant P (Probability) 0.35 0.30 0.30 0.25 0.25 0.25 0.20 0.15 0.10 0.10 0.10 0.05 0.00 1.5 1.6 1.7 1.8 1.9 Value of X (height in meters) Value of X (height in meters) Probability: 1.5 0.10 1.6 0.25 1.7 0.30 1.8 0.25 1.9 0.10 E(X)=1.7 meters But wait!! We want height in feet! To convert, have to multiply all values by 3.28... Multiplying by a Constant P (Probability) 0.35 0.30 0.30 0.25 0.25 0.25 0.20 0.15 0.10 0.10 0.10 0.05 0.00 1.5 1.6 1.7 1.8 1.9 Value of X (height in meters) Value of X (height in meters) Probability: 1.5 0.10 1.6 0.25 1.7 0.30 1.8 0.25 1.9 0.10 5.58 0.30 5.90 0.25 6.23 0.10 E(X)=1.7 meters Value of X (height in feet): Probability: 4.92 0.10 E(X)= 5.58 ft =3.28*1.7 5.25 0.25 E(aX) = a*E(X) Multiplying by a Constant P (Probability) 0.35 0.30 0.30 0.25 0.25 0.25 0.20 0.15 0.10 [Draw new distribution on chalkboard.]0.10 0.10 0.05 Note: 0.00 the whole distribution shifts to the right, AND it gets 1.5 1.6 1.7 1.8 1.9 more spread out! The variance has increased! Value of X (height in meters) Value of X (height in meters) Probability: 2*Var(X) Var(aX) = a 1.5 1.6 1.7 0.10 0.25 0.30 1.8 0.25 1.9 0.10 5.58 0.30 5.90 0.25 6.23 0.10 E(X)=1.7 meters Value of X (height in feet): Probability: 4.92 0.10 E(X)= 5.58 ft =3.28*1.7 5.25 0.25 E(aX) = a*E(X) Usefulness of Properties • Don’t have to transform each possible value of a random variable • Can just recalculate the expected value and variance. Two Random Variables • E(X+Y)=E(X)+E(Y) • and if X & Y are independent: E(X*Y)=E(X)*E(Y) Var(X+Y)=Var(X)+Var(Y) • How is this relevant? Difference scores (pretest-posttest) Combining Measures All properties Expected Value • E(a)=a • E(aX)=a*E(X) • E(X+a)=E(X)+a • E(X+Y)=E(X)+E(Y) • If X & Y ind. Variance • Var(X±a) = Var(X) • Var(aX)=a2*Var(X) • Var(X2)=Var(X)+E(X)2 • If X & Y ind. Var(X+Y)=Var(X)+Var(Y) E(XY)=E(X)*E(Y) Var(X) = E(X2) - (E(X))2 E(X2) = Var(X) + (E(X))2 Expected Value & Variance: ALEKS Example Rando m varia bles (9 new topic areas, to be completed by February 27) One random variable (7 topic areas) Classification of variables and levels of measurement Discrete versus continuous variables Discrete probability distribution: Basic Discrete probability distribution: Word problems Cumu lative distribution function Exp ectation and variance of a random variable Rules for expectation and variance of random variables Two random va riables (2 topic areas) Marginal distributions of two discrete random variables Joint distributions of dependent or independent random variables ALEKS problem E(X+a) E(aX) E(X+Y) QuickTime™ and a decompressor are needed to see this picture. algebra! Var(aX) Var(X±a) Var(X) = E(X2) - (E(X))2 E(X2) = Var(X) + (E(X))2 QuickTime™ and a decompressor are needed to see this picture. QuickTime™ and a decompressor are needed to see this picture. QuickTime™ and a decompressor are needed to see this picture.