HUDM4122 Probability and Statistical Inference...Probability and Statistical Inference February 23,...

54
HUDM4122 Probability and Statistical Inference February 23, 2015

Transcript of HUDM4122 Probability and Statistical Inference...Probability and Statistical Inference February 23,...

  • HUDM4122Probability and Statistical Inference

    February 23, 2015

  • In the last class

    • We studied Bayes’ Theorem and the Law ofTotal Probability

  • Any questions or comments?

  • Today

    • Chapter 4.8 in Mendenhall, Beaver, & Beaver

    • Probability Distributions• Random Variables

  • Random Variable

    • “A variable x is a random variable if the valuethat it assumes, corresponding to theoutcome of an experiment, is a chance orrandom event.” – MBB, p.158

    • “A random variable is a variable whose valueis subject to variations due to chance.” --Wikipedia

  • Random Variable

    • It is not that the variable can have any value atrandom

    • But that the variable’s value comes fromrandom sampling

  • These are random variables

    • A coin flip’s result• Number of times a randomly selected student

    is sent to the principal’s office• NY Regents Exam score for a randomly

    selected student in NY State• Number of people on the subway at a

    randomly selected time

  • These are not random variables

    • I flip a biased coin that gives 100% heads• The temperature setting on your oven – you

    set it yourself

    • These values are not subject to chance

  • A random variable’s value

    • You can never say for sure what it’s going tobe

    • There is a certainly probability that it will havecertain values

  • Questions? Comments?

  • Reminder

    • Discrete variable– Can have limited number of values

    • Continuous/numerical variable– Can have infinite number of values

  • Which of these are Discrete Variables?

    • Number of heads in 3 coin flips• Sum of rolling two 6-sided dice• Temperature outside• How late is 2 train• Height of a person, rounded to closest inch• Number of times a randomly selected student

    is sent to the principal’s office

  • Probability Distribution

    • A probability distribution for random variableX– gives the possible values of X, x1…xn– And the probability p(xi) associated with each

    value of X

  • Probability Distribution

    • A probability distribution for random variableX– gives the possible values of X, x1…xn– And the probability p(xi) associated with each

    value of X

    – Each value of X is mutually exclusive– The sum of p(xi) adds to 1

  • Example

    • I flip a coin twice• The number of heads can be 0, 1, or 2

    • TT: 0• TH:1• HT:1• HH:2

  • Example

    • I flip a coin twice• The number of heads can be 0, 1, or 2

    • TT: 0• TH:1• HT:1• HH:2

    x P(x)012

  • Example

    • I flip a coin twice• The number of heads can be 0, 1, or 2

    • TT: 0• TH:1• HT:1• HH:2

    x P(x)0 1/41 2/42 1/4

  • Example

    • I flip a coin twice• The number of heads can be 0, 1, or 2

    • TT: 0• TH:1• HT:1• HH:2

    x P(x)0 1/41 1/22 1/4

  • Example

    • I flip a coin twice• The number of heads can be 0, 1, or 2

    • TT: 0• TH:1• HT:1• HH:2

    x P(x)0 0.251 0.52 0.25

  • Probability Histogram

    x P(x)0 0.251 0.52 0.25

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0 1 2

    p(x)

    x

  • You try it

    • I flip a coin three times• What is the probability distribution on the

    number of heads?

  • You try it:What is the Probability Distribution?

    • I collected the following data on thetemperature in NYCDay Temp Day Temp

    1 Cold 9 Cold2 Cold 10 Cold3 Freezing 11 Cold4 Cold 12 Not That Bad5 Cold 13 Cold6 Freezing 14 F’ing Freezing7 F’ing Freezing 15 F’ing Freezing8 Freezing 16 Cold

  • Note that probability distributions canhave many values

    00.10.20.30.40.50.60.70.80.9

    1

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

    p(x)

    x

  • Later in the semester

    • We’ll talk about probability distributions forcontinuous variables

  • Questions? Comments?

  • Expected Value ofProbability Distribution

    • The value you can expect to get on average ifyou re-run your experiment many times

    • Take each value, multiply it by its probability• Add those together

    • E(x) = ∑ ∗ ( )

  • Expected Value ofProbability Distribution

    • The value you can expect to get on average if youre-run your experiment many times

    • Take each value, multiply it by its probability• Add those together

    • E(x) = ∑ ∗ ( )• This is also called the mean of the random

    variable, µ

  • Example

    • 0(0.25) + 1(0.5) + 2(0.25)

    x P(x)0 0.251 0.52 0.25

  • Example

    • 0 + 0.5 + 0.5 = 1

    x P(x)0 0.251 0.52 0.25

  • You can expect 1 head on average ifyou flip a coin twice, infinite times

    • 0 + 0.5 + 0.5 = 1

    x P(x)0 0.251 0.52 0.25

  • You Try Itx P(x)0 0.11 0.52 0.23 0.2

  • You Try It

    • 0(0.1)+1(0.5)+2(0.2)+3(0.2)

    x P(x)0 0.11 0.52 0.23 0.2

  • You Try It

    • 0+0.5+0.4+0.6= 1.5

    x P(x)0 0.11 0.52 0.23 0.2

  • You Try It

    • My dad’s barber has played the lottery everyday for 40 years (a.k.a. 14,600 times), at $1 aticket

    • One time he won $1000• What is the expected value for playing the

    lottery?

  • You Try It

    • My dad’s barber has played the lottery everyday for 40 years (a.k.a. 14,600 times), at $1 aticket

    • One time he won $1000• What is the expected value for playing the

    lottery?

    • (1/14600)(1000) + (14599/14600)(-1)

  • You Try It

    • My dad’s barber has played the lottery everyday for 40 years (a.k.a. 14,600 times), at $1 aticket

    • One time he won $1000• What is the expected value for playing the

    lottery?

    • (1/14600)(1000) + (14599/14600)(-1)=0.068 – 0. 999 = $-0.931

  • Questions? Comments?

  • Variance of Discrete Random Variable

    •∑ − ( )

  • Standard Deviation ofDiscrete Random Variable

    • ∑ − ( )

  • Example: SD of Random Variable

    x P(x)0 0.251 0.52 0.25

  • Example: SD of Random Variable

    x P(x)0 0.251 0.52 0.25

    • Recall: µ = 1

  • Example: SD of Random Variablex P(x)0 0.251 0.52 0.25

    • Recall: µ = 1 − ( )

  • Example: SD of Random Variablex P(x)0 0.251 0.52 0.25

    • Recall: µ = 1

    • 0 − 1 (0.25) + 1 − 1 .5+ 2 − 1 .25

  • Example: SD of Random Variablex P(x)0 0.251 0.52 0.25

    • Recall: µ = 1

    • 1(0.25) + 0 .5+1 .25

  • Example: SD of Random Variablex P(x)0 0.251 0.52 0.25

    • Recall: µ = 1• 0.25 + 0.25

  • Example: SD of Random Variablex P(x)0 0.251 0.52 0.25

    • Recall: µ = 1• 0.25 + 0.25• 0.707

  • You Try It: SD of random variable

    • µ = 1.5

    x P(x)0 0.11 0.52 0.23 0.2

  • Any last comments or questions forthe day?

  • If there’s time:Do this in solver-explainer pairs

    • Practice with extended version of Bayes Rule

    • ( | ) = )∑ ( | )

  • Example

    • There are three professors who teachHUDM4122. Let’s call them A, B, and C

    • P(student is in prof A’s class) = P(A) = 0.4• P(student is in prof B’s class) = P(B) = 0.3• P(student is in prof C’s class) = P(C) = 0.1

  • Example

    • P(student is in prof A’s class) = P(A) = 0.4• P(student is in prof B’s class) = P(B) = 0.3• P(student is in prof C’s class) = P(C) = 0.1

    • P(learned stats|A)=0.8• P(learned stats|B)=0.6• P(learned stats|C)=0.4

  • What is P(A | learned stats)?

    • P(student is in prof A’s class) = P(A) = 0.4• P(student is in prof B’s class) = P(B) = 0.3• P(student is in prof C’s class) = P(C) = 0.1

    • P(learned stats|A)=0.8• P(learned stats|B)=0.6• P(learned stats|C)=0.4

  • Upcoming Classes

    • 2/25 Binomial Probability Distribution– Ch. 5-2– HW 4 due

    • 2/28 Normal Probability Distribution

  • Homework 4

    • Due in 2 days• In the ASSISTments system