stats exam prep. dr. lin lin. warning the goal of this workshop is to go over some basic concepts in...

40
Stats Exam Prep. Dr. Lin Lin

Upload: stewart-ellis

Post on 03-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Stats Exam Prep.

Dr. Lin Lin

Page 2: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

WARNING

• The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS 665

• It is NOT to help you pass the exam

• NO EXAM QUESTIONS will be covered here

Page 3: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Probability

• Probability is the measure of how likely something will occur.

• It is the ratio of desired outcomes to total outcomes. – P(event) = (# desired events) / (# total events)

• Probabilities of all outcomes sums to 1.

Page 4: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

BEFORE Probability

• We need to learn to count the number of possible events

• Exercise I: How many different five-digit numbers exist?

• How did you get the answer?

Page 5: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

BEFORE Probability

• Exercise II: How many different five-digit numbers WITHOUT 0 exist?

• How did you get the answer?

Page 6: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

BEFORE Probability

• Exercise III: US phone number is in the format of (###) – ### - ####

– The first digit cannot be zero– There cannot be a “000-0000” number– How many numbers are possible?

• How did you get the answer?

Page 7: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

BEFORE Probability

• Exercise IV: let’s make a three-digit number. There is only one rule: no two digits could be identical. How many numbers could we make?

• How did you get the answer?

Page 8: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

BEFORE Probability

• Exercise V:

• You could rearrange these shapes anyway you want. However, cannot be on either side. How many different ways could we have?

• How did you get the answer?

Page 9: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Probability Example

• If I roll a number cube, there are six total possibilities. (1,2,3,4,5,6)

• Each possibility only has one outcome, so each has a PROBABILITY of 1/6.

• For instance, the probability I roll a 2 is 1/6, since there is only a single 2 on the number cube.

Page 10: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Practice

• If I flip a coin, what is the probability I get heads?

• What is the probability I get tails?

• Remember the equation? Number of desired outcomes divided by number of possible outcomes

Page 11: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Answer

• P(heads) = 1/2• P(tails) = 1/2

• If you add these two up, you will get 1, which means the answers are probably right.

Page 12: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Answer

• Let’s make it harder – assuming that the coin is not fair, and P(H) = 0.6

• What is the chance of getting a tail in one flip?

Page 13: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Bernoulli Trial

• In the theory of probability and statistics, a Bernoulli trial (or binomial trial) is a random experiment with exactly two possible outcomes, "success" and "failure", in which the probability of success is the same every time the experiment is conducted.

• So it is basically coin-flipping with a p of not necessarily 0.5

Page 14: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Two or more independent events

• If there are two or more independent events, you need to consider if it is happening at the same time (and) or one after the other (or).

Page 15: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

And

• If the two events are happening at the same time, you need to multiply the two probabilities together. This probability is called joint probability

• Usually, the questions use the word “and” when describing the outcomes.

• P(A & B) = P(A)*P(B)

Page 16: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Joint Probability

Just a fancy way of saying “AND”◦ p(I will listen to Backstreet Boys Today) = 0.8◦ p(I will eat at Subway today) = 0.7

What is the probability that I will listen to Backstreet Boys AND eat at Subway?◦ 0.7 * 0.8 = 0.56?

WHEN EVENT A AND B ARE INDEPENDENT:◦ P(A&B) = P(A) * P(B)

Page 17: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Or

• If the two events are happening one after the other, you need to add the two probabilities.

• Usually, the questions use the word “or” when describing the outcomes.

• P(A or B) = P(A) + P(B)

Page 18: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Practice

• If I roll a number cube and flip a coin:

– What is the probability I will get a heads and a 6?– What is the probability I will get a tails or a 3?

• How did you get them?

Page 19: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Answers

• P(heads and 6) = 1/2 x 1/6 =1/12

• P(tails or a 5) = 1/2 + 1/6 = 8/12 = 2/3

Page 20: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Summary: Independent Events• One event has no influence on the outcome of

another event

• If events A & B are independentthen P(A&B) = P(A)*P(B)P(A or B) = P(A) + P(B)

• Coin flippingif P(H) = P(T) = .5 thenP(HTHTH) = P(HHHHH) = .5*.5*.5*.5*.5 = .55 = .03

Page 21: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Summary: Independent Events

• Coin flippingif P(H) = P(T) = .5 thenP(HTHTH) = P(HHHHH) = .5*.5*.5*.5*.5 = .55 = .03

• What if P(H) = 0.6 (Bernoulli trial)? – What is P(HTHH)?– What is P(at least one head in five trials)?

Page 22: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

• if you are flipping a coin and it has already come up heads 6 times in a row, what are the odds of an 7th head?

.5

• Is P(10H) = P(4H,6T)?

Page 23: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Next year the economy will experience one of three states: a downturn, stable state, or growth. The following probability matrix displays joint probabilities of a bond default and the economic state:

For example, the joint probability that the economy is stable and the bond defaults is 1.0%; the unconditional probability that the economy will be stable is 50.0% = 49.0% + 1.0%.

What is the chance of the bond default?

What is the chance of an economy downturn?

Page 24: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Next year the economy will experience one of three states: a downturn, stable state, or growth. The following probability matrix displays joint probabilities of a bond default and the economic state:

For example, the joint probability that the economy is stable and the bond defaults is 1.0%; the unconditional probability that the economy will be stable is 50.0% = 49.0% + 1.0%.

Knowing that the bond survived,

what is the chance that economy is stable?

Page 25: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Conditional Probability

• Concern the odds of one event occurring, given that another event has occurred

• P(A|B)=Prob. of A, given B

Page 26: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Examples

• P(Professor Lin walks in without a Pepsi in his hand) = 0.1

• HOWEVER…• P(Professor Lin walks in without a Pepsi in his hand | you

promise to give me $1,000,000 if I do so) = 1 !!

• What changed my behavior?

Page 27: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

• P(B|A) = P(A&B)/P(A)

• if A and B are independent, thenP(B|A) = P(A)*P(B)/P(A) = P(B)

Conditional Probability (cont.)

Page 28: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

The Chain Rule What if A and B ARE dependent of each other?

◦ p (I am teaching IS 665 today) = 1/7◦ p (I am eating at Subway today) = 0.7

What is the chance that I am teaching 665 today and eating at Subway?◦ p (I am teaching IS 665 today & I am eating at Subway today) = 0!

WHY?◦ Because to teach 665, I have NO TIME to eat at Subway!◦ In other words, these two events are dependent

Page 29: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

The Chain Rule What is the chance that I am teaching 665 today and eating

at Subway?◦ p (I am teaching IS 665 today & I am eating at Subway today) =

p (I am eating at Subway today | I am teaching 665) * p (I am teaching 665) = 0 * 1/7 = 0

To put it (semi) formally:◦ P(A & B) = P (A | B) * P (B) = P(B | A) * P(A)

Page 30: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

The Bayes Rule The Chain Rule Shows us:

◦ P(A & B) = P (A | B) * P (B) = P(B | A) * P(A)

P (A | B) = P(B | A) * P(A) / P(B) !!!

This is the Bayes Rule

Page 31: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

The Bayes Rule

P(B | A) = P(B) * P (A | B) / P (A)

BAPBPBAPBP

BAPBPABP

|~~|

||

Page 32: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Exercise

If we observe that the bond has defaulted, what is the (posterior) probability that the economy experienced a downturn?

a. 0.60%b. 19.40%c. 26.33%d. 31.58%

Page 33: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Exercise

If it is snowing, there is a 80% chance that class will be canceled. If it is not snowing, there is a 95% chance that class will go on. Generally, there is a 5% chance that it snows in NJ in the winter.

If we are having class today, what is the chance that it is snowing?

BAPBPBAPBP

BAPBPABP

|~~|

||

Page 34: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Distribution

• How to Read a Histogram

Page 35: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Normal Distribution

• Watch the demo

Page 36: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Regression• Predict the target value with the attributes by a function:

• Handle numeric attributes and predict numeric value.

Page 37: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

Regression

• Goal: minimize the error • An example

Variable Estimate Std. Error t value Pr(>|t|)

(Intercept) 5000 XXX XXX 0.020

edu_level 1000 XXX XXX 0.001

IQ 50 XXX XXX 0.814

experience 300 XXX XXX 0.004

gender -2000 XXX XXX 0.300

Page 38: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

What is Regression, anyway?

Number of nights I illegally parked Chance that I will get a ticket

0 3

1 21

2 36

3 44

4 66

5 81

y = 15.229x + 3.7619

InterceptCoefficient

If I parked illegally 6 nights in a row, how likely am I to get a ticket?

Page 40: Stats Exam Prep. Dr. Lin Lin. WARNING The goal of this workshop is to go over some basic concepts in probability and statistic theories required for IS

What is Regression, anyway?

• You now know how to interpret a regression model

• But how do we build one?– That will be covered in IS 665