week 4: testing/regression - princeton university...week 4: testing/regression brandon stewart1...

537
Week 4: Testing/Regression Brandon Stewart 1 Princeton October 1/3, 2018 1 These slides are heavily influenced by Matt Blackwell, Adam Glynn and Jens Hainmueller, Erin Hartman. Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 1 / 146

Upload: others

Post on 03-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Week 4: Testing/Regression

Brandon Stewart1

Princeton

October 1/3, 2018

1These slides are heavily influenced by Matt Blackwell, Adam Glynn and JensHainmueller, Erin Hartman.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 1 / 146

Page 2: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 3: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 4: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This Week

I Monday:F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 5: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testing

F what is regression?I Wednesday:

F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 6: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 7: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regression

F linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 8: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 9: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 10: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 2 / 146

Page 11: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 3 / 146

Page 12: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 3 / 146

Page 13: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 14: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 15: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 16: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 17: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 18: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 19: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,

Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 20: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons,

and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 21: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A Running Example for Testing

Statistics play an important role in determining which drugs are approvedfor sale by the FDA.

There are typically three phases of clinical trials before a drug is approved:

Phase I: Toxicity (Will it kill you?)

Phase II: Efficacy (Is there any evidence that it helps?)

Phase III: Effectiveness (Is it better than existing treatments?)

Phase I trials are conducted on a small number of healthy volunteers,Phase II trial are either randomized experiments or within-patientcomparisons, and Phase III trials are almost always randomizedexperiments with control groups.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 4 / 146

Page 22: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Consider a Phase II efficacy trial reported in Sowers et al. (2006), for adrug combination designed to treat high blood pressure in patients withmetabolic syndrome.

The trial included 345 patients with initial systolic blood pressurebetween 140-159.

Each subject was assigned to take the drug combination for 16 weeks.

Systolic blood pressure was measured on each subject before andafter the treatment period.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 5 / 146

Page 23: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Consider a Phase II efficacy trial reported in Sowers et al. (2006), for adrug combination designed to treat high blood pressure in patients withmetabolic syndrome.

The trial included 345 patients with initial systolic blood pressurebetween 140-159.

Each subject was assigned to take the drug combination for 16 weeks.

Systolic blood pressure was measured on each subject before andafter the treatment period.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 5 / 146

Page 24: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Consider a Phase II efficacy trial reported in Sowers et al. (2006), for adrug combination designed to treat high blood pressure in patients withmetabolic syndrome.

The trial included 345 patients with initial systolic blood pressurebetween 140-159.

Each subject was assigned to take the drug combination for 16 weeks.

Systolic blood pressure was measured on each subject before andafter the treatment period.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 5 / 146

Page 25: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Consider a Phase II efficacy trial reported in Sowers et al. (2006), for adrug combination designed to treat high blood pressure in patients withmetabolic syndrome.

The trial included 345 patients with initial systolic blood pressurebetween 140-159.

Each subject was assigned to take the drug combination for 16 weeks.

Systolic blood pressure was measured on each subject before andafter the treatment period.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 5 / 146

Page 26: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Consider a Phase II efficacy trial reported in Sowers et al. (2006), for adrug combination designed to treat high blood pressure in patients withmetabolic syndrome.

The trial included 345 patients with initial systolic blood pressurebetween 140-159.

Each subject was assigned to take the drug combination for 16 weeks.

Systolic blood pressure was measured on each subject before andafter the treatment period.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 5 / 146

Page 27: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Subject SBPbefore SBPafter Decrease

1

147 135 12

2

153 122 31

3

142 119 23

4

141 134 7

...

......

...

345

155 115 40

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 6 / 146

Page 28: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Subject SBPbefore SBPafter Decrease

1 147

135 12

2 153

122 31

3 142

119 23

4 141

134 7

......

......

345 155

115 40

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 6 / 146

Page 29: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Subject SBPbefore SBPafter Decrease

1 147 135

12

2 153 122

31

3 142 119

23

4 141 134

7

......

...

...

345 155 115

40

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 6 / 146

Page 30: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

Subject SBPbefore SBPafter Decrease

1 147 135 122 153 122 313 142 119 234 141 134 7...

......

...345 155 115 40

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 6 / 146

Page 31: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

The drug was administered to 345 patients.

On average, blood pressure was 21 points lower after treatment.

The standard deviation of changes in blood pressure was 14.3.

Question: Should the FDA allow the drug to proceed to the next stage oftesting?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 7 / 146

Page 32: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

The drug was administered to 345 patients.

On average, blood pressure was 21 points lower after treatment.

The standard deviation of changes in blood pressure was 14.3.

Question: Should the FDA allow the drug to proceed to the next stage oftesting?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 7 / 146

Page 33: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

The drug was administered to 345 patients.

On average, blood pressure was 21 points lower after treatment.

The standard deviation of changes in blood pressure was 14.3.

Question: Should the FDA allow the drug to proceed to the next stage oftesting?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 7 / 146

Page 34: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

The drug was administered to 345 patients.

On average, blood pressure was 21 points lower after treatment.

The standard deviation of changes in blood pressure was 14.3.

Question: Should the FDA allow the drug to proceed to the next stage oftesting?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 7 / 146

Page 35: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

The drug was administered to 345 patients.

On average, blood pressure was 21 points lower after treatment.

The standard deviation of changes in blood pressure was 14.3.

Question: Should the FDA allow the drug to proceed to the next stage oftesting?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 7 / 146

Page 36: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

We can think of the FDA’s problem in terms of two dimensions:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work

FDA approves

Good! Bad!

FDA doesn’t approve

Bad! Good!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 8 / 146

Page 37: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

We can think of the FDA’s problem in terms of two dimensions:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work

FDA approves Good!

Bad!

FDA doesn’t approve

Bad!

Good!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 8 / 146

Page 38: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

We can think of the FDA’s problem in terms of two dimensions:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work

FDA approves Good!

Bad!

FDA doesn’t approve Bad! Good!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 8 / 146

Page 39: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

We can think of the FDA’s problem in terms of two dimensions:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work

FDA approves Good! Bad!

FDA doesn’t approve Bad! Good!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 8 / 146

Page 40: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 9 / 146

Page 41: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 9 / 146

Page 42: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 43: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 44: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 45: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 46: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 47: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 48: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Elements of a Hypothesis Test

Hypothesis testing gives us a systematic framework for making decisionsbased on observed data.

Important terms we are about to define:

Null Hypothesis (assumed state of world for test)

Alternative Hypothesis (all other states of the world)

Test Statistic (what we will observe from the sample)

Rejection Region (the basis of our decision)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 10 / 146

Page 49: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Null and Alternative Hypotheses

Null Hypothesis: The conservatively assumed state of the world(often “no effect”)

Example: The drug does not reduce blood pressure on average(µdecrease ≤ 0)

Alternative Hypothesis: Claim to be indirectly tested

Example: The drug does reduce blood pressure on average(µdecrease > 0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 11 / 146

Page 50: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Null and Alternative Hypotheses

Null Hypothesis: The conservatively assumed state of the world(often “no effect”)

Example: The drug does not reduce blood pressure on average(µdecrease ≤ 0)

Alternative Hypothesis: Claim to be indirectly tested

Example: The drug does reduce blood pressure on average(µdecrease > 0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 11 / 146

Page 51: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

More Examples

Null Hypothesis Examples (H0):

The drug does not change blood pressure on average (µdecrease = 0)

Alternative Hypothesis Examples (Ha):

The drug does change blood pressure on average (µdecrease 6= 0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 12 / 146

Page 52: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

More Examples

Null Hypothesis Examples (H0):

The drug does not change blood pressure on average (µdecrease = 0)

Alternative Hypothesis Examples (Ha):

The drug does change blood pressure on average (µdecrease 6= 0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 12 / 146

Page 53: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

Back to the two dimensions of the FDA’s problem:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work(H0 False) (H0 True)

FDA approves

Correct Type I error

(reject H0)

FDA doesn’t approve

Type II error Correct

(don’t reject H0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 13 / 146

Page 54: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

Back to the two dimensions of the FDA’s problem:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work(H0 False) (H0 True)

FDA approves Correct

Type I error

(reject H0)

FDA doesn’t approve

Type II error

Correct(don’t reject H0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 13 / 146

Page 55: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

Back to the two dimensions of the FDA’s problem:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work(H0 False) (H0 True)

FDA approves Correct Type I error(reject H0)

FDA doesn’t approve

Type II error

Correct(don’t reject H0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 13 / 146

Page 56: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The FDA’s Decision

Back to the two dimensions of the FDA’s problem:

The true state of the world

The decision made by the FDA

Drug works Drug doesn’t work(H0 False) (H0 True)

FDA approves Correct Type I error(reject H0)

FDA doesn’t approve Type II error Correct(don’t reject H0)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 13 / 146

Page 57: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Test Statistics, Null Distributions, and Rejection Regions

Test Statistic: A function of the sample summary statistics, the nullhypothesis, and the sample size. For example:

X − µ0

S√n

Null Distribution: the sampling distribution of the statistic/test statisticassuming that the null is true.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 14 / 146

Page 58: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Test Statistics, Null Distributions, and Rejection Regions

Test Statistic: A function of the sample summary statistics, the nullhypothesis, and the sample size. For example:

X − µ0

S√n

Null Distribution: the sampling distribution of the statistic/test statisticassuming that the null is true.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 14 / 146

Page 59: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Test Statistics, Null Distributions, and Rejection Regions

Test Statistic: A function of the sample summary statistics, the nullhypothesis, and the sample size. For example:

X − µ0

S√n

Null Distribution: the sampling distribution of the statistic/test statisticassuming that the null is true.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 14 / 146

Page 60: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Null Distributions

The CLT tells us that in large samples,

X ∼approx N(µ, σ2/n).

We know from our previous discussion that in large samples,

S/√n ≈ σ/

√n

If we assume that the null hypothesis is true such that µ = µ0, then

X ∼approx N(µ0,S2/n)

X − µ0

S√n

∼approx N(0, 1)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 15 / 146

Page 61: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Null Distributions

The CLT tells us that in large samples,

X ∼approx N(µ, σ2/n).

We know from our previous discussion that in large samples,

S/√n ≈ σ/

√n

If we assume that the null hypothesis is true such that µ = µ0, then

X ∼approx N(µ0,S2/n)

X − µ0

S√n

∼approx N(0, 1)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 15 / 146

Page 62: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Null Distributions

The CLT tells us that in large samples,

X ∼approx N(µ, σ2/n).

We know from our previous discussion that in large samples,

S/√n ≈ σ/

√n

If we assume that the null hypothesis is true such that µ = µ0, then

X ∼approx N(µ0,S2/n)

X − µ0

S√n

∼approx N(0, 1)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 15 / 146

Page 63: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Null Distributions

The CLT tells us that in large samples,

X ∼approx N(µ, σ2/n).

We know from our previous discussion that in large samples,

S/√n ≈ σ/

√n

If we assume that the null hypothesis is true such that µ = µ0, then

X ∼approx N(µ0,S2/n)

X − µ0

S√n

∼approx N(0, 1)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 15 / 146

Page 64: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 16 / 146

Page 65: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 16 / 146

Page 66: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α

α is the probability of Type I error.

We usually pick an α that we are comfortable with in advance, and usingthe null distribution for the test statistic and the alternative hypothesis, wedefine a rejection region.

Example: Suppose α =5%, the test statistic is X−µ0S√n

, the null hypothesis is

H0 : µ = µ0, and the alternative hypothesis is Ha : µ 6= µ0.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 17 / 146

Page 67: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α

α is the probability of Type I error.

We usually pick an α that we are comfortable with in advance, and usingthe null distribution for the test statistic and the alternative hypothesis, wedefine a rejection region.

Example: Suppose α =5%, the test statistic is X−µ0S√n

, the null hypothesis is

H0 : µ = µ0, and the alternative hypothesis is Ha : µ 6= µ0.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 17 / 146

Page 68: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α

α is the probability of Type I error.

We usually pick an α that we are comfortable with in advance, and usingthe null distribution for the test statistic and the alternative hypothesis, wedefine a rejection region.

Example: Suppose α =5%, the test statistic is X−µ0S√n

, the null hypothesis is

H0 : µ = µ0, and the alternative hypothesis is Ha : µ 6= µ0.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 17 / 146

Page 69: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α

α is the probability of Type I error.

We usually pick an α that we are comfortable with in advance, and usingthe null distribution for the test statistic and the alternative hypothesis, wedefine a rejection region.

Example: Suppose α =5%, the test statistic is X−µ0S√n

, the null hypothesis is

H0 : µ = µ0, and the alternative hypothesis is Ha : µ 6= µ0.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 17 / 146

Page 70: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two-sided rejection region

Rejection region with α = .05, H0 : µ = 0, HA : µ 6= 0:

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Reject RejectFail to Reject

2.5% 2.5%

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 18 / 146

Page 71: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two-sided rejection regionRejection region with α = .05, H0 : µ = 0, HA : µ 6= 0:

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Reject RejectFail to Reject

2.5% 2.5%

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 18 / 146

Page 72: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

One-sided Rejection Region

Rejection region with α = .05, H0 : µ ≤ 0, HA : µ > 0:

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Fail to Reject Reject

5%

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 19 / 146

Page 73: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

One-sided Rejection Region

Rejection region with α = .05, H0 : µ ≤ 0, HA : µ > 0:

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Fail to Reject Reject

5%

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 19 / 146

Page 74: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

So, should the FDA approve further trials?

Recall the null and alternative hypotheses:

H0 : µdecrease ≤ 0

Ha : µdecrease > 0

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 20 / 146

Page 75: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

So, should the FDA approve further trials?

Recall the null and alternative hypotheses:

H0 : µdecrease ≤ 0

Ha : µdecrease > 0

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 20 / 146

Page 76: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

So, should the FDA approve further trials?

Recall the null and alternative hypotheses:

H0 : µdecrease ≤ 0

Ha : µdecrease > 0

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 20 / 146

Page 77: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

We can calculate the test statistic:

x = 21.0

s = 14.3

n = 345

Therefore,

T =21.0− 0

14.3√345

= 27.3

What is the decision?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 21 / 146

Page 78: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

We can calculate the test statistic:

x = 21.0

s = 14.3

n = 345

Therefore,

T =21.0− 0

14.3√345

= 27.3

What is the decision?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 21 / 146

Page 79: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

We can calculate the test statistic:

x = 21.0

s = 14.3

n = 345

Therefore,

T =21.0− 0

14.3√345

= 27.3

What is the decision?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 21 / 146

Page 80: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example

We can calculate the test statistic:

x = 21.0

s = 14.3

n = 345

Therefore,

T =21.0− 0

14.3√345

= 27.3

What is the decision?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 21 / 146

Page 81: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Region with α = .05

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Fail to Reject Reject

5%

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 22 / 146

Page 82: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Region with α = .05

−5 0 5 10 15 20 25 30

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Fail to

RejectReject

5%

T = 27.3

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 23 / 146

Page 83: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 24 / 146

Page 84: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 24 / 146

Page 85: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The appropriate level (α) for a hypothesis test depends on the relativecosts of Type I and Type II errors.

What if there is disagreement about these costs?

We might like a quantity that summarizes the strength of evidence againstthe null hypothesis without making a yes or no decision.

P-value: Assuming that the null hypothesis is true, the probability ofgetting something at least as extreme as our observed test statistic, whereextreme is defined in terms of the alternative hypothesis.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 25 / 146

Page 86: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The appropriate level (α) for a hypothesis test depends on the relativecosts of Type I and Type II errors.

What if there is disagreement about these costs?

We might like a quantity that summarizes the strength of evidence againstthe null hypothesis without making a yes or no decision.

P-value: Assuming that the null hypothesis is true, the probability ofgetting something at least as extreme as our observed test statistic, whereextreme is defined in terms of the alternative hypothesis.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 25 / 146

Page 87: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The appropriate level (α) for a hypothesis test depends on the relativecosts of Type I and Type II errors.

What if there is disagreement about these costs?

We might like a quantity that summarizes the strength of evidence againstthe null hypothesis without making a yes or no decision.

P-value: Assuming that the null hypothesis is true, the probability ofgetting something at least as extreme as our observed test statistic, whereextreme is defined in terms of the alternative hypothesis.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 25 / 146

Page 88: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The appropriate level (α) for a hypothesis test depends on the relativecosts of Type I and Type II errors.

What if there is disagreement about these costs?

We might like a quantity that summarizes the strength of evidence againstthe null hypothesis without making a yes or no decision.

P-value: Assuming that the null hypothesis is true, the probability ofgetting something at least as extreme as our observed test statistic, whereextreme is defined in terms of the alternative hypothesis.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 25 / 146

Page 89: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The appropriate level (α) for a hypothesis test depends on the relativecosts of Type I and Type II errors.

What if there is disagreement about these costs?

We might like a quantity that summarizes the strength of evidence againstthe null hypothesis without making a yes or no decision.

P-value: Assuming that the null hypothesis is true, the probability ofgetting something at least as extreme as our observed test statistic, whereextreme is defined in terms of the alternative hypothesis.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 25 / 146

Page 90: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0p = 0.036

Ha : µ 6= 0p = .072

Ha : µ < 0p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 91: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.036

Ha : µ 6= 0p = .072

Ha : µ < 0p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 92: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.036

Ha : µ 6= 0p = .072

Ha : µ < 0p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 93: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.036

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = .072

Ha : µ < 0p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 94: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.036

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = .072

Ha : µ < 0p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 95: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.036

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = .072

Ha : µ < 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 96: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

P-value

The p-value depends on both the realized value of the test statistic andthe alternative hypothesis.

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.036

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = .072

Ha : µ < 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

p = 0.964

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 26 / 146

Page 97: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0 Ha : µ 6= 0 Ha : µ < 0If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 98: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Ha : µ 6= 0 Ha : µ < 0

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 99: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Fail to Reject Reject

Ha : µ 6= 0 Ha : µ < 0

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 100: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Fail to Reject Reject

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Ha : µ < 0

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 101: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Fail to Reject Reject

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Reject RejectFail to Reject

T = 1.8

Ha : µ < 0

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 102: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Fail to Reject Reject

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Reject RejectFail to Reject

T = 1.8

Ha : µ < 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 103: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Fail to Reject Reject

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Reject RejectFail to Reject

T = 1.8

Ha : µ < 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Reject Fail to Reject

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 104: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Rejection Regions and P-values

What is the relationship between p-values and the rejection region of atest? Assume that α = .05:

Ha : µ > 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Fail to Reject Reject

Ha : µ 6= 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Reject RejectFail to Reject

T = 1.8

Ha : µ < 0

−4 −2 0 2 4

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

) T = 1.8

Reject Fail to Reject

If p < α, then the test statistic falls in the rejection region for the α-leveltest.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 27 / 146

Page 105: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example 1

Recall the drug testing example, where H0 : µ0 ≤ 0 and Ha : µ0 > 0:

x = 21.0

s = 14.3

n = 345

Therefore,

T =21.0− 0

14.3√345

= 27.3

What is the probability of observing a test statistic greater than 27.3 if thenull is true?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 28 / 146

Page 106: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example 1

−5 0 5 10 15 20 25 30

0.0

0.1

0.2

0.3

0.4

Test Statistic

p(T

)

Fail to

RejectReject

p < .0001

T = 27.3

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 29 / 146

Page 107: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

Up to this point, we have defined rejection regions in terms of the teststatistic.

In some cases, we can define an equivalent rejection region in terms of theparameter of interest.

For a two-sided, large-sample test, we reject if:

X−µ0s√n> zα/2 or X−µ0

s√n< −zα/2

X − µ0 > zα/2 × s√n

or X − µ0 < −zα/2 × s√n

X > µ0 + zα/2 × s√n

or X < µ0 − zα/2 × s√n

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 30 / 146

Page 108: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

Up to this point, we have defined rejection regions in terms of the teststatistic.

In some cases, we can define an equivalent rejection region in terms of theparameter of interest.

For a two-sided, large-sample test, we reject if:

X−µ0s√n> zα/2 or X−µ0

s√n< −zα/2

X − µ0 > zα/2 × s√n

or X − µ0 < −zα/2 × s√n

X > µ0 + zα/2 × s√n

or X < µ0 − zα/2 × s√n

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 30 / 146

Page 109: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

Up to this point, we have defined rejection regions in terms of the teststatistic.

In some cases, we can define an equivalent rejection region in terms of theparameter of interest.

For a two-sided, large-sample test, we reject if:

X−µ0s√n> zα/2 or X−µ0

s√n< −zα/2

X − µ0 > zα/2 × s√n

or X − µ0 < −zα/2 × s√n

X > µ0 + zα/2 × s√n

or X < µ0 − zα/2 × s√n

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 30 / 146

Page 110: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

The rescaled rejection region isrelated to 1− α CI:

If the observed X is in the αrejection region, the 1− α CIdoes not contain µ0.

If the observed X is not in the αrejection region, the 1− α CIcontains µ0.

Therefore, we can use the 1− α CIto test the null hypothesis at the αlevel.

µµ0 µµ0 ++ zαα 2SE((X))µµ0 −− zαα 2SE((X))

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 31 / 146

Page 111: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

The rescaled rejection region isrelated to 1− α CI:

If the observed X is in the αrejection region, the 1− α CIdoes not contain µ0.

If the observed X is not in the αrejection region, the 1− α CIcontains µ0.

Therefore, we can use the 1− α CIto test the null hypothesis at the αlevel.

µµ0 µµ0 ++ zαα 2SE((X))µµ0 −− zαα 2SE((X))

X

X ++ zαα 2SE((X))X −− zαα 2SE((X))

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 31 / 146

Page 112: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

The rescaled rejection region isrelated to 1− α CI:

If the observed X is in the αrejection region, the 1− α CIdoes not contain µ0.

If the observed X is not in the αrejection region, the 1− α CIcontains µ0.

Therefore, we can use the 1− α CIto test the null hypothesis at the αlevel.

µµ0 µµ0 ++ zαα 2SE((X))µµ0 −− zαα 2SE((X))

X

X ++ zαα 2SE((X))X −− zαα 2SE((X))

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 31 / 146

Page 113: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

α Rejection Regions and 1− α CIs

The rescaled rejection region isrelated to 1− α CI:

If the observed X is in the αrejection region, the 1− α CIdoes not contain µ0.

If the observed X is not in the αrejection region, the 1− α CIcontains µ0.

Therefore, we can use the 1− α CIto test the null hypothesis at the αlevel.

µµ0 µµ0 ++ zαα 2SE((X))µµ0 −− zαα 2SE((X))

X

X ++ zαα 2SE((X))X −− zαα 2SE((X))

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 31 / 146

Page 114: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Another interpretation of CIs

The form of the “fail to reject” region of an α-level hypothesis test is:(µ0 − zα/2 ×

s√n, µ0 + zα/2 ×

s√n

)

The form of a region of a 1− α CI is:(X − zα/2 ×

s√n,X + zα/2 ×

s√n

)So the 1− α CI is the set of null hypotheses µ0 that would not be rejectedat the α level.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 32 / 146

Page 115: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Another interpretation of CIs

The form of the “fail to reject” region of an α-level hypothesis test is:(µ0 − zα/2 ×

s√n, µ0 + zα/2 ×

s√n

)The form of a region of a 1− α CI is:(

X − zα/2 ×s√n,X + zα/2 ×

s√n

)

So the 1− α CI is the set of null hypotheses µ0 that would not be rejectedat the α level.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 32 / 146

Page 116: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Another interpretation of CIs

The form of the “fail to reject” region of an α-level hypothesis test is:(µ0 − zα/2 ×

s√n, µ0 + zα/2 ×

s√n

)The form of a region of a 1− α CI is:(

X − zα/2 ×s√n,X + zα/2 ×

s√n

)So the 1− α CI is the set of null hypotheses µ0 that would not be rejectedat the α level.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 32 / 146

Page 117: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 33 / 146

Page 118: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 33 / 146

Page 119: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict

Correct Type I Error

Acquit

Type II Error Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 120: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict

Correct Type I Error

Acquit

Type II Error Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 121: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict Correct

Type I Error

Acquit

Type II Error

Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 122: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict Correct Type I ErrorAcquit

Type II Error

Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 123: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict Correct Type I ErrorAcquit Type II Error Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 124: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict Correct Type I ErrorAcquit Type II Error Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 125: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: SetupGoal: test a hypothesis about the value of a parameter.

Statistical decision theory underlies such hypothesis testing.

Trial Example:

Suppose we must decide whether to convict or acquit a defendant based onevidence presented at a trial. There are four possible outcomes:

DefendantGuilty Innocent

Decision Convict Correct Type I ErrorAcquit Type II Error Correct

We could make two types of errors:

Convict an innocent defendant (type-I error)

Acquit a guilty defendant (type-II error)

Our goal is to limit the probability of making these types of errors.

However, creating a decision rule which minimizes both types of errors at thesame time is impossible. We therefore need to balance them.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 34 / 146

Page 126: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Error Types

DefendantGuilty Innocent

Decision Convict Correct Type-I errorAcquit Type-II error Correct

Now, suppose that we have a statistical model for the probability of convictingand acquitting, conditional on whether the defendant is actually guilty orinnocent.

Then, our decision-making rule can be characterized by two probabilities:

α = Pr(type-I error) = Pr(convict | innocent)

β = Pr(type-II error) = Pr(acquit | guilty)

The probability of making a correct decision is therefore 1− α (if innocent) and1− β (if guilty).

Hypothesis testing follows an analogous logic, where we want to decide whetherto reject (= convict) or fail to reject (= acquit) a null hypothesis (= defendant)using sample data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 35 / 146

Page 127: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Error Types

DefendantGuilty Innocent

Decision Convict Correct αAcquit Type-II error Correct

Now, suppose that we have a statistical model for the probability of convictingand acquitting, conditional on whether the defendant is actually guilty orinnocent.

Then, our decision-making rule can be characterized by two probabilities:

α = Pr(type-I error) = Pr(convict | innocent)

β = Pr(type-II error) = Pr(acquit | guilty)

The probability of making a correct decision is therefore 1− α (if innocent) and1− β (if guilty).

Hypothesis testing follows an analogous logic, where we want to decide whetherto reject (= convict) or fail to reject (= acquit) a null hypothesis (= defendant)using sample data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 35 / 146

Page 128: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Error Types

DefendantGuilty Innocent

Decision Convict Correct αAcquit β Correct

Now, suppose that we have a statistical model for the probability of convictingand acquitting, conditional on whether the defendant is actually guilty orinnocent.

Then, our decision-making rule can be characterized by two probabilities:

α = Pr(type-I error) = Pr(convict | innocent)

β = Pr(type-II error) = Pr(acquit | guilty)

The probability of making a correct decision is therefore 1− α (if innocent) and1− β (if guilty).

Hypothesis testing follows an analogous logic, where we want to decide whetherto reject (= convict) or fail to reject (= acquit) a null hypothesis (= defendant)using sample data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 35 / 146

Page 129: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Error Types

DefendantGuilty Innocent

Decision Convict 1− β αAcquit β 1− α

Now, suppose that we have a statistical model for the probability of convictingand acquitting, conditional on whether the defendant is actually guilty orinnocent.

Then, our decision-making rule can be characterized by two probabilities:

α = Pr(type-I error) = Pr(convict | innocent)

β = Pr(type-II error) = Pr(acquit | guilty)

The probability of making a correct decision is therefore 1− α (if innocent) and1− β (if guilty).

Hypothesis testing follows an analogous logic, where we want to decide whetherto reject (= convict) or fail to reject (= acquit) a null hypothesis (= defendant)using sample data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 35 / 146

Page 130: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Error Types

DefendantGuilty Innocent

Decision Convict 1− β αAcquit β 1− α

Now, suppose that we have a statistical model for the probability of convictingand acquitting, conditional on whether the defendant is actually guilty orinnocent.

Then, our decision-making rule can be characterized by two probabilities:

α = Pr(type-I error) = Pr(convict | innocent)

β = Pr(type-II error) = Pr(acquit | guilty)

The probability of making a correct decision is therefore 1− α (if innocent) and1− β (if guilty).

Hypothesis testing follows an analogous logic, where we want to decide whetherto reject (= convict) or fail to reject (= acquit) a null hypothesis (= defendant)using sample data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 35 / 146

Page 131: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Steps

Null Hypothesis (H0)False True

Decision Reject 1− β αFail to Reject β 1− α

1 Specify a null hypothesis H0 (e.g. the defendant = innocent)

2 Pick a value of α = Pr(reject H0 | H0) (e.g. 0.05). This is the maximumprobability of making a type-I error we decide to tolerate, and called thesignificance level of the test.

3 Choose a test statistic T , which is a function of sample data and related toH0 (e.g. the count of testimonies against the defendant)

4 Assuming H0 is true, derive the null distribution of T (e.g. standard normal)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 36 / 146

Page 132: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Steps

Null Hypothesis (H0)False True

Decision Reject 1− β αFail to Reject β 1− α

1 Specify a null hypothesis H0 (e.g. the defendant = innocent)

2 Pick a value of α = Pr(reject H0 | H0) (e.g. 0.05). This is the maximumprobability of making

a type-I error we decide to tolerate, and called thesignificance level of the test.

3 Choose a test statistic T , which is a function of sample data and related toH0 (e.g. the count of testimonies against the defendant)

4 Assuming H0 is true, derive the null distribution of T (e.g. standard normal)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 36 / 146

Page 133: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Steps

Null Hypothesis (H0)False True

Decision Reject 1− β αFail to Reject β 1− α

1 Specify a null hypothesis H0 (e.g. the defendant = innocent)

2 Pick a value of α = Pr(reject H0 | H0) (e.g. 0.05). This is the maximumprobability of making a type-I error we decide to tolerate, and called thesignificance level of the test.

3 Choose a test statistic T , which is a function of sample data and related toH0 (e.g. the count of testimonies against the defendant)

4 Assuming H0 is true, derive the null distribution of T (e.g. standard normal)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 36 / 146

Page 134: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Steps

Null Hypothesis (H0)False True

Decision Reject 1− β αFail to Reject β 1− α

1 Specify a null hypothesis H0 (e.g. the defendant = innocent)

2 Pick a value of α = Pr(reject H0 | H0) (e.g. 0.05). This is the maximumprobability of making a type-I error we decide to tolerate, and called thesignificance level of the test.

3 Choose a test statistic T , which is a function of sample data and related toH0 (e.g. the count of testimonies against the defendant)

4 Assuming H0 is true, derive the null distribution of T (e.g. standard normal)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 36 / 146

Page 135: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Steps

Null Hypothesis (H0)False True

Decision Reject 1− β αFail to Reject β 1− α

1 Specify a null hypothesis H0 (e.g. the defendant = innocent)

2 Pick a value of α = Pr(reject H0 | H0) (e.g. 0.05). This is the maximumprobability of making a type-I error we decide to tolerate, and called thesignificance level of the test.

3 Choose a test statistic T , which is a function of sample data and related toH0 (e.g. the count of testimonies against the defendant)

4 Assuming H0 is true, derive the null distribution of T (e.g. standard normal)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 36 / 146

Page 136: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing: Steps

Null Hypothesis (H0)False True

Decision Reject 1− β αFail to Reject β 1− α

5 Using the critical values from a statistical table, evaluate how unusual theobserved value of T is under the null hypothesis:

I If the probability of drawing a T at least as extreme as the observed Tis less than α, we reject H0.(e.g. there is an implausible amount of evidence to have observed ifshe was innocent, so reject the hypothesis that she is innocent.)

I Otherwise, we fail to reject H0.(e.g. there is not enough evidence against the defendant to convict.We don’t know for sure she is innocent, but it is still plausible.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 37 / 146

Page 137: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 38 / 146

Page 138: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 38 / 146

Page 139: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Practical versus Statistical Significance

X − µ0

S/√n∼ tn−1

What are the possible reasons for rejecting the null?

1 X − µ0 is large (big difference between sample mean and meanassumed by H0)

2 n is large (you have a lot of data so you have a lot of precision)

3 S is small (the outcome has low variability)

We need to be careful to distinguish:

I practical significance (e.g. a big effect)

I statistical significance (i.e. we reject the null)

In large samples even tiny effects will be significant, but the results may notbe very important substantively. Always discuss both!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 39 / 146

Page 140: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Practical versus Statistical Significance

X − µ0

S/√n∼ tn−1

What are the possible reasons for rejecting the null?

1 X − µ0 is large (big difference between sample mean and meanassumed by H0)

2 n is large (you have a lot of data so you have a lot of precision)

3 S is small (the outcome has low variability)

We need to be careful to distinguish:

I practical significance (e.g. a big effect)

I statistical significance (i.e. we reject the null)

In large samples even tiny effects will be significant, but the results may notbe very important substantively. Always discuss both!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 39 / 146

Page 141: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Practical versus Statistical Significance

X − µ0

S/√n∼ tn−1

What are the possible reasons for rejecting the null?

1 X − µ0 is large (big difference between sample mean and meanassumed by H0)

2 n is large (you have a lot of data so you have a lot of precision)

3 S is small (the outcome has low variability)

We need to be careful to distinguish:

I practical significance (e.g. a big effect)

I statistical significance (i.e. we reject the null)

In large samples even tiny effects will be significant, but the results may notbe very important substantively. Always discuss both!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 39 / 146

Page 142: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Practical versus Statistical Significance

X − µ0

S/√n∼ tn−1

What are the possible reasons for rejecting the null?

1 X − µ0 is large (big difference between sample mean and meanassumed by H0)

2 n is large (you have a lot of data so you have a lot of precision)

3 S is small (the outcome has low variability)

We need to be careful to distinguish:

I practical significance (e.g. a big effect)

I statistical significance (i.e. we reject the null)

In large samples even tiny effects will be significant, but the results may notbe very important substantively. Always discuss both!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 39 / 146

Page 143: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Practical versus Statistical Significance

X − µ0

S/√n∼ tn−1

What are the possible reasons for rejecting the null?

1 X − µ0 is large (big difference between sample mean and meanassumed by H0)

2 n is large (you have a lot of data so you have a lot of precision)

3 S is small (the outcome has low variability)

We need to be careful to distinguish:

I practical significance (e.g. a big effect)

I statistical significance (i.e. we reject the null)

In large samples even tiny effects will be significant, but the results may notbe very important substantively. Always discuss both!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 39 / 146

Page 144: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Practical versus Statistical Significance

X − µ0

S/√n∼ tn−1

What are the possible reasons for rejecting the null?

1 X − µ0 is large (big difference between sample mean and meanassumed by H0)

2 n is large (you have a lot of data so you have a lot of precision)

3 S is small (the outcome has low variability)

We need to be careful to distinguish:

I practical significance (e.g. a big effect)

I statistical significance (i.e. we reject the null)

In large samples even tiny effects will be significant, but the results may notbe very important substantively. Always discuss both!

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 39 / 146

Page 145: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Star Chasing (aka there is an XKCD for everything)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 40 / 146

Page 146: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Star Chasing (aka there is an XKCD for everything)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 40 / 146

Page 147: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Star Chasing (aka there is an XKCD for everything)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 40 / 146

Page 148: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing

If we test all of the coefficients separately with a t-test, then weshould expect that 5% of them will be significant just due to randomchance.

Illustration: randomly draw 21 variables, and run a regression of thefirst variable on the rest.

By design, no effect of any variable on any other, but when we runthe regression:

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 41 / 146

Page 149: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing

If we test all of the coefficients separately with a t-test, then weshould expect that 5% of them will be significant just due to randomchance.

Illustration: randomly draw 21 variables, and run a regression of thefirst variable on the rest.

By design, no effect of any variable on any other, but when we runthe regression:

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 41 / 146

Page 150: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing

If we test all of the coefficients separately with a t-test, then weshould expect that 5% of them will be significant just due to randomchance.

Illustration: randomly draw 21 variables, and run a regression of thefirst variable on the rest.

By design, no effect of any variable on any other, but when we runthe regression:

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 41 / 146

Page 151: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Test Example

##

## Coefficients:

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

## (Intercept) -0.0280393 0.1138198 -0.246 0.80605

## X2 -0.1503904 0.1121808 -1.341 0.18389

## X3 0.0791578 0.0950278 0.833 0.40736

## X4 -0.0717419 0.1045788 -0.686 0.49472

## X5 0.1720783 0.1140017 1.509 0.13518

## X6 0.0808522 0.1083414 0.746 0.45772

## X7 0.1029129 0.1141562 0.902 0.37006

## X8 -0.3210531 0.1206727 -2.661 0.00945 **

## X9 -0.0531223 0.1079834 -0.492 0.62412

## X10 0.1801045 0.1264427 1.424 0.15827

## X11 0.1663864 0.1109471 1.500 0.13768

## X12 0.0080111 0.1037663 0.077 0.93866

## X13 0.0002117 0.1037845 0.002 0.99838

## X14 -0.0659690 0.1122145 -0.588 0.55829

## X15 -0.1296539 0.1115753 -1.162 0.24872

## X16 -0.0544456 0.1251395 -0.435 0.66469

## X17 0.0043351 0.1120122 0.039 0.96923

## X18 -0.0807963 0.1098525 -0.735 0.46421

## X19 -0.0858057 0.1185529 -0.724 0.47134

## X20 -0.1860057 0.1045602 -1.779 0.07910 .

## X21 0.0021111 0.1081179 0.020 0.98447

## ---

## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1

##

## Residual standard error: 0.9992 on 79 degrees of freedom

## Multiple R-squared: 0.2009, Adjusted R-squared: -0.00142

## F-statistic: 0.993 on 20 and 79 DF, p-value: 0.4797

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 42 / 146

Page 152: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing Gives False Positives

Notice that out of 20 variables, one of the variables is significant atthe 0.05 level (in fact, at the 0.01 level).

But this is exactly what we expect: 1/20 = 0.05 of the tests are falsepositives at the 0.05 level

Also note that 2/20 = 0.1 are significant at the 0.1 level. Totallyexpected!

The procedure by which data or collections or tests are showed to usmatters! (e.g. anecdotes and prediction scams)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 43 / 146

Page 153: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing Gives False Positives

Notice that out of 20 variables, one of the variables is significant atthe 0.05 level (in fact, at the 0.01 level).

But this is exactly what we expect: 1/20 = 0.05 of the tests are falsepositives at the 0.05 level

Also note that 2/20 = 0.1 are significant at the 0.1 level. Totallyexpected!

The procedure by which data or collections or tests are showed to usmatters! (e.g. anecdotes and prediction scams)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 43 / 146

Page 154: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing Gives False Positives

Notice that out of 20 variables, one of the variables is significant atthe 0.05 level (in fact, at the 0.01 level).

But this is exactly what we expect: 1/20 = 0.05 of the tests are falsepositives at the 0.05 level

Also note that 2/20 = 0.1 are significant at the 0.1 level. Totallyexpected!

The procedure by which data or collections or tests are showed to usmatters! (e.g. anecdotes and prediction scams)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 43 / 146

Page 155: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Multiple Testing Gives False Positives

Notice that out of 20 variables, one of the variables is significant atthe 0.05 level (in fact, at the 0.01 level).

But this is exactly what we expect: 1/20 = 0.05 of the tests are falsepositives at the 0.05 level

Also note that 2/20 = 0.1 are significant at the 0.1 level. Totallyexpected!

The procedure by which data or collections or tests are showed to usmatters! (e.g. anecdotes and prediction scams)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 43 / 146

Page 156: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 157: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 158: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 159: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 160: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 161: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.

So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 162: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

The multiple testing (or “multiple comparison”) problem occurs whenone considers a set of statistical tests simultaneously.

Consider k = 1, ...,m independent hypothesis tests (e.g. controlversus various treatment groups). Even if each test is carried out at alow significance level (e.g., α = 0.05) the overall type I error rategrows very fast: αoverall = 1− (1− αk)m.

That’s right - it grows exponentially. E.g., given test 7 tests atα = .1 level the overall type I error is .52.

Even if all null hypotheses are true we will reject at least one of themwith probability .52.

Same for confidence intervals: probability that all 7 CI cover the truevalues simultaneously over repeated samples is .52.So for each coefficient you have a .90 confidence interval, but overalla .52 percent confidence interval.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 44 / 146

Page 163: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

Several statistical techniques have been developed to “adjust” for thisinflation of overall type I errors for multiple testing.

To compensate for the number of tests, these corrections generallyrequire a stronger level of evidence to be observed in order for anindividual comparison to be deemed “significant”

The most prominent adjustments include:I Bonferroni: for each individual test use significance level ofαk,BFer = αk/m

I Sidak: for each individual test use significance level ofαk,Sid = 1− (1− αk)1/m

I Scheffe (for confidence intervals)I False Discovery Rate (bound a different quantity)

There are many competing approaches (we will come back to somelater)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 45 / 146

Page 164: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

Several statistical techniques have been developed to “adjust” for thisinflation of overall type I errors for multiple testing.

To compensate for the number of tests, these corrections generallyrequire a stronger level of evidence to be observed in order for anindividual comparison to be deemed “significant”

The most prominent adjustments include:I Bonferroni: for each individual test use significance level ofαk,BFer = αk/m

I Sidak: for each individual test use significance level ofαk,Sid = 1− (1− αk)1/m

I Scheffe (for confidence intervals)I False Discovery Rate (bound a different quantity)

There are many competing approaches (we will come back to somelater)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 45 / 146

Page 165: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

Several statistical techniques have been developed to “adjust” for thisinflation of overall type I errors for multiple testing.

To compensate for the number of tests, these corrections generallyrequire a stronger level of evidence to be observed in order for anindividual comparison to be deemed “significant”

The most prominent adjustments include:I Bonferroni: for each individual test use significance level ofαk,BFer = αk/m

I Sidak: for each individual test use significance level ofαk,Sid = 1− (1− αk)1/m

I Scheffe (for confidence intervals)I False Discovery Rate (bound a different quantity)

There are many competing approaches (we will come back to somelater)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 45 / 146

Page 166: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

Several statistical techniques have been developed to “adjust” for thisinflation of overall type I errors for multiple testing.

To compensate for the number of tests, these corrections generallyrequire a stronger level of evidence to be observed in order for anindividual comparison to be deemed “significant”

The most prominent adjustments include:I Bonferroni: for each individual test use significance level ofαk,BFer = αk/m

I Sidak: for each individual test use significance level ofαk,Sid = 1− (1− αk)1/m

I Scheffe (for confidence intervals)I False Discovery Rate (bound a different quantity)

There are many competing approaches (we will come back to somelater)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 45 / 146

Page 167: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Problem of Multiple Testing

Several statistical techniques have been developed to “adjust” for thisinflation of overall type I errors for multiple testing.

To compensate for the number of tests, these corrections generallyrequire a stronger level of evidence to be observed in order for anindividual comparison to be deemed “significant”

The most prominent adjustments include:I Bonferroni: for each individual test use significance level ofαk,BFer = αk/m

I Sidak: for each individual test use significance level ofαk,Sid = 1− (1− αk)1/m

I Scheffe (for confidence intervals)I False Discovery Rate (bound a different quantity)

There are many competing approaches (we will come back to somelater)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 45 / 146

Page 168: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 169: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.

I the level of a test determines how often the researcher is willing toreject a correct null hypothesis.

I reporting p-values allows the researcher to separate the analysis fromthe decision.

I there is a close relationship between the results of an α level hypothesistest and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 170: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.

I reporting p-values allows the researcher to separate the analysis fromthe decision.

I there is a close relationship between the results of an α level hypothesistest and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 171: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.

I there is a close relationship between the results of an α level hypothesistest and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 172: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 173: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:

I evidence against a null isn’t necessarily evidence in favor of the specificalternative hypothesis you care about.

I lack of evidence against a null is absolutely not strong evidence in favorof no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 174: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.

I lack of evidence against a null is absolutely not strong evidence in favorof no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 175: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 176: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:

I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 177: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inference

I equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 178: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence tests

I power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 179: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Testing

Key points:I hypothesis testing provides a principled framework for making decisions

between alternatives.I the level of a test determines how often the researcher is willing to

reject a correct null hypothesis.I reporting p-values allows the researcher to separate the analysis from

the decision.I there is a close relationship between the results of an α level hypothesis

test and the coverage of a (1− α)% confidence interval.

Frequently overlooked points:I evidence against a null isn’t necessarily evidence in favor of the specific

alternative hypothesis you care about.I lack of evidence against a null is absolutely not strong evidence in favor

of no effect (or whatever the null is)

Other topics to be generally aware of:I permutation/randomization inferenceI equivalence testsI power analysis

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 46 / 146

Page 180: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Taking Stock

What we’ve been up to: estimating parameters of populationdistributions. Generally we’ve been learning about a single variable.

We will return to tease out the intricacies of confidence intervals,hypotheses and p-values later in the semester once you’ve had achance to do some more practice on the problem sets.

From here on out, we’ll be interested in the relationships betweenvariables. How does one variable change as we change the values ofanother variable? This question will be the bread and butter of theclass moving forward.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 47 / 146

Page 181: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Taking Stock

What we’ve been up to: estimating parameters of populationdistributions. Generally we’ve been learning about a single variable.

We will return to tease out the intricacies of confidence intervals,hypotheses and p-values later in the semester once you’ve had achance to do some more practice on the problem sets.

From here on out, we’ll be interested in the relationships betweenvariables. How does one variable change as we change the values ofanother variable? This question will be the bread and butter of theclass moving forward.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 47 / 146

Page 182: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Taking Stock

What we’ve been up to: estimating parameters of populationdistributions. Generally we’ve been learning about a single variable.

We will return to tease out the intricacies of confidence intervals,hypotheses and p-values later in the semester once you’ve had achance to do some more practice on the problem sets.

From here on out, we’ll be interested in the relationships betweenvariables. How does one variable change as we change the values ofanother variable? This question will be the bread and butter of theclass moving forward.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 47 / 146

Page 183: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

What is a relationship and why do we care?

Most of what we want to do in the social science is learn about howtwo variables are related

Examples:

I Does turnout vary by types of mailers received?I Is the quality of political institutions related to average incomes?I Does parental incarceration affect intergenerational mobility for child?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 48 / 146

Page 184: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

What is a relationship and why do we care?

Most of what we want to do in the social science is learn about howtwo variables are related

Examples:

I Does turnout vary by types of mailers received?I Is the quality of political institutions related to average incomes?I Does parental incarceration affect intergenerational mobility for child?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 48 / 146

Page 185: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

What is a relationship and why do we care?

Most of what we want to do in the social science is learn about howtwo variables are related

Examples:

I Does turnout vary by types of mailers received?I Is the quality of political institutions related to average incomes?I Does parental incarceration affect intergenerational mobility for child?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 48 / 146

Page 186: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

What is a relationship and why do we care?

Most of what we want to do in the social science is learn about howtwo variables are related

Examples:

I Does turnout vary by types of mailers received?

I Is the quality of political institutions related to average incomes?I Does parental incarceration affect intergenerational mobility for child?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 48 / 146

Page 187: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

What is a relationship and why do we care?

Most of what we want to do in the social science is learn about howtwo variables are related

Examples:

I Does turnout vary by types of mailers received?I Is the quality of political institutions related to average incomes?

I Does parental incarceration affect intergenerational mobility for child?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 48 / 146

Page 188: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

What is a relationship and why do we care?

Most of what we want to do in the social science is learn about howtwo variables are related

Examples:

I Does turnout vary by types of mailers received?I Is the quality of political institutions related to average incomes?I Does parental incarceration affect intergenerational mobility for child?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 48 / 146

Page 189: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 190: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnout

I Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 191: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capita

I Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 192: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 193: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 194: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty Mailer

I Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 195: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation Risk

I Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 196: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 197: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Notation and conventions

Y - the dependent variable or outcome or regressand or left-hand-sidevariable or response

I Voter turnoutI Log GDP per capitaI Income relative to parent

X - the independent variable or explanatory variable or regressor orright-hand-side variable or treatment or predictor

I Social pressure mailer versus Civic Duty MailerI Average Expropriation RiskI Incarcerated parent

Generally our goal is to understand how Y varies as a function of X :

Y = f (X ) + error

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 49 / 146

Page 198: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Three uses of regression

1 Description - parsimonious summary of the data

2 Prediction/Estimation/Inference - learn about parameters of the jointdistribution of the data

3 Causal Inference - evaluate counterfactuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 50 / 146

Page 199: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Three uses of regression

1 Description - parsimonious summary of the data

2 Prediction/Estimation/Inference - learn about parameters of the jointdistribution of the data

3 Causal Inference - evaluate counterfactuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 50 / 146

Page 200: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Three uses of regression

1 Description - parsimonious summary of the data

2 Prediction/Estimation/Inference - learn about parameters of the jointdistribution of the data

3 Causal Inference - evaluate counterfactuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 50 / 146

Page 201: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Describing relationships

Remember that we had ways to summarize the relationship betweenvariables in the population.

Joint densities, covariance, and correlation were all ways tosummarize the relationship between two variables.

But these were population quantities and we only have samples, so wemay want to estimate these quantities using their sample analogs(plug-in principle or analogy principle)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 51 / 146

Page 202: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Describing relationships

Remember that we had ways to summarize the relationship betweenvariables in the population.

Joint densities, covariance, and correlation were all ways tosummarize the relationship between two variables.

But these were population quantities and we only have samples, so wemay want to estimate these quantities using their sample analogs(plug-in principle or analogy principle)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 51 / 146

Page 203: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Describing relationships

Remember that we had ways to summarize the relationship betweenvariables in the population.

Joint densities, covariance, and correlation were all ways tosummarize the relationship between two variables.

But these were population quantities and we only have samples, so wemay want to estimate these quantities using their sample analogs(plug-in principle or analogy principle)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 51 / 146

Page 204: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Scatterplots

Sample version of joint probability density.

Shows graphically how two variables are related

1 2 3 4 5 6 7 8

67

89

10

Log Settler Mortality

Log G

DP p

er

cap

ita g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOL

BRABRB

CAF

CAN

CHL

CHNCIVCMRCOG

COLCRIDOMDZAECU

EGY

ETH

FJI

FRA

GAB

GBR

GHAGIN GMB

GTMGUY

HKG

HNDHTI

IDN

IND

JAM

KEN

KOR

LAO

LKAMAR

MDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGA

NIC

NZL

PAK

PANPERPRY

RWA

SDNSEN

SGP

SLE

SLVSUR

TCDTGO

THATTOTUN

TZA

UGA

URY

USA

VEN

VNM

ZAF

ZAR

Data from Acemoglu, Johnson and Robinson

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 52 / 146

Page 205: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Scatterplots

Sample version of joint probability density.

Shows graphically how two variables are related

1 2 3 4 5 6 7 8

67

89

10

Log Settler Mortality

Log G

DP p

er

cap

ita g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOL

BRABRB

CAF

CAN

CHL

CHNCIVCMRCOG

COLCRIDOMDZAECU

EGY

ETH

FJI

FRA

GAB

GBR

GHAGIN GMB

GTMGUY

HKG

HNDHTI

IDN

IND

JAM

KEN

KOR

LAO

LKAMAR

MDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGA

NIC

NZL

PAK

PANPERPRY

RWA

SDNSEN

SGP

SLE

SLVSUR

TCDTGO

THATTOTUN

TZA

UGA

URY

USA

VEN

VNM

ZAF

ZAR

Data from Acemoglu, Johnson and Robinson

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 52 / 146

Page 206: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Scatterplots

Sample version of joint probability density.

Shows graphically how two variables are related

1 2 3 4 5 6 7 8

67

89

10

Log Settler Mortality

Log G

DP p

er

cap

ita g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOL

BRABRB

CAF

CAN

CHL

CHNCIVCMRCOG

COLCRIDOMDZAECU

EGY

ETH

FJI

FRA

GAB

GBR

GHAGIN GMB

GTMGUY

HKG

HNDHTI

IDN

IND

JAM

KEN

KOR

LAO

LKAMAR

MDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGA

NIC

NZL

PAK

PANPERPRY

RWA

SDNSEN

SGP

SLE

SLVSUR

TCDTGO

THATTOTUN

TZA

UGA

URY

USA

VEN

VNM

ZAF

ZAR

Data from Acemoglu, Johnson and Robinson

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 52 / 146

Page 207: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Scatterplots

Sample version of joint probability density.

Shows graphically how two variables are related

1 2 3 4 5 6 7 8

67

89

10

Log Settler Mortality

Log

GD

P p

er

cap

ita g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOL

BRABRB

CAF

CAN

CHL

CHNCIVCMRCOG

COLCRIDOMDZAECU

EGY

ETH

FJI

FRA

GAB

GBR

GHAGIN GMB

GTMGUY

HKG

HNDHTI

IDN

IND

JAM

KEN

KOR

LAO

LKAMAR

MDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGA

NIC

NZL

PAK

PANPERPRY

RWA

SDNSEN

SGP

SLE

SLVSUR

TCDTGO

THATTOTUN

TZA

UGA

URY

USA

VEN

VNM

ZAF

ZAR

Data from Acemoglu, Johnson and Robinson

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 52 / 146

Page 208: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Non-linear relationship

Example of a non-linear relationship, where we use the unloggedversion of GDP and settler mortality:

0 500 1000 1500 2000 2500 3000

01

00

00

25

00

0

Settler Mortality

GD

P p

er

capit

a g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOLBRA

BRB

CAF

CAN

CHL

CHN CIVCMRCOG

COLCRIDOMDZAECUEGYETHFJI

FRA

GAB

GBR

GHAGIN GMBGTMGUY

HKG

HNDHTIIDN

INDJAMKEN

KOR

LAOLKAMARMDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGANIC

NZL

PAK

PANPERPRY

RWASDNSEN

SGP

SLESLVSUR

TCD TGO

THATTOTUN

TZAUGA

URY

USA

VEN

VNM

ZAF

ZAR

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 53 / 146

Page 209: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Non-linear relationship

Example of a non-linear relationship, where we use the unloggedversion of GDP and settler mortality:

0 500 1000 1500 2000 2500 3000

01

00

00

25

00

0

Settler Mortality

GD

P p

er

capit

a g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOLBRA

BRB

CAF

CAN

CHL

CHN CIVCMRCOG

COLCRIDOMDZAECUEGYETHFJI

FRA

GAB

GBR

GHAGIN GMBGTMGUY

HKG

HNDHTIIDN

INDJAMKEN

KOR

LAOLKAMARMDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGANIC

NZL

PAK

PANPERPRY

RWASDNSEN

SGP

SLESLVSUR

TCD TGO

THATTOTUN

TZAUGA

URY

USA

VEN

VNM

ZAF

ZAR

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 53 / 146

Page 210: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Non-linear relationship

Example of a non-linear relationship, where we use the unloggedversion of GDP and settler mortality:

0 500 1000 1500 2000 2500 3000

01

00

00

25

00

0

Settler Mortality

GD

P p

er

capit

a g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOLBRA

BRB

CAF

CAN

CHL

CHN CIVCMRCOG

COLCRIDOMDZAECUEGYETHFJI

FRA

GAB

GBR

GHAGIN GMBGTMGUY

HKG

HNDHTIIDN

INDJAMKEN

KOR

LAOLKAMARMDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGANIC

NZL

PAK

PANPERPRY

RWASDNSEN

SGP

SLESLVSUR

TCD TGO

THATTOTUN

TZAUGA

URY

USA

VEN

VNM

ZAF

ZAR

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 53 / 146

Page 211: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Non-linear relationship

Example of a non-linear relationship, where we use the unloggedversion of GDP and settler mortality:

0 500 1000 1500 2000 2500 3000

01

00

00

25

00

0

Settler Mortality

GD

P p

er

capit

a g

row

th

AGO

ARG

AUS

BDIBENBFABGD

BHS

BLZBOLBRA

BRB

CAF

CAN

CHL

CHN CIVCMRCOG

COLCRIDOMDZAECUEGYETHFJI

FRA

GAB

GBR

GHAGIN GMBGTMGUY

HKG

HNDHTIIDN

INDJAMKEN

KOR

LAOLKAMARMDG

MEX

MLI

MLT

MRT

MUSMYS

NER NGANIC

NZL

PAK

PANPERPRY

RWASDNSEN

SGP

SLESLVSUR

TCD TGO

THATTOTUN

TZAUGA

URY

USA

VEN

VNM

ZAF

ZAR

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 53 / 146

Page 212: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Sample Covariance

The sample version of population covariance,σXY = E [(X − E [X ])(Y − E [Y ])].

Definition (Sample Covariance)

The sample covariance between Yi and Xi is

SXY =1

n − 1

n∑i=1

(Xi − X n)(Yi − Y n)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 54 / 146

Page 213: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Sample Covariance

The sample version of population covariance,σXY = E [(X − E [X ])(Y − E [Y ])].

Definition (Sample Covariance)

The sample covariance between Yi and Xi is

SXY =1

n − 1

n∑i=1

(Xi − X n)(Yi − Y n)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 54 / 146

Page 214: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Sample Covariance

The sample version of population covariance,σXY = E [(X − E [X ])(Y − E [Y ])].

Definition (Sample Covariance)

The sample covariance between Yi and Xi is

SXY =1

n − 1

n∑i=1

(Xi − X n)(Yi − Y n)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 54 / 146

Page 215: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Sample Correlation

The sample version of population correlation, ρ = σXY /σXσY .

Definition (Sample Correlation)

The sample correlation between Yi and Xi is

ρ = r =SXYSXSY

=

∑ni=1(Xi − X n)(Yi − Y n)√∑n

i=1(Xi − X n)2∑n

i=1(Yi − Y n)2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 55 / 146

Page 216: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Sample Correlation

The sample version of population correlation, ρ = σXY /σXσY .

Definition (Sample Correlation)

The sample correlation between Yi and Xi is

ρ = r =SXYSXSY

=

∑ni=1(Xi − X n)(Yi − Y n)√∑n

i=1(Xi − X n)2∑n

i=1(Yi − Y n)2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 55 / 146

Page 217: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Sample Correlation

The sample version of population correlation, ρ = σXY /σXσY .

Definition (Sample Correlation)

The sample correlation between Yi and Xi is

ρ = r =SXYSXSY

=

∑ni=1(Xi − X n)(Yi − Y n)√∑n

i=1(Xi − X n)2∑n

i=1(Yi − Y n)2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 55 / 146

Page 218: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 219: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 220: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 221: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 222: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 223: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 224: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression is About Conditioning on X

Regression quantifies how an outcome variable Y varies as a function of oneor more predictor variables X

Many methods, but the common idea: conditioning on X

Goal is to characterize f (Y |X ), the conditional probability distribution of Yfor different levels of X

Instead of modeling the whole conditional density of Y given X , in regressionwe usually only model the conditional mean of Y given X : E [Y |X = x ]

Our key goal is to approximate the conditional expectation function E [Y |X ],which summarizes how the average of Y varies across all possible levels of X(also called the population regression function)

Once we have estimated E [Y |X ], we can use it for prediction and/or causalinference, depending on what assumptions we are willing to make

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 56 / 146

Page 225: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Review: Conditional expectation

It will be helpful to review a core concept:

Definition (Conditional Expectation Function)

The conditional expectation function (CEF) or the regression functionof Y given X , denoted

r(x) = E [Y |X = x ]

is the function that gives the mean of Y at various values of x .

Note that this is a function of the population distributions. We willwant to produce estimates r(x).

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 57 / 146

Page 226: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Review: Conditional expectation

It will be helpful to review a core concept:

Definition (Conditional Expectation Function)

The conditional expectation function (CEF) or the regression functionof Y given X , denoted

r(x) = E [Y |X = x ]

is the function that gives the mean of Y at various values of x .

Note that this is a function of the population distributions. We willwant to produce estimates r(x).

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 57 / 146

Page 227: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Review: Conditional expectation

It will be helpful to review a core concept:

Definition (Conditional Expectation Function)

The conditional expectation function (CEF) or the regression functionof Y given X , denoted

r(x) = E [Y |X = x ]

is the function that gives the mean of Y at various values of x .

Note that this is a function of the population distributions. We willwant to produce estimates r(x).

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 57 / 146

Page 228: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Review: Conditional expectation

It will be helpful to review a core concept:

Definition (Conditional Expectation Function)

The conditional expectation function (CEF) or the regression functionof Y given X , denoted

r(x) = E [Y |X = x ]

is the function that gives the mean of Y at various values of x .

Note that this is a function of the population distributions. We willwant to produce estimates r(x).

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 57 / 146

Page 229: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF for binary covariates

We’ve been writing µ1 and µ0 for the means in different groups.

For example, on the homework, you are looking at the expected valueof the loan amount conditional on gender. There we had µm and µw .

Note that these are just conditional expectations. Define Y to be theloan amount, X = 1 to indicate a man, and X = 0 to indicate awoman and then we have:

µm = r(1) = E [Y |X = 1]

µw = r(0) = E [Y |X = 0]

Notice here that since X can only take on two values, 0 and 1, thenthese two conditional means completely summarize the CEF.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 58 / 146

Page 230: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF for binary covariates

We’ve been writing µ1 and µ0 for the means in different groups.

For example, on the homework, you are looking at the expected valueof the loan amount conditional on gender. There we had µm and µw .

Note that these are just conditional expectations. Define Y to be theloan amount, X = 1 to indicate a man, and X = 0 to indicate awoman and then we have:

µm = r(1) = E [Y |X = 1]

µw = r(0) = E [Y |X = 0]

Notice here that since X can only take on two values, 0 and 1, thenthese two conditional means completely summarize the CEF.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 58 / 146

Page 231: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF for binary covariates

We’ve been writing µ1 and µ0 for the means in different groups.

For example, on the homework, you are looking at the expected valueof the loan amount conditional on gender. There we had µm and µw .

Note that these are just conditional expectations. Define Y to be theloan amount, X = 1 to indicate a man, and X = 0 to indicate awoman and then we have:

µm = r(1) = E [Y |X = 1]

µw = r(0) = E [Y |X = 0]

Notice here that since X can only take on two values, 0 and 1, thenthese two conditional means completely summarize the CEF.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 58 / 146

Page 232: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF for binary covariates

We’ve been writing µ1 and µ0 for the means in different groups.

For example, on the homework, you are looking at the expected valueof the loan amount conditional on gender. There we had µm and µw .

Note that these are just conditional expectations. Define Y to be theloan amount, X = 1 to indicate a man, and X = 0 to indicate awoman and then we have:

µm = r(1) = E [Y |X = 1]

µw = r(0) = E [Y |X = 0]

Notice here that since X can only take on two values, 0 and 1, thenthese two conditional means completely summarize the CEF.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 58 / 146

Page 233: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Estimating the CEF for binary covariates

How do we estimate r(x)?

We’ve already done this: it’s just the usual sample mean among themen and then the usual sample mean among the women:

r(1) =1

n1

∑i :Xi=1

Yi

r(0) =1

n0

∑i :Xi=0

Yi

Here we have n1 =∑n

i=1 Xi is the number of men in the sample andn0 = n − n1 is the number of women.

The sum here∑

i :Xi=1 is just summing only over the observations isuch that have Xi = 1, meaning that i is a man.

This is very straightforward: estimate the mean of Y conditional onX by just estimating the means within each group of X .

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 59 / 146

Page 234: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Estimating the CEF for binary covariates

How do we estimate r(x)?

We’ve already done this: it’s just the usual sample mean among themen and then the usual sample mean among the women:

r(1) =1

n1

∑i :Xi=1

Yi

r(0) =1

n0

∑i :Xi=0

Yi

Here we have n1 =∑n

i=1 Xi is the number of men in the sample andn0 = n − n1 is the number of women.

The sum here∑

i :Xi=1 is just summing only over the observations isuch that have Xi = 1, meaning that i is a man.

This is very straightforward: estimate the mean of Y conditional onX by just estimating the means within each group of X .

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 59 / 146

Page 235: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Estimating the CEF for binary covariates

How do we estimate r(x)?

We’ve already done this: it’s just the usual sample mean among themen and then the usual sample mean among the women:

r(1) =1

n1

∑i :Xi=1

Yi

r(0) =1

n0

∑i :Xi=0

Yi

Here we have n1 =∑n

i=1 Xi is the number of men in the sample andn0 = n − n1 is the number of women.

The sum here∑

i :Xi=1 is just summing only over the observations isuch that have Xi = 1, meaning that i is a man.

This is very straightforward: estimate the mean of Y conditional onX by just estimating the means within each group of X .

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 59 / 146

Page 236: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Estimating the CEF for binary covariates

How do we estimate r(x)?

We’ve already done this: it’s just the usual sample mean among themen and then the usual sample mean among the women:

r(1) =1

n1

∑i :Xi=1

Yi

r(0) =1

n0

∑i :Xi=0

Yi

Here we have n1 =∑n

i=1 Xi is the number of men in the sample andn0 = n − n1 is the number of women.

The sum here∑

i :Xi=1 is just summing only over the observations isuch that have Xi = 1, meaning that i is a man.

This is very straightforward: estimate the mean of Y conditional onX by just estimating the means within each group of X .

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 59 / 146

Page 237: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Estimating the CEF for binary covariates

How do we estimate r(x)?

We’ve already done this: it’s just the usual sample mean among themen and then the usual sample mean among the women:

r(1) =1

n1

∑i :Xi=1

Yi

r(0) =1

n0

∑i :Xi=0

Yi

Here we have n1 =∑n

i=1 Xi is the number of men in the sample andn0 = n − n1 is the number of women.

The sum here∑

i :Xi=1 is just summing only over the observations isuch that have Xi = 1, meaning that i is a man.

This is very straightforward: estimate the mean of Y conditional onX by just estimating the means within each group of X .

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 59 / 146

Page 238: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Binary covariate example CEF plot

0.0 0.2 0.4 0.6 0.8 1.0

67

89

10

Africa

Log G

DP p

er

capit

a g

row

th

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 60 / 146

Page 239: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF: Estimands, Estimators, and Estimates

The conditional expectation function E [Y |X ] is the estimand (orparameter) we are interested in

E [Y |X ] is the estimator of this parameter of interest, which is afunction of X

For a given sample dataset, we obtain an estimate of E [Y |X ].

We want to extend the regression idea to the case of multiple Xvariables, but we will start this week with the simple bivariate casewhere we have a single X

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 61 / 146

Page 240: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF: Estimands, Estimators, and Estimates

The conditional expectation function E [Y |X ] is the estimand (orparameter) we are interested in

E [Y |X ] is the estimator of this parameter of interest, which is afunction of X

For a given sample dataset, we obtain an estimate of E [Y |X ].

We want to extend the regression idea to the case of multiple Xvariables, but we will start this week with the simple bivariate casewhere we have a single X

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 61 / 146

Page 241: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF: Estimands, Estimators, and Estimates

The conditional expectation function E [Y |X ] is the estimand (orparameter) we are interested in

E [Y |X ] is the estimator of this parameter of interest, which is afunction of X

For a given sample dataset, we obtain an estimate of E [Y |X ].

We want to extend the regression idea to the case of multiple Xvariables, but we will start this week with the simple bivariate casewhere we have a single X

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 61 / 146

Page 242: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF: Estimands, Estimators, and Estimates

The conditional expectation function E [Y |X ] is the estimand (orparameter) we are interested in

E [Y |X ] is the estimator of this parameter of interest, which is afunction of X

For a given sample dataset, we obtain an estimate of E [Y |X ].

We want to extend the regression idea to the case of multiple Xvariables, but we will start this week with the simple bivariate casewhere we have a single X

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 61 / 146

Page 243: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

CEF: Estimands, Estimators, and Estimates

The conditional expectation function E [Y |X ] is the estimand (orparameter) we are interested in

E [Y |X ] is the estimator of this parameter of interest, which is afunction of X

For a given sample dataset, we obtain an estimate of E [Y |X ].

We want to extend the regression idea to the case of multiple Xvariables, but we will start this week with the simple bivariate casewhere we have a single X

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 61 / 146

Page 244: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 62 / 146

Page 245: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 62 / 146

Page 246: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fun With Salmon

Bennett, Baird, Miller and Wolford. (2009). “Neural correlates ofinterspecies perspective taking in the post-mortem Atlantic Salmon: anargument for multiple comparisons correction.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 63 / 146

Page 247: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 248: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 249: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject

“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 250: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy.

The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 251: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,

and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 252: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 253: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task

“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 254: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task.

The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 255: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence.

The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 256: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 257: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design

“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 258: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.

A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 259: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed.

Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 260: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Methods

(a.k.a. the greatest methods section of all time)

Subject“One mature Atlantic Salmon (Salmo salar) participated in the fMRIstudy. The salmon was approximately 18 inches long, weighed 3.8 lbs,and was not alive at the time of scanning.”

Task“The task administered to the salmon involved completing anopen-ended mentalizing task. The salmon was shown a series ofphotographs depicting human individuals in social situations with aspecified emotional valence. The salmon was asked to determine whatemotion the individual in the photo must have been experiencing.”

Design“Stimuli were presented in a block design with each photo presentedfor 10 seconds followed by 12 seconds of rest.A total of 15 photoswere displayed. Total scan time was 5.5 minutes.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 64 / 146

Page 261: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

“Several active voxels were discovered in a cluster located within thesalmon’s brain cavity. The size of this cluster was 81 mm3 with acluster-level significance of p = .001.”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 65 / 146

Page 262: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 66 / 146

Page 263: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 66 / 146

Page 264: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis testing example

(Credit for these example slides to Erin Hartman)

Suppose a recent poll found that, on average, on a scale of 1-100 (0 is approve,100 is disapprove), registered voters put approval of the president at 50.5%, witha standard deviation of 2 and a sample size of 50. Do voters disapprove of the jobthe president is doing?

H0: Disapproval ≤ 50

HA: Disapproval > 50

We want to start by assuming that our null hypothesis is true, and asking howlikely our observed poll was if that null is true. Let’s test this as the α = 0.05level.Is this a one-sided or two-sided test? One-sample or two-sample?So, let’s assume that the true disapproval rate is µ0 = 50 (as in the upper boundof our null).What is our critical value?

qt(0.95, 49) = 1.6765509Which is close to qnorm(0.95) = 1.6448536

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 67 / 146

Page 265: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis testing example

(Credit for these example slides to Erin Hartman)

Suppose a recent poll found that, on average, on a scale of 1-100 (0 is approve,100 is disapprove), registered voters put approval of the president at 50.5%, witha standard deviation of 2 and a sample size of 50. Do voters disapprove of the jobthe president is doing?

H0: Disapproval ≤ 50

HA: Disapproval > 50

We want to start by assuming that our null hypothesis is true, and asking howlikely our observed poll was if that null is true. Let’s test this as the α = 0.05level.Is this a one-sided or two-sided test? One-sample or two-sample?So, let’s assume that the true disapproval rate is µ0 = 50 (as in the upper boundof our null).What is our critical value? qt(0.95, 49) = 1.6765509Which is close to qnorm(0.95) = 1.6448536

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 67 / 146

Page 266: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing

Suppose a recent poll found that, on average, on a scale of 1-100 (0 isapprove, 100 is disapprove), registered voters put approval of the presidentat 50.5%, with a standard deviation of 2 and a sample size of 50. Dovoters disapprove of the job the president is doing?

H0: Disapproval ≤ 50

HA: Disapproval > 50

What is the sampling distribution of our sample mean, if our null is true?x ≈ N(µ, σ/

√n)

Since we do not know σ from our null, we use the sample standarddeviation s = 2.x ≈ N(50, 2/

√50)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 68 / 146

Page 267: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingSo, what am I asking? What’s the sampling distribution of the mean?

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

− σ n µ0 σ n

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 69 / 146

Page 268: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingPlug in our µ0 from our null, and our estimate of σ, σ (the samplestandard deviation).

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

− 2 50 50 2 50

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 70 / 146

Page 269: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5? But howcould we calculate this?

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

− 2 50 50 2 50 50.5

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 71 / 146

Page 270: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing

Now we can ask: How likely is our observed outcome of 50.5? But howcould we calculate this?

We could use pnorm if we were using the normal approximation

1 - pnorm(50.5, mean = 50, sd = 2/sqrt(50))

## [1] 0.03854994

But this would mean we’d have to calculate this every time to figure outour critical value, and it doesn’t work for small samples.Therefore, it is easier to standardize our test statistic and use the standardnormal (or t, if we have a small sample) table.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 72 / 146

Page 271: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5? But howcould we calculate this? Let’s standardize!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

− 2 50 50 2 50 50.5

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 73 / 146

Page 272: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5? But howcould we calculate this? Let’s standardize!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 1 49

Observed: 50.5

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 73 / 146

Page 273: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5? But howcould we calculate this? First–demean!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 1 49

Observed: 50.5 − 50

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 74 / 146

Page 274: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5?Second–divide by the standard error!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Observed: 50.5 − 50

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 75 / 146

Page 275: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5?Second–divide by the standard error!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 75 / 146

Page 276: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5?Second–divide by the standard error!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 75 / 146

Page 277: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5?Second–divide by the standard error!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 75 / 146

Page 278: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5?Second–divide by the standard error!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 75 / 146

Page 279: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5? Thisstandardized number is our t-statistic!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Observed: 50.5 − 50

2 50t = 1.76

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 76 / 146

Page 280: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: How likely is our observed outcome of 50.5? Thisstandardized number is our t-statistic!

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Observed: 50.5 − µ0

s nt = 1.76

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 76 / 146

Page 281: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis TestingNow we can ask: Is our t-statistic larger than our critical value? Yes! Sowe reject our null.

Sampling Distribution of Sample Mean

Sample Mean

Den

sity

−3 −2 −1 0 1 2 3

Observed: 50.5 − µ0

s nt = 1.76

Critical Value:t_49(0.95)=1.68

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 77 / 146

Page 282: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothesis Testing

Suppose a recent poll found that, on average, on a scale of 1-100 (0 isapprove, 100 is disapprove), registered voters put approval of the presidentat 50.5%, with a standard deviation of 2 and a sample size of 50. Dovoters disapprove of the job the president is doing?

H0: Disapproval ≤ 50

HA: Disapproval > 50

We want to start by assuming that our null hypothesis is true, and askinghow likely our observed poll was if that null is true.We got a t-statistic of 1.76

Which corresponds to a p-value of pt(1.76, 49, lower.tail =

FALSE) = 0.0423246. This is the shaded area in the graph above.

We get this by looking up t > 1.76 in the t-table with 49 degrees offreedom.

Is this significant at the α = 0.05 level? Do we reject our null?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 78 / 146

Page 283: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 284: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 285: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This Week

I Monday:F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 286: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testing

F what is regression?I Wednesday:

F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 287: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 288: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regression

F linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 289: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 290: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 291: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Where We’ve Been and Where We’re Going...

Last WeekI inference and estimator propertiesI point estimates, confidence intervals

This WeekI Monday:

F hypothesis testingF what is regression?

I Wednesday:F nonparametric regressionF linear approximations

Next WeekI inference for simple regressionI properties of OLS

Long RunI probability → inference → regression → causal inference

Questions?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 79 / 146

Page 292: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 80 / 146

Page 293: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 80 / 146

Page 294: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Let’s take a look at some data on education and income from theAmerican National Election Study

We use two variables:I Y : income

I X : educational attainment

Goal is to characterize the conditional expectation E [Y |X ], i.e. howaverage income varies with education level

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 81 / 146

Page 295: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Let’s take a look at some data on education and income from theAmerican National Election Study

We use two variables:I Y : income

I X : educational attainment

Goal is to characterize the conditional expectation E [Y |X ], i.e. howaverage income varies with education level

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 81 / 146

Page 296: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Let’s take a look at some data on education and income from theAmerican National Election Study

We use two variables:I Y : income

I X : educational attainment

Goal is to characterize the conditional expectation E [Y |X ], i.e. howaverage income varies with education level

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 81 / 146

Page 297: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Let’s take a look at some data on education and income from theAmerican National Election Study

We use two variables:I Y : income

I X : educational attainment

Goal is to characterize the conditional expectation E [Y |X ], i.e. howaverage income varies with education level

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 81 / 146

Page 298: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

educ: Respondent’s education:

1. 8 grades or less and no diploma or

2. 9-11 grades

3. High school diploma or equivalency test

4. More than 12 years of schooling, no higher degree

5. Junior or community college level degree (AA degrees)

6. BA level degrees; 17+ years, no postgraduate degree

7. Advanced degree

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 82 / 146

Page 299: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

educ: Respondent’s education:

1. 8 grades or less and no diploma or

2. 9-11 grades

3. High school diploma or equivalency test

4. More than 12 years of schooling, no higher degree

5. Junior or community college level degree (AA degrees)

6. BA level degrees; 17+ years, no postgraduate degree

7. Advanced degree

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 82 / 146

Page 300: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

income: Respondent’s family income:

1. None or less than $2,999

2. $3,000-$4,999

3. $5,000-$6,999

4. $7,000-$8,999

5. $9,000-$9,999

6. $10,000-$10,999...

17. $35,000-$39,999

18. $40,000-$44,999...

23. $90,000-$104,999

24. $105,000 and over

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 83 / 146

Page 301: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Marginal Distribution of Y

Histogram of income

income

Den

sity

0 5 10 15 20

0.00

0.02

0.04

0.06

0.08

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 84 / 146

Page 302: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Income and Education

● ● ●● ●●●●●●● ●● ●● ●● ●●

●● ●● ●● ● ● ●●●●

● ●● ●●● ● ● ●● ● ●● ● ●●●

● ●●●● ● ●●●● ●● ●●●●● ● ●

●● ● ●●● ●●●●● ● ●● ●● ● ●

● ●● ●● ● ●●● ●●●●

●● ●●●● ●● ● ●●

● ●●● ●● ● ●●● ●● ● ● ● ●●

●●● ● ●●● ●●●

●● ● ●● ●● ●● ●● ●●● ●

●●● ●●●● ●● ●● ●●●●● ●●● ● ●● ●

● ●● ● ●●● ●●● ●● ● ●● ●● ●● ●● ●● ● ●● ●● ● ●●●● ●●

●●● ●●● ●● ●●●●●● ●●●●● ●●● ●●● ●

●●● ●●●● ● ● ●● ●●● ● ●● ●●● ●● ●● ● ●●● ●● ●● ●●● ●●● ●

●●● ●●● ● ● ●● ●●●● ●● ●● ●● ● ●●●●● ● ●● ●● ●●● ●●● ● ●●● ●● ● ●●● ● ● ●● ●●●●● ● ●●● ●●● ●● ●●●

●● ●● ● ●● ● ●● ●●● ●●● ●● ●●● ●●●● ●●●●● ●● ● ●● ● ● ●●● ● ●● ●●● ●● ● ●●●● ●●●● ●● ●●●●● ●● ●●●●

● ●●●●● ●●● ●● ●● ●●●● ●●● ●● ●● ●●●● ●● ●●● ●● ●●● ●● ●● ●● ●●●●● ●● ● ●● ●● ● ●● ●● ●

●● ● ●● ● ● ●●●● ● ● ●● ●● ● ●●●●● ●● ●●● ●●● ●● ● ●●●●● ●● ● ●●●● ●●

●● ●●● ● ●●●●● ●● ● ●● ●● ●●● ●● ● ●●● ●●● ● ●●● ● ●●●● ●●● ●● ●● ●● ●● ●

● ●●● ●●● ●●● ●● ● ●● ●●●●● ● ● ●●● ●●●● ● ● ●● ● ●●● ●● ●● ●●● ●●●● ●●● ●● ●●●● ●●●● ●● ●● ●●●● ● ●●● ●●● ●● ●●●● ● ●●●●●● ● ●●●● ●● ●● ● ●

●●●● ●●● ●●●● ●●●● ● ●● ●● ● ●● ● ●●● ●●● ●●● ●●●● ●● ●● ●● ● ●●●● ● ●●● ● ●●● ● ●● ●●● ●●● ● ●●● ●●● ●●● ●● ● ●● ● ●●● ●●●●● ●●● ●●● ●● ●● ●●●●

● ●● ●● ● ●●●●● ●●● ●● ●●●●● ● ●● ● ●● ● ●●●●● ●●● ●●● ●● ●●●●●● ●●● ●● ●

● ●● ● ●● ●● ●● ●● ●●● ● ●●● ●●● ●●● ● ●● ● ●● ●● ●● ●● ● ●● ●●●● ●● ●

●●●● ●● ● ●● ●● ● ● ●● ●●● ●●●● ●●● ●●● ● ●●● ●●● ●●● ●●● ●● ●●● ●● ●●● ●●● ●● ●● ●●● ●● ● ●● ●●

1 2 3 4 5 6 7

510

1520

jitter(educ)

inco

me

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 85 / 146

Page 303: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Distribution of income given education p(y |x)

income

0

10

20

30

0 5 10 15 20 25

educ educ

0 5 10 15 20 25

educ

educ educ

0

10

20

30educ

0

10

20

30educ

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 86 / 146

Page 304: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Hard to decode what is going on in the histograms

Let’s try to find a more parsimonious summary measure: E [Y |X ]

Here our X variable education has a small number of levels (7) andthere are a reasonable number of observations in each level

In situations like this we can estimate E [Y |X = x ] as the samplemean of Y at each level of x ∈ X (just like the binary case)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 87 / 146

Page 305: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Hard to decode what is going on in the histograms

Let’s try to find a more parsimonious summary measure: E [Y |X ]

Here our X variable education has a small number of levels (7) andthere are a reasonable number of observations in each level

In situations like this we can estimate E [Y |X = x ] as the samplemean of Y at each level of x ∈ X (just like the binary case)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 87 / 146

Page 306: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Hard to decode what is going on in the histograms

Let’s try to find a more parsimonious summary measure: E [Y |X ]

Here our X variable education has a small number of levels (7) andthere are a reasonable number of observations in each level

In situations like this we can estimate E [Y |X = x ] as the samplemean of Y at each level of x ∈ X (just like the binary case)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 87 / 146

Page 307: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Hard to decode what is going on in the histograms

Let’s try to find a more parsimonious summary measure: E [Y |X ]

Here our X variable education has a small number of levels (7) andthere are a reasonable number of observations in each level

In situations like this we can estimate E [Y |X = x ] as the samplemean of Y at each level of x ∈ X (just like the binary case)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 87 / 146

Page 308: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

Hard to decode what is going on in the histograms

Let’s try to find a more parsimonious summary measure: E [Y |X ]

Here our X variable education has a small number of levels (7) andthere are a reasonable number of observations in each level

In situations like this we can estimate E [Y |X = x ] as the samplemean of Y at each level of x ∈ X (just like the binary case)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 87 / 146

Page 309: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Discrete X

● ● ●●●●●●●●● ●● ●● ●● ●●

●● ●● ●● ● ● ●● ●●

● ●●●●●● ● ●● ● ●● ● ●●●

● ●●●● ● ●● ●● ●● ●●●● ●● ●

●●● ●●● ●●●●● ●●● ●● ● ●

● ●● ●● ●●●● ●●●●

●● ●●●● ●● ● ●●

● ●●● ●● ● ●●● ●●● ● ● ●●

●●● ● ●●● ●●●

●● ● ●● ●● ●● ●● ●● ● ●

●●● ●●●● ●● ●● ●●●●● ●●● ● ●● ●

● ●● ● ●●● ●●● ●● ●●● ●● ●● ●● ●● ● ●● ●● ● ●●● ● ●●

●●● ●●● ●● ●●●●●● ●●●●● ●●● ●●● ●

●●● ●●●●● ● ●● ●●● ● ●● ●●● ●● ●●● ●●● ●● ●● ●●● ●●● ●

●● ● ●●● ●● ●● ●●● ● ●● ●●●● ● ●●● ●● ● ●● ●● ●●● ●●● ●●●● ●● ● ●●● ● ● ●● ●●●●● ● ●●● ●●● ●● ●●●

●● ●●● ●● ● ●● ●● ● ●●● ●● ●●● ●●●● ●●●●● ●● ● ●●● ●●●● ● ●● ●●● ●● ● ●●●● ●●●● ●● ●●●●● ●● ●●●●

● ●●●●● ●●● ●● ●● ●●●● ●●● ●● ●● ●●● ● ●● ●●● ●● ●●● ●● ●● ●● ●● ●●● ●● ● ●● ●● ● ●● ●● ●

●● ● ●● ● ●●●●● ● ● ●● ●● ● ●●●●● ●● ●●● ●●● ●● ● ●●●● ● ●● ● ●●●● ●●

●● ●●● ● ●●●●● ●● ● ●● ●● ●●● ●● ● ●●● ●●● ● ●● ● ● ●●● ●●●● ●● ●● ●● ●● ●

● ●●● ●●● ●●● ●● ● ●● ●●●●●● ● ●●● ●●●● ● ●●● ● ●●● ●● ● ● ●●● ●●● ● ●●● ●● ●●● ● ● ●●● ●● ●●●●●● ● ●●● ●●● ●● ●●●● ● ●● ●●●●● ●●●● ●● ●● ● ●

●●●● ●●● ●●●● ●●●● ● ●● ●● ● ●● ●●●●●●● ●●● ●●●● ●● ●● ●● ● ●●●● ● ●●● ● ●●● ● ●● ●●● ●●● ● ●●●●●● ●●● ●● ● ●● ● ●●● ●●●●● ●●● ●●● ●● ●● ●●●●

● ●● ●● ●●●●●● ●●● ●● ●●●●● ● ●● ●●● ● ●●●●● ●●● ●●● ●● ●●●●●● ●●● ●● ●

● ●● ● ●● ●● ●● ●● ●●● ●●●● ●●● ●●● ● ●● ● ●● ●● ●● ●● ●●● ●●●● ●● ●

●●●● ●● ● ●●●● ● ● ●● ●●● ●●● ●● ●● ●●● ● ●●● ●●● ●●● ●●● ●● ●●● ●● ●●● ●●● ●●●● ●●● ●● ●●● ●●

1 2 3 4 5 6 7

510

1520

jitter(educ)

inco

me

●●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 88 / 146

Page 310: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 311: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 312: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long as

I X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 313: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discrete

I there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 314: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of X

I a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 315: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variables

I a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 316: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 317: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 318: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 319: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression

This approach makes minimal assumptions

It works well as long asI X is discreteI there are a small number values of XI a small number of X variablesI a lot of observations at each X value

This method does not impose any specific functional form on therelationship between Y and X (i.e. the shape of E [Y |X ])

→ It is called a nonparametric regression

But what do we do when X is continuous and has many values?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 89 / 146

Page 320: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Continuous X

Consider the Chirot data:

Chirot, D. and C. Ragin (1975). The market, tradition and peasantrebellion: The case of Romania. American Sociological Review 40,428-444

Peasant Rebellions in Romanian counties in 1907

Peasants made up 80% of the population

About 60 % of them owned no land which was mostly concentratedamong large landowners

We’re interested in the relationship between:I Y : intensity of the peasant rebellionI X : inequality of land tenure

Around 11,000 peasants were killed by Romanian military

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 90 / 146

Page 321: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Continuous X

Consider the Chirot data:

Chirot, D. and C. Ragin (1975). The market, tradition and peasantrebellion: The case of Romania. American Sociological Review 40,428-444

Peasant Rebellions in Romanian counties in 1907

Peasants made up 80% of the population

About 60 % of them owned no land which was mostly concentratedamong large landowners

We’re interested in the relationship between:I Y : intensity of the peasant rebellionI X : inequality of land tenure

Around 11,000 peasants were killed by Romanian military

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 90 / 146

Page 322: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Continuous X

Consider the Chirot data:

Chirot, D. and C. Ragin (1975). The market, tradition and peasantrebellion: The case of Romania. American Sociological Review 40,428-444

Peasant Rebellions in Romanian counties in 1907

Peasants made up 80% of the population

About 60 % of them owned no land which was mostly concentratedamong large landowners

We’re interested in the relationship between:I Y : intensity of the peasant rebellionI X : inequality of land tenure

Around 11,000 peasants were killed by Romanian military

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 90 / 146

Page 323: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Continuous X

Consider the Chirot data:

Chirot, D. and C. Ragin (1975). The market, tradition and peasantrebellion: The case of Romania. American Sociological Review 40,428-444

Peasant Rebellions in Romanian counties in 1907

Peasants made up 80% of the population

About 60 % of them owned no land which was mostly concentratedamong large landowners

We’re interested in the relationship between:I Y : intensity of the peasant rebellionI X : inequality of land tenure

Around 11,000 peasants were killed by Romanian military

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 90 / 146

Page 324: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Continuous X

Consider the Chirot data:

Chirot, D. and C. Ragin (1975). The market, tradition and peasantrebellion: The case of Romania. American Sociological Review 40,428-444

Peasant Rebellions in Romanian counties in 1907

Peasants made up 80% of the population

About 60 % of them owned no land which was mostly concentratedamong large landowners

We’re interested in the relationship between:I Y : intensity of the peasant rebellionI X : inequality of land tenure

Around 11,000 peasants were killed by Romanian military

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 90 / 146

Page 325: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Nonparametric Regression with Continuous X

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

Regression of Intensity on Inequality

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 91 / 146

Page 326: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

One approach is to use a moving local average to estimate E [Y |X ]

Calculate the average of the observed y points that have x values in theinterval [x0 − h , x0 + h]

h = some positive number (called the bandwidth)

Uniform kernel: every observation in the interval is equally weighted

−2 −1 0 1 2

0.0

0.1

0.2

0.3

0.4

0.5

u

K_h

(u)

This gives the uniform kernel regression:

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =1

21{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 92 / 146

Page 327: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

One approach is to use a moving local average to estimate E [Y |X ]

Calculate the average of the observed y points that have x values in theinterval [x0 − h , x0 + h]

h = some positive number (called the bandwidth)

Uniform kernel: every observation in the interval is equally weighted

−2 −1 0 1 2

0.0

0.1

0.2

0.3

0.4

0.5

u

K_h

(u)

This gives the uniform kernel regression:

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =1

21{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 92 / 146

Page 328: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

One approach is to use a moving local average to estimate E [Y |X ]

Calculate the average of the observed y points that have x values in theinterval [x0 − h , x0 + h]

h = some positive number (called the bandwidth)

Uniform kernel: every observation in the interval is equally weighted

−2 −1 0 1 2

0.0

0.1

0.2

0.3

0.4

0.5

u

K_h

(u)

This gives the uniform kernel regression:

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =1

21{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 92 / 146

Page 329: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

One approach is to use a moving local average to estimate E [Y |X ]

Calculate the average of the observed y points that have x values in theinterval [x0 − h , x0 + h]

h = some positive number (called the bandwidth)

Uniform kernel: every observation in the interval is equally weighted

−2 −1 0 1 2

0.0

0.1

0.2

0.3

0.4

0.5

u

K_h

(u)

This gives the uniform kernel regression:

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =1

21{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 92 / 146

Page 330: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

One approach is to use a moving local average to estimate E [Y |X ]

Calculate the average of the observed y points that have x values in theinterval [x0 − h , x0 + h]

h = some positive number (called the bandwidth)

Uniform kernel: every observation in the interval is equally weighted

−2 −1 0 1 2

0.0

0.1

0.2

0.3

0.4

0.5

u

K_h

(u)

This gives the uniform kernel regression:

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =1

21{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 92 / 146

Page 331: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

One approach is to use a moving local average to estimate E [Y |X ]

Calculate the average of the observed y points that have x values in theinterval [x0 − h , x0 + h]

h = some positive number (called the bandwidth)

Uniform kernel: every observation in the interval is equally weighted

−2 −1 0 1 2

0.0

0.1

0.2

0.3

0.4

0.5

u

K_h

(u)

This gives the uniform kernel regression:

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =1

21{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 92 / 146

Page 332: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 93 / 146

Page 333: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

●x

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 93 / 146

Page 334: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

●●

x

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 93 / 146

Page 335: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Uniform Kernel Regression: Simple Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 93 / 146

Page 336: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Changing the Bandwidth

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Changing the Bandwidth

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 94 / 146

Page 337: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Changing the Bandwidth

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Changing the Bandwidth

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 94 / 146

Page 338: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Changing the Bandwidth

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Changing the Bandwidth

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

●●

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 94 / 146

Page 339: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Changing the Bandwidth

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Changing the Bandwidth

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 94 / 146

Page 340: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Another approach is to construct weighted local averages

Data points that are closer to x0 get more weight than points farther away

1 decide on a symmetric, non-negative kernel weight function Kh (e.g.Epanechnikov)

−2 −1 0 1 2

0.0

0.2

0.4

0.6

u

K_h

(u)

2 compute weighted average of the observed y points that have x values inthe bandwidth interval [x0 − h , x0 + h] e.g.

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =3

4(1− u2) 1{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 95 / 146

Page 341: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Another approach is to construct weighted local averages

Data points that are closer to x0 get more weight than points farther away

1 decide on a symmetric, non-negative kernel weight function Kh (e.g.Epanechnikov)

−2 −1 0 1 2

0.0

0.2

0.4

0.6

u

K_h

(u)

2 compute weighted average of the observed y points that have x values inthe bandwidth interval [x0 − h , x0 + h] e.g.

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =3

4(1− u2) 1{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 95 / 146

Page 342: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Another approach is to construct weighted local averages

Data points that are closer to x0 get more weight than points farther away

1 decide on a symmetric, non-negative kernel weight function Kh (e.g.Epanechnikov)

−2 −1 0 1 2

0.0

0.2

0.4

0.6

u

K_h

(u)

2 compute weighted average of the observed y points that have x values inthe bandwidth interval [x0 − h , x0 + h] e.g.

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =3

4(1− u2) 1{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 95 / 146

Page 343: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Another approach is to construct weighted local averages

Data points that are closer to x0 get more weight than points farther away

1 decide on a symmetric, non-negative kernel weight function Kh (e.g.Epanechnikov)

−2 −1 0 1 2

0.0

0.2

0.4

0.6

u

K_h

(u)

2 compute weighted average of the observed y points that have x values inthe bandwidth interval [x0 − h , x0 + h] e.g.

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =3

4(1− u2) 1{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 95 / 146

Page 344: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Another approach is to construct weighted local averages

Data points that are closer to x0 get more weight than points farther away

1 decide on a symmetric, non-negative kernel weight function Kh (e.g.Epanechnikov)

−2 −1 0 1 2

0.0

0.2

0.4

0.6

u

K_h

(u)

2 compute weighted average of the observed y points that have x values inthe bandwidth interval [x0 − h , x0 + h] e.g.

E [Y |X = x0] =

∑Ni=1 Kh((Xi − x0)/h)Yi∑Ni=1 Kh((Xi − x0)/h)

where Kh(u) =3

4(1− u2) 1{|u|≤1}

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 95 / 146

Page 345: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 96 / 146

Page 346: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 96 / 146

Page 347: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 96 / 146

Page 348: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Kernel Regression: Weighted Local Averages

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Averages

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 96 / 146

Page 349: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Changing the Bandwidth

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Changing the Bandwidth

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 97 / 146

Page 350: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Changing the Bandwidth

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Changing the Bandwidth

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 97 / 146

Page 351: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

When choosing an estimator E [Y |X ] for E [Y |X ], we face abias-variance tradeoff

Notice that we can chose models with various levels of flexibility:I A very flexible estimator allows the shape of the function to vary (e.g.

a kernel regression with a small bandwidth)

I A very inflexible estimator restricts the shape of the function to aparticular form(e.g. a kernel regression with a very wide bandwidth)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 98 / 146

Page 352: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

When choosing an estimator E [Y |X ] for E [Y |X ], we face abias-variance tradeoff

Notice that we can chose models with various levels of flexibility:I A very flexible estimator allows the shape of the function to vary (e.g.

a kernel regression with a small bandwidth)

I A very inflexible estimator restricts the shape of the function to aparticular form(e.g. a kernel regression with a very wide bandwidth)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 98 / 146

Page 353: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

When choosing an estimator E [Y |X ] for E [Y |X ], we face abias-variance tradeoff

Notice that we can chose models with various levels of flexibility:

I A very flexible estimator allows the shape of the function to vary (e.g.a kernel regression with a small bandwidth)

I A very inflexible estimator restricts the shape of the function to aparticular form(e.g. a kernel regression with a very wide bandwidth)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 98 / 146

Page 354: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

When choosing an estimator E [Y |X ] for E [Y |X ], we face abias-variance tradeoff

Notice that we can chose models with various levels of flexibility:I A very flexible estimator allows the shape of the function to vary (e.g.

a kernel regression with a small bandwidth)

I A very inflexible estimator restricts the shape of the function to aparticular form(e.g. a kernel regression with a very wide bandwidth)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 98 / 146

Page 355: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

When choosing an estimator E [Y |X ] for E [Y |X ], we face abias-variance tradeoff

Notice that we can chose models with various levels of flexibility:I A very flexible estimator allows the shape of the function to vary (e.g.

a kernel regression with a small bandwidth)

I A very inflexible estimator restricts the shape of the function to aparticular form(e.g. a kernel regression with a very wide bandwidth)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 98 / 146

Page 356: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothetical True Distribution

Let’s conduct a simulation experiment to actually see the tradeoff

Suppose we have the following population distribution:

x

y

f(y|x)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 99 / 146

Page 357: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothetical True Distribution

Let’s conduct a simulation experiment to actually see the tradeoff

Suppose we have the following population distribution:

x

y

f(y|x)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 99 / 146

Page 358: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothetical True Distribution

Let’s conduct a simulation experiment to actually see the tradeoff

Suppose we have the following population distribution:

x

y

f(y|x)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 99 / 146

Page 359: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothetical True Distribution

Another way of representing the same population distribution:

0.3 0.4 0.5 0.6 0.7

−1

01

23

4

x

y

●● ●

●●

●●

From this distribution we draw thousands of simulated data sets.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 100 / 146

Page 360: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothetical True Distribution

Another way of representing the same population distribution:

0.3 0.4 0.5 0.6 0.7

−1

01

23

4

x

y

●● ●

●●

●●

From this distribution we draw thousands of simulated data sets.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 100 / 146

Page 361: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Hypothetical True Distribution

Another way of representing the same population distribution:

0.3 0.4 0.5 0.6 0.7

−1

01

23

4

x

y

●● ●

●●

●●

From this distribution we draw thousands of simulated data sets.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 100 / 146

Page 362: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

An Example of Simulated Data Set

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

● ●

●●

●●

● ●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 101 / 146

Page 363: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two Estimators

For each simulated data, we apply two simple estimators of E (Y |X ):I Divide X into 4 ranges and take the mean for eachI Divide X into 8 ranges and take the mean for each

We then evaluate how well these estimators do in terms of bias and variance.

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

4−fold Interval Estimator

inequality

inte

nsity

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

8−fold Interval Estimator

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 102 / 146

Page 364: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two Estimators

For each simulated data, we apply two simple estimators of E (Y |X ):

I Divide X into 4 ranges and take the mean for eachI Divide X into 8 ranges and take the mean for each

We then evaluate how well these estimators do in terms of bias and variance.

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

4−fold Interval Estimator

inequality

inte

nsity

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

8−fold Interval Estimator

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 102 / 146

Page 365: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two Estimators

For each simulated data, we apply two simple estimators of E (Y |X ):I Divide X into 4 ranges and take the mean for each

I Divide X into 8 ranges and take the mean for each

We then evaluate how well these estimators do in terms of bias and variance.

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

4−fold Interval Estimator

inequality

inte

nsity

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

8−fold Interval Estimator

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 102 / 146

Page 366: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two Estimators

For each simulated data, we apply two simple estimators of E (Y |X ):I Divide X into 4 ranges and take the mean for eachI Divide X into 8 ranges and take the mean for each

We then evaluate how well these estimators do in terms of bias and variance.

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

4−fold Interval Estimator

inequality

inte

nsity

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

8−fold Interval Estimator

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 102 / 146

Page 367: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two Estimators

For each simulated data, we apply two simple estimators of E (Y |X ):I Divide X into 4 ranges and take the mean for eachI Divide X into 8 ranges and take the mean for each

We then evaluate how well these estimators do in terms of bias and variance.

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

4−fold Interval Estimator

inequality

inte

nsity

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

8−fold Interval Estimator

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 102 / 146

Page 368: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Two Estimators

For each simulated data, we apply two simple estimators of E (Y |X ):I Divide X into 4 ranges and take the mean for eachI Divide X into 8 ranges and take the mean for each

We then evaluate how well these estimators do in terms of bias and variance.

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

4−fold Interval Estimator

inequality

inte

nsity

●●

●● ●●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

01

23

4

8−fold Interval Estimator

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 102 / 146

Page 369: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Simulated Distribution of Estimates: 4 Intervals

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 103 / 146

Page 370: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Simulated Distribution of Estimates: 8 Intervals

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 104 / 146

Page 371: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

A less “flexible” estimator leads to more bias

A more “flexible” estimator leads to more variance

As the name suggests, this problem cannot be “fixed”

If we have more data or fewer variables we can “afford” to use a moreflexible estimator

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 105 / 146

Page 372: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

A less “flexible” estimator leads to more bias

A more “flexible” estimator leads to more variance

As the name suggests, this problem cannot be “fixed”

If we have more data or fewer variables we can “afford” to use a moreflexible estimator

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 105 / 146

Page 373: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

A less “flexible” estimator leads to more bias

A more “flexible” estimator leads to more variance

As the name suggests, this problem cannot be “fixed”

If we have more data or fewer variables we can “afford” to use a moreflexible estimator

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 105 / 146

Page 374: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

A less “flexible” estimator leads to more bias

A more “flexible” estimator leads to more variance

As the name suggests, this problem cannot be “fixed”

If we have more data or fewer variables we can “afford” to use a moreflexible estimator

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 105 / 146

Page 375: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Bias-Variance Tradeoff

A less “flexible” estimator leads to more bias

A more “flexible” estimator leads to more variance

As the name suggests, this problem cannot be “fixed”

If we have more data or fewer variables we can “afford” to use a moreflexible estimator

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 105 / 146

Page 376: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 106 / 146

Page 377: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 106 / 146

Page 378: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 379: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 380: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 381: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 382: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 383: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 384: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:

I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 385: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 386: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 387: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Linear regression works by assuming linear parametric form for theconditional expectation function:

E [Y |X ] = β0 + X β1

Conditional expectation defined by only two coefficients which areestimated from the data:

I β0 is called the intercept or constantI β1 is called the slope coefficient

Notice that the linear functional form imposes a constant slope

Assumption: Change in E [Y |X ] is the same at all values of X

Geometrically, the linear regression function will look like:I A line in cases with a single X variable

I A plane in cases with two X variables

I A hyperplane in cases with more than two X variables

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 107 / 146

Page 388: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Regression Line: intensity = −3.2 + inequality 5.1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 108 / 146

Page 389: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Warning: the model won’t always be a good fit for the data(even though it really wants to be)

Figure: ‘If I fits, I sits’

Linear regression always returns a line regardless of the data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 109 / 146

Page 390: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Warning: the model won’t always be a good fit for the data(even though it really wants to be)

Figure: ‘If I fits, I sits’

Linear regression always returns a line regardless of the data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 109 / 146

Page 391: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Warning: the model won’t always be a good fit for the data(even though it really wants to be)

Figure: ‘If I fits, I sits’

Linear regression always returns a line regardless of the data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 109 / 146

Page 392: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Parametric Approach: Linear Regression

Warning: the model won’t always be a good fit for the data(even though it really wants to be)

Figure: ‘If I fits, I sits’

Linear regression always returns a line regardless of the data.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 109 / 146

Page 393: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 394: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) =

β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 395: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) =

β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 396: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) =

β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 397: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 =

β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 398: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 399: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 400: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 401: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 402: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 403: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Interpretation of the regression slope

When we model the regression function as a line, we can interpret theparameters of the line in appealing ways:

1 Intercept: the average outcome among units with X = 0 is β0:

E [Y |X = 0] = r(0) = β0 + β10 = β0

2 Slope: a one-unit change in X is associated with a β1 change in Y

E [Y |X = x + 1]− E [Y |X = x ] = r(x + 1)− r(x)

= (β0 + β1(x + 1))− (β0 + β1x)

= β0+β1x + β1−β0−β1x

= β1

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 110 / 146

Page 404: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear regression with a binary covariate

Using the two facts above, it’s easy to see that when X is binary, thenwe have the following:

1 Intercept: E [Y |X = 0] = β0

2 Slope: average difference between X = 1 group and X = 0 group:β1 = E [Y |X = 1]− E [Y |X = 0]

Thus, we can read off the difference in means between two groups asthe slope coefficient on a linear regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 111 / 146

Page 405: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear regression with a binary covariate

Using the two facts above, it’s easy to see that when X is binary, thenwe have the following:

1 Intercept: E [Y |X = 0] = β0

2 Slope: average difference between X = 1 group and X = 0 group:β1 = E [Y |X = 1]− E [Y |X = 0]

Thus, we can read off the difference in means between two groups asthe slope coefficient on a linear regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 111 / 146

Page 406: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear regression with a binary covariate

Using the two facts above, it’s easy to see that when X is binary, thenwe have the following:

1 Intercept: E [Y |X = 0] = β0

2 Slope: average difference between X = 1 group and X = 0 group:β1 = E [Y |X = 1]− E [Y |X = 0]

Thus, we can read off the difference in means between two groups asthe slope coefficient on a linear regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 111 / 146

Page 407: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear regression with a binary covariate

Using the two facts above, it’s easy to see that when X is binary, thenwe have the following:

1 Intercept: E [Y |X = 0] = β0

2 Slope: average difference between X = 1 group and X = 0 group:β1 = E [Y |X = 1]− E [Y |X = 0]

Thus, we can read off the difference in means between two groups asthe slope coefficient on a linear regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 111 / 146

Page 408: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear regression with a binary covariate

Using the two facts above, it’s easy to see that when X is binary, thenwe have the following:

1 Intercept: E [Y |X = 0] = β0

2 Slope: average difference between X = 1 group and X = 0 group:β1 = E [Y |X = 1]− E [Y |X = 0]

Thus, we can read off the difference in means between two groups asthe slope coefficient on a linear regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 111 / 146

Page 409: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear CEF with a binary covariate

0.0 0.5 1.0

67

89

10

Africa

Log

GD

P p

er

cap

ita g

row

th

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 112 / 146

Page 410: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear CEF with a binary covariate

0.0 0.5 1.0

67

89

10

Africa

Log

GD

P p

er

capit

a g

row

th

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 112 / 146

Page 411: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 113 / 146

Page 412: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 113 / 146

Page 413: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 414: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 415: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 416: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):

1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 417: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 418: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 419: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

LOESS

We can combine the nonparametric kernel method idea of using onlylocal data with a parametric model

Idea: fit a linear regression within each band

Locally weighted scatterplot smoothing (LOWESS or LOESS):1 Pick a subset of the data that falls in the interval [x − h , x + h]

2 Fit a line to this subset of the data (= local linear regression),weighting the points by their distance to x using a kernel function

3 Use the fitted regression line to predict the expected value ofE [Y |X = x0]

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 114 / 146

Page 420: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Weighted Local Linear Regressions

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Regressions

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 115 / 146

Page 421: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Weighted Local Linear Regressions

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Regressions

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 115 / 146

Page 422: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Weighted Local Linear Regressions

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Regressions

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

x

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 115 / 146

Page 423: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Weighted Local Linear Regressions

Regression as an Asymmetric Summary of Bivariate DataRegression as a Model of Conditional Expectation

Linear Regression

Weighted Local Regressions

●● ●

●●

●●

0.3 0.4 0.5 0.6 0.7

−2

−1

01

23

4

inequality

inte

nsity

Adam Glynn Gov2000: Quantitative Methodology for Political Science I

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 115 / 146

Page 424: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 116 / 146

Page 425: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 116 / 146

Page 426: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Back up and review

To review our approach:

I We wanted to estimate the CEF/regression functionr(x) = E [Y |X = x ], but it may be too hard to do nonparametrically

I So we can model it: place restrictions on its functional form.I Easiest functional form is a line:

r(x) = β0 + β1x

β0 and β1 are population parameters just like µ or σ2!

Need to estimate them in our samples! But how?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 117 / 146

Page 427: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Back up and review

To review our approach:

I We wanted to estimate the CEF/regression functionr(x) = E [Y |X = x ], but it may be too hard to do nonparametrically

I So we can model it: place restrictions on its functional form.I Easiest functional form is a line:

r(x) = β0 + β1x

β0 and β1 are population parameters just like µ or σ2!

Need to estimate them in our samples! But how?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 117 / 146

Page 428: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Back up and review

To review our approach:

I We wanted to estimate the CEF/regression functionr(x) = E [Y |X = x ], but it may be too hard to do nonparametrically

I So we can model it: place restrictions on its functional form.

I Easiest functional form is a line:

r(x) = β0 + β1x

β0 and β1 are population parameters just like µ or σ2!

Need to estimate them in our samples! But how?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 117 / 146

Page 429: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Back up and review

To review our approach:

I We wanted to estimate the CEF/regression functionr(x) = E [Y |X = x ], but it may be too hard to do nonparametrically

I So we can model it: place restrictions on its functional form.I Easiest functional form is a line:

r(x) = β0 + β1x

β0 and β1 are population parameters just like µ or σ2!

Need to estimate them in our samples! But how?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 117 / 146

Page 430: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Back up and review

To review our approach:

I We wanted to estimate the CEF/regression functionr(x) = E [Y |X = x ], but it may be too hard to do nonparametrically

I So we can model it: place restrictions on its functional form.I Easiest functional form is a line:

r(x) = β0 + β1x

β0 and β1 are population parameters just like µ or σ2!

Need to estimate them in our samples! But how?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 117 / 146

Page 431: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Back up and review

To review our approach:

I We wanted to estimate the CEF/regression functionr(x) = E [Y |X = x ], but it may be too hard to do nonparametrically

I So we can model it: place restrictions on its functional form.I Easiest functional form is a line:

r(x) = β0 + β1x

β0 and β1 are population parameters just like µ or σ2!

Need to estimate them in our samples! But how?

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 117 / 146

Page 432: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Simple linear regression model

Let’s write our model as:

Yi = r(Xi ) + ui

Yi = β0 + β1Xi + ui

Now, suppose we have some estimates of the slope, β1, and theintercept, β0. Then the fitted or sample regression line is

r(x) = β0 + β1x

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 118 / 146

Page 433: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Simple linear regression model

Let’s write our model as:

Yi = r(Xi ) + ui

Yi = β0 + β1Xi + ui

Now, suppose we have some estimates of the slope, β1, and theintercept, β0. Then the fitted or sample regression line is

r(x) = β0 + β1x

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 118 / 146

Page 434: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Simple linear regression model

Let’s write our model as:

Yi = r(Xi ) + ui

Yi = β0 + β1Xi + ui

Now, suppose we have some estimates of the slope, β1, and theintercept, β0. Then the fitted or sample regression line is

r(x) = β0 + β1x

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 118 / 146

Page 435: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted linear CEF/regression function

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

r(x)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 119 / 146

Page 436: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted linear CEF/regression function

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

r(x)

ralt(x)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 120 / 146

Page 437: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted values and residuals

Definition (Fitted Value)

A fitted value or predicted value is the estimated conditional mean of Yi

for a particular observation with independent variable Xi :

Yi = r(Xi ) = β0 + β1Xi

Definition (Residual)

The residual is the difference between the actual value of Yi and thepredicted value, Yi :

ui = Yi − Yi = Yi − β0 − β1Xi

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 121 / 146

Page 438: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted values and residuals

Definition (Fitted Value)

A fitted value or predicted value is the estimated conditional mean of Yi

for a particular observation with independent variable Xi :

Yi = r(Xi ) = β0 + β1Xi

Definition (Residual)

The residual is the difference between the actual value of Yi and thepredicted value, Yi :

ui = Yi − Yi = Yi − β0 − β1Xi

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 121 / 146

Page 439: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted values and residuals

Definition (Fitted Value)

A fitted value or predicted value is the estimated conditional mean of Yi

for a particular observation with independent variable Xi :

Yi = r(Xi ) = β0 + β1Xi

Definition (Residual)

The residual is the difference between the actual value of Yi and thepredicted value, Yi :

ui = Yi − Yi = Yi − β0 − β1Xi

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 121 / 146

Page 440: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted linear CEF/regression function

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

r(x)

KORYi

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 122 / 146

Page 441: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted linear CEF/regression function

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

r(x)

KORYi

Yi

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 123 / 146

Page 442: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fitted linear CEF/regression function

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

r(x)

KORYi

Yi

ui = Yi − Yi

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 124 / 146

Page 443: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Why not this line?

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

ralt(x)KOR

ui = Yi − Yi ≈ 0

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 125 / 146

Page 444: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimize the residuals

The residuals, ui = Yi − β0 − β1Xi , tell us how well the line fits thedata.

I Larger magnitude residuals means that points are very far from the lineI Residuals close to 0 mean points very close to the line

The smaller the magnitude of the residuals, the better we are doing atpredicting Y

Choose the line that minimizes the residuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 126 / 146

Page 445: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimize the residuals

The residuals, ui = Yi − β0 − β1Xi , tell us how well the line fits thedata.

I Larger magnitude residuals means that points are very far from the lineI Residuals close to 0 mean points very close to the line

The smaller the magnitude of the residuals, the better we are doing atpredicting Y

Choose the line that minimizes the residuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 126 / 146

Page 446: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimize the residuals

The residuals, ui = Yi − β0 − β1Xi , tell us how well the line fits thedata.

I Larger magnitude residuals means that points are very far from the line

I Residuals close to 0 mean points very close to the line

The smaller the magnitude of the residuals, the better we are doing atpredicting Y

Choose the line that minimizes the residuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 126 / 146

Page 447: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimize the residuals

The residuals, ui = Yi − β0 − β1Xi , tell us how well the line fits thedata.

I Larger magnitude residuals means that points are very far from the lineI Residuals close to 0 mean points very close to the line

The smaller the magnitude of the residuals, the better we are doing atpredicting Y

Choose the line that minimizes the residuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 126 / 146

Page 448: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimize the residuals

The residuals, ui = Yi − β0 − β1Xi , tell us how well the line fits thedata.

I Larger magnitude residuals means that points are very far from the lineI Residuals close to 0 mean points very close to the line

The smaller the magnitude of the residuals, the better we are doing atpredicting Y

Choose the line that minimizes the residuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 126 / 146

Page 449: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimize the residuals

The residuals, ui = Yi − β0 − β1Xi , tell us how well the line fits thedata.

I Larger magnitude residuals means that points are very far from the lineI Residuals close to 0 mean points very close to the line

The smaller the magnitude of the residuals, the better we are doing atpredicting Y

Choose the line that minimizes the residuals

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 126 / 146

Page 450: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Which is better at minimizing residuals?

1 2 3 4 5 6 7 8

6

7

8

9

10

Log Settler Mortality

Log G

DP p

er

capit

a g

row

th

r(x)

ralt(x)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 127 / 146

Page 451: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimizing the residuals

Let β0 and β1 be possible values of the intercept and slope

Least absolute deviations (LAD) regression:

(βLAD0 , βLAD1 ) = arg minβ0,β1

n∑i=1

|Yi − β0 − β1Xi |

Least squares (LS) regression:

(β0, β1) = arg minβ0,β1

n∑i=1

(Yi − β0 − β1Xi )2

Sometimes called ordinary least squares (OLS)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 128 / 146

Page 452: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimizing the residuals

Let β0 and β1 be possible values of the intercept and slope

Least absolute deviations (LAD) regression:

(βLAD0 , βLAD1 ) = arg minβ0,β1

n∑i=1

|Yi − β0 − β1Xi |

Least squares (LS) regression:

(β0, β1) = arg minβ0,β1

n∑i=1

(Yi − β0 − β1Xi )2

Sometimes called ordinary least squares (OLS)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 128 / 146

Page 453: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimizing the residuals

Let β0 and β1 be possible values of the intercept and slope

Least absolute deviations (LAD) regression:

(βLAD0 , βLAD1 ) = arg minβ0,β1

n∑i=1

|Yi − β0 − β1Xi |

Least squares (LS) regression:

(β0, β1) = arg minβ0,β1

n∑i=1

(Yi − β0 − β1Xi )2

Sometimes called ordinary least squares (OLS)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 128 / 146

Page 454: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimizing the residuals

Let β0 and β1 be possible values of the intercept and slope

Least absolute deviations (LAD) regression:

(βLAD0 , βLAD1 ) = arg minβ0,β1

n∑i=1

|Yi − β0 − β1Xi |

Least squares (LS) regression:

(β0, β1) = arg minβ0,β1

n∑i=1

(Yi − β0 − β1Xi )2

Sometimes called ordinary least squares (OLS)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 128 / 146

Page 455: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Minimizing the residuals

Let β0 and β1 be possible values of the intercept and slope

Least absolute deviations (LAD) regression:

(βLAD0 , βLAD1 ) = arg minβ0,β1

n∑i=1

|Yi − β0 − β1Xi |

Least squares (LS) regression:

(β0, β1) = arg minβ0,β1

n∑i=1

(Yi − β0 − β1Xi )2

Sometimes called ordinary least squares (OLS)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 128 / 146

Page 456: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Why least squares?

Easy to derive the least squares estimator

Easy to investigate the properties of the least squares estimator

Least squares is optimal in a certain sense that we’ll see in the comingweeks

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 129 / 146

Page 457: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Why least squares?

Easy to derive the least squares estimator

Easy to investigate the properties of the least squares estimator

Least squares is optimal in a certain sense that we’ll see in the comingweeks

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 129 / 146

Page 458: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Why least squares?

Easy to derive the least squares estimator

Easy to investigate the properties of the least squares estimator

Least squares is optimal in a certain sense that we’ll see in the comingweeks

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 129 / 146

Page 459: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Why least squares?

Easy to derive the least squares estimator

Easy to investigate the properties of the least squares estimator

Least squares is optimal in a certain sense that we’ll see in the comingweeks

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 129 / 146

Page 460: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 461: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 462: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 463: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 464: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 465: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 466: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 467: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression: Justification

Linear regression imposes a strong assumption on E [Y |X ]

Why would we ever want to do this?

I Theoretical reason to assume linearity

I Ease of interpretation

I Bias-variance tradeoff

I Analytical derivation of sampling distributions (next few weeks)

I We can make the model more flexible, even in a linear framework (e.g.we can add polynomials, use log transformations, etc.)

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 130 / 146

Page 468: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 131 / 146

Page 469: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

1 Testing: Making DecisionsHypothesis testingForming rejection regionsP-values

2 Review: Steps of Hypothesis Testing

3 The Significance of Significance

4 Preview: What is Regression

5 Fun With Salmon

6 Bonus Example

7 Nonparametric RegressionDiscrete XContinuous XBias-Variance Tradeoff

8 Linear RegressionCombining Linear Regression with Nonparametric RegressionLeast Squares

9 Interpreting Regression

10 Fun With Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 131 / 146

Page 470: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression as a Predictive Model

Linear regression can also be used to predict new observations

Basic idea:I Find estimates β0, β1 of β0, β1 based on the in-sample dataI To find the expected value of Y for an out-of-sample data point with

X = xnew calculate:

E [Y |X = xnew ] = β0 + β1xnew

While the line is defined over all regions of the data we may beconcerned about:

I interpolationI extrapolationI predicting in ranges of X with sparse data

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 132 / 146

Page 471: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression as a Predictive Model

Linear regression can also be used to predict new observations

Basic idea:I Find estimates β0, β1 of β0, β1 based on the in-sample dataI To find the expected value of Y for an out-of-sample data point with

X = xnew calculate:

E [Y |X = xnew ] = β0 + β1xnew

While the line is defined over all regions of the data we may beconcerned about:

I interpolationI extrapolationI predicting in ranges of X with sparse data

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 132 / 146

Page 472: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression as a Predictive Model

Linear regression can also be used to predict new observations

Basic idea:

I Find estimates β0, β1 of β0, β1 based on the in-sample dataI To find the expected value of Y for an out-of-sample data point with

X = xnew calculate:

E [Y |X = xnew ] = β0 + β1xnew

While the line is defined over all regions of the data we may beconcerned about:

I interpolationI extrapolationI predicting in ranges of X with sparse data

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 132 / 146

Page 473: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression as a Predictive Model

Linear regression can also be used to predict new observations

Basic idea:I Find estimates β0, β1 of β0, β1 based on the in-sample data

I To find the expected value of Y for an out-of-sample data point withX = xnew calculate:

E [Y |X = xnew ] = β0 + β1xnew

While the line is defined over all regions of the data we may beconcerned about:

I interpolationI extrapolationI predicting in ranges of X with sparse data

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 132 / 146

Page 474: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression as a Predictive Model

Linear regression can also be used to predict new observations

Basic idea:I Find estimates β0, β1 of β0, β1 based on the in-sample dataI To find the expected value of Y for an out-of-sample data point with

X = xnew calculate:

E [Y |X = xnew ] = β0 + β1xnew

While the line is defined over all regions of the data we may beconcerned about:

I interpolationI extrapolationI predicting in ranges of X with sparse data

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 132 / 146

Page 475: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Linear Regression as a Predictive Model

Linear regression can also be used to predict new observations

Basic idea:I Find estimates β0, β1 of β0, β1 based on the in-sample dataI To find the expected value of Y for an out-of-sample data point with

X = xnew calculate:

E [Y |X = xnew ] = β0 + β1xnew

While the line is defined over all regions of the data we may beconcerned about:

I interpolationI extrapolationI predicting in ranges of X with sparse data

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 132 / 146

Page 476: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Which Predictions Do You Trust?

●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●

●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●

●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 133 / 146

Page 477: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Which Predictions Do You Trust?

●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●

●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●

●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●●

●●

●●

●● ●

● ●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ● ●●●

−10 0 5 10

−10

010

x

y

●●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 133 / 146

Page 478: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example: Tatem, et al. Sprinters Data

In a 2004 Nature article, Tatem et al. use linear regression to concludethat in the year 2156 the winner of the women’s Olympic 100 meter sprintmay likely have a faster time than the winner of the men’s Olympic 100meter sprint.

How do the authors make this conclusion?

Using data from 1900 to 2004, they fit linear regression models of thewinning 100 meter time on year for both men and women. They then usethe estimates from these models to extrapolate 152 years into the future.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 134 / 146

Page 479: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example: Tatem, et al. Sprinters Data

In a 2004 Nature article, Tatem et al. use linear regression to concludethat in the year 2156 the winner of the women’s Olympic 100 meter sprintmay likely have a faster time than the winner of the men’s Olympic 100meter sprint.

How do the authors make this conclusion?

Using data from 1900 to 2004, they fit linear regression models of thewinning 100 meter time on year for both men and women. They then usethe estimates from these models to extrapolate 152 years into the future.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 134 / 146

Page 480: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example: Tatem, et al. Sprinters Data

In a 2004 Nature article, Tatem et al. use linear regression to concludethat in the year 2156 the winner of the women’s Olympic 100 meter sprintmay likely have a faster time than the winner of the men’s Olympic 100meter sprint.

How do the authors make this conclusion?

Using data from 1900 to 2004, they fit linear regression models of thewinning 100 meter time on year for both men and women. They then usethe estimates from these models to extrapolate 152 years into the future.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 134 / 146

Page 481: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Example: Tatem, et al. Sprinters Data

In a 2004 Nature article, Tatem et al. use linear regression to concludethat in the year 2156 the winner of the women’s Olympic 100 meter sprintmay likely have a faster time than the winner of the men’s Olympic 100meter sprint.

How do the authors make this conclusion?

Using data from 1900 to 2004, they fit linear regression models of thewinning 100 meter time on year for both men and women. They then usethe estimates from these models to extrapolate 152 years into the future.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 134 / 146

Page 482: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Tatem et al. Extrapolation

●●●● ●

●●

●● ●●●

●●●

●●●

●●●●●●

1900 1950 2000 2050 2100 2150 2200 2250

67

89

1011

1213

year

win

ning

tim

e (s

)●

●●

●●●●●

●●●●

Tatem et al.’s predictions. Men’s times are in blue, women’s times are in red.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 135 / 146

Page 483: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Alternate Models Fit Well, Yield Different Predictions

●●●● ●

●●

●● ●●●

●●●

●●●

●●●●●●

1900 1950 2000 2050 2100 2150 2200 2250

67

89

1011

1213

year

win

ning

tim

e (s

)●

●●

●●●●●

●●●●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 136 / 146

Page 484: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Alternate Models Fit Well, Yield Different Predictions

●●●● ●

●●

●● ●●●

●●●

●●●

●●●●●●

1900 1950 2000 2050 2100 2150 2200 2250

67

89

1011

1213

year

win

ning

tim

e (s

)●

●●

●●●●●

●●●●

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 136 / 146

Page 485: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Trouble with Extrapolation

The model only gives the best fitting line where we have data, it sayslittle about the shape where there isn’t any data.

We can always ask illogical questions and the model gives answers.I For example, when will women finish the sprint in negative time?

Fundamentally we are assuming that data outside the sample lookslike data inside the sample, and the further away it is the less likelythat is to hold.

Next semester we will talk about how this problem gets much harderin high dimensions

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 137 / 146

Page 486: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Trouble with Extrapolation

The model only gives the best fitting line where we have data, it sayslittle about the shape where there isn’t any data.

We can always ask illogical questions and the model gives answers.I For example, when will women finish the sprint in negative time?

Fundamentally we are assuming that data outside the sample lookslike data inside the sample, and the further away it is the less likelythat is to hold.

Next semester we will talk about how this problem gets much harderin high dimensions

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 137 / 146

Page 487: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Trouble with Extrapolation

The model only gives the best fitting line where we have data, it sayslittle about the shape where there isn’t any data.

We can always ask illogical questions and the model gives answers.

I For example, when will women finish the sprint in negative time?

Fundamentally we are assuming that data outside the sample lookslike data inside the sample, and the further away it is the less likelythat is to hold.

Next semester we will talk about how this problem gets much harderin high dimensions

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 137 / 146

Page 488: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Trouble with Extrapolation

The model only gives the best fitting line where we have data, it sayslittle about the shape where there isn’t any data.

We can always ask illogical questions and the model gives answers.I For example, when will women finish the sprint in negative time?

Fundamentally we are assuming that data outside the sample lookslike data inside the sample, and the further away it is the less likelythat is to hold.

Next semester we will talk about how this problem gets much harderin high dimensions

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 137 / 146

Page 489: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Trouble with Extrapolation

The model only gives the best fitting line where we have data, it sayslittle about the shape where there isn’t any data.

We can always ask illogical questions and the model gives answers.I For example, when will women finish the sprint in negative time?

Fundamentally we are assuming that data outside the sample lookslike data inside the sample, and the further away it is the less likelythat is to hold.

Next semester we will talk about how this problem gets much harderin high dimensions

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 137 / 146

Page 490: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Trouble with Extrapolation

The model only gives the best fitting line where we have data, it sayslittle about the shape where there isn’t any data.

We can always ask illogical questions and the model gives answers.I For example, when will women finish the sprint in negative time?

Fundamentally we are assuming that data outside the sample lookslike data inside the sample, and the further away it is the less likelythat is to hold.

Next semester we will talk about how this problem gets much harderin high dimensions

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 137 / 146

Page 491: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A More Subtle Example

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 138 / 146

Page 492: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A More Subtle Example

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 138 / 146

Page 493: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

A More Subtle Example

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 138 / 146

Page 494: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as Description/Prediction

Even for simple problems regression can be challenging

Always think about where we have data and what we are using tobuild our claims

Summary: ‘prediction is hard, especially about the future’

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 139 / 146

Page 495: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as Description/Prediction

Even for simple problems regression can be challenging

Always think about where we have data and what we are using tobuild our claims

Summary: ‘prediction is hard, especially about the future’

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 139 / 146

Page 496: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as Description/Prediction

Even for simple problems regression can be challenging

Always think about where we have data and what we are using tobuild our claims

Summary: ‘prediction is hard, especially about the future’

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 139 / 146

Page 497: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as Description/Prediction

Even for simple problems regression can be challenging

Always think about where we have data and what we are using tobuild our claims

Summary: ‘prediction is hard, especially about the future’

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 139 / 146

Page 498: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 499: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 500: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 501: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 502: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)

(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 503: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 504: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:

F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 505: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric method

F “Preprocessing” data to make analysis robust to misspecification(2) can be made plausible by:

F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 506: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 507: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:

F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 508: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the model

F Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 509: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 510: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 511: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 512: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Regression as a Causal Model (A Preview)

Can regression be also used for causal inference?

Answer: A very qualified yes

For example, can we say that a one unit increase in inequality causes a 5.2point increase in intensity?

To interpret β as a causal effect of X on Y , we need very specific and oftenunrealistic assumptions:

(1) E [Y |X ] is correctly specified as a linear function (linearity)(2) There are no other variables that affect both X and Y (exogeneity)

(1) can be relaxed by:F Using a flexible nonlinear or nonparametric methodF “Preprocessing” data to make analysis robust to misspecification

(2) can be made plausible by:F Including carefully-selected control variables in the modelF Choosing a clever research design to rule out confounding

We will return to this later in the course

For now, it is safest to treat β as a purely descriptive/predictive quantity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 140 / 146

Page 513: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Today

Regression is about conditioning

Regression can be used for description, prediction,and (sometimes)causation

Linear regression is a parametrically restricted form of regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 141 / 146

Page 514: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Today

Regression is about conditioning

Regression can be used for description, prediction,and (sometimes)causation

Linear regression is a parametrically restricted form of regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 141 / 146

Page 515: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Today

Regression is about conditioning

Regression can be used for description, prediction,and (sometimes)causation

Linear regression is a parametrically restricted form of regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 141 / 146

Page 516: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Summary of Today

Regression is about conditioning

Regression can be used for description, prediction,and (sometimes)causation

Linear regression is a parametrically restricted form of regression

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 141 / 146

Page 517: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Next Week

Basic linear regression

Properties of OLS

Reading:I Aronow and Miller 4.1.2 (OLS Regression)I Optional: Imai 4.2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 142 / 146

Page 518: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Next Week

Basic linear regression

Properties of OLS

Reading:I Aronow and Miller 4.1.2 (OLS Regression)I Optional: Imai 4.2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 142 / 146

Page 519: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Next Week

Basic linear regression

Properties of OLS

Reading:I Aronow and Miller 4.1.2 (OLS Regression)I Optional: Imai 4.2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 142 / 146

Page 520: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Next Week

Basic linear regression

Properties of OLS

Reading:I Aronow and Miller 4.1.2 (OLS Regression)I Optional: Imai 4.2

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 142 / 146

Page 521: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fun with Linearity

“The Siren’s Song of Linearity”

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 143 / 146

Page 522: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fun with Linearity

Images on following slides courtesy of Tom Griffiths

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 144 / 146

Page 523: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Fun with Linearity

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 144 / 146

Page 524: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Design

Each learner sees a set of (x , y) pairs

Makes predictions of y for new x values

Predictions are data for the next learner

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 145 / 146

Page 525: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Design

Each learner sees a set of (x , y) pairs

Makes predictions of y for new x values

Predictions are data for the next learner

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 145 / 146

Page 526: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Design

Each learner sees a set of (x , y) pairs

Makes predictions of y for new x values

Predictions are data for the next learner

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 145 / 146

Page 527: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Design

Each learner sees a set of (x , y) pairs

Makes predictions of y for new x values

Predictions are data for the next learner

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 145 / 146

Page 528: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

The Design

Each learner sees a set of (x , y) pairs

Makes predictions of y for new x values

Predictions are data for the next learner

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 145 / 146

Page 529: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 530: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 531: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 532: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 533: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 534: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 535: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 536: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

Results

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 146 / 146

Page 537: Week 4: Testing/Regression - Princeton University...Week 4: Testing/Regression Brandon Stewart1 Princeton October 1/3, 2018 1These slides are heavily in uenced by Matt Blackwell, Adam

References

Chirot, D. and C. Ragin (1975). The market, tradition and peasantrebellion: The case of Romania. American Sociological Review 40, 428-444

Acemoglu, Daron, Simon Johnson, and James A. Robinson. “The colonialorigins of comparative development: An empirical investigation.” 2000.

Stewart (Princeton) Week 4: Testing/Regression October 1/3, 2018 147 / 146