51
Econ 488 Lecture 2 Cameron Kaplan

Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Embed Size (px)

Citation preview

Page 1: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Econ 488

Lecture 2

Cameron Kaplan

Page 2: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis Testing

Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics.

The Null Hypothesis (H0): Usually trying to reject this:H0: µ =3.0

Page 3: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis Testing

Alternative Hypothesis (HA or H1): The null hypothesis is not true HA: µ ≠3.0 (two-sided)Or HA: µ >3.0 (one-sided)

Usually we pick the two sided test unless we can rule out the possibility that µ >3.0

Page 4: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis Testing

Suppose we conduct a sample of 20 former econometrics students we found: Sample Mean = 3.30 Standard Deviation = 0.25

How likely is it that a sample of 20 would give a sample average of 3.30 if the population average was really 3.0?

Page 5: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis Testing

When we estimate x-bar using an estimated standard error we need to use the t-distribution

Page 6: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis TestingTest Statistic:

Significance Level - Most common is 5% or 1%.

Page 7: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

5 % significance levelIf really was

3.0, what values of t would give us a test that would reject the null when it’s correct only 5% of the time?

Page 8: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis TestingWe have a sample size of 20Thus we have N-1 = 20-1 = 19 degrees of

freedom.Look in t-tablet* = 2.093So if our value of t is greater than 2.093

OR less than -2.093, we should reject the null hypothesis

Page 9: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Hypothesis testing

So, we should reject the null

Page 10: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

P-value

Suppose we want to know: if the average student really got a 3.0, how likely would it be for us to observe a value at least as far from 3.0 as we did in our sample?

In other words, if = 3.0, how likely is it that when we draw a sample of 20 that we would get a sample mean of 3.3 or greater (or 2.7 or less)?

Page 11: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

P-valueWe want to know the probability that t>5.366Can’t look up in most tables, but most stats

software gives it to you.In this case, p=0.000035In other words if the null were true, we would

only get a value that extreme 0.0035% of the time (1 out of 29,000 times)

This is strong evidence that we should reject the null.

Page 12: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

P-valueIf p-value is smaller than the significance

level, reject null.P-value is nice, because if you are given

p-value, you don’t have to look anything else up in a table.

Smaller p-values mean null hypothesis is less likely to be true.

Page 13: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics
Page 14: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Bias

A biased sample is a sample that differs significantly from the population.

Page 15: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Common Types of Bias

Selection BiasSample systematically excludes or

underrepresents certain groups.e.g. calculating the average height of US

men using data from medicare recordsWe are systematically excluding the

young, who may be different for many reasons.

Page 16: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Common Types of Bias

Self-Selection Bias/Non-Response BiasBias that occurs when people choose to

give certain information.e.g. ads to participate in medical studiese.g. calculating average CSUCI GPA by

asking students to volunteer to let us look at their transcripts.

Page 17: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Common Types of Bias

Survivor BiasSuppose we are looking at the historical average

performance of companies on the NYSE, and wanted to know how that was related to CEO pay.

One problem that we might have is that we might only look at companies that are still around.

We are excluding companies that went out of business.

Page 18: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Review of RegressionRegression - Attempt to explain

movement in one variable as a function of a set of other variables

Example: Are higher campaign expenditures related to more votes in an election?

Page 19: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Review of RegressionDependent Variable - Variable that is

observed to change in response to the independent variable

e.g. share of votes in the electionIndependent Variable(s) (AKA explanatory

variable) - variables that are used to explain variation in dependent variable.

e.g. campaign expenditures.

Page 20: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Review of RegressionExample: DemandQuantity is dependent variablePrice, Income, Price of compliments, Price

of Substitutes are all independent variables.

Page 21: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Simple Regression

Y = 0+1X

Y: Dependent VariableX: Independent Variable0: Intercept (or Constant)

1: Slope Coefficient

Page 22: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Simple Regression

Y

X

0

1

Page 23: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Simple Regression

1 is the response of Y to a one unit increase in X

1 =Y/X

When we look at real data, the points aren’t all on the line

Page 24: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Simple Regression

Y

X

Page 25: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Simple Regression

How do we deal with this?By adding a stochastic error term to the

equation.Y = 0 + 1X + Deterministic ComponentStochastic Component

Page 26: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Simple Regression

Y

X

0 + 1X

Page 27: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Why do we need ?

1. Omitted Variables

2. Measurement Error

3. The underlying relationship may have a different functional form

4. Human behavior is random

Page 28: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Notation

There are really N equations because there are N observations.

Yi = 0 + 1Xi + i (i=1,2,…,N)E.g.Y1 = 0 + 1X1 + 1

Y2 = 0 + 1X2 + 2

…YN = 0 + 1XN + N

Page 29: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Multiple RegressionWe can have more than one independent

variableYi = 0 + 1X1i + 2X2i + 3X3i + I

What does 1 mean?

It is the impact of a one unit increase in X1 on the dependent variable (Y), holding X2

and X3constant.

Page 30: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Steps in Empirical Economic Analysis

1. Specify an economic model.

2. Specify an econometric model.

3. Gather data.

4. Analyze data according to econometric model.

5. Draw conclusions about your economic model.

Page 31: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Step 1: Specify an Economic Model

Example: An Economic Model of CrimeGary BeckerCrimes have clear economic rewards (think of a

thief), but most criminal behavior has economic costs.

The opportunity cost of crime prevents the criminal from participating in other activities such as legal employment,

In addition, there are costs associated with the possibility of being caught, and then, if convicted, there are costs associated with being incarcerated.

Page 32: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Economic Model of Crimey=f(x1, x2, x3, x4, x5, x6, x7)y=hours spent in criminal activityx1=“wage” for an hour spent in criminal activityx2=hourly wage in legal employmentx3=income from sources other than

crime/employmentx4=probability of getting caughtx5=probability of being convicted if caughtx6=expected sentence if convictedx7=age

Page 33: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Economic Model of Education

What is the effect of education on wages?wage=f(educ,exper,tenure)

educ=years of educationexper=years of workforce experiencetenure=years at current job

Page 34: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Step 2: Specify an econometric modelIn the crime example, we can’t reasonably

observe all of the variablese.g. the “wage” someone gets as a

criminal, or even the probability of being arrested

We need to specify an econometric model based on observable factors.

Page 35: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Econometric Model of Crime

crimei = 0 + 1wagei + 2othinci + 3freqarri + 4freqconvi + 5avgseni + 6agei + I

crime = some measure of frequency of criminal activity

wage = wage earned in legal employmentothinc = income earned from other

sourcesfreqarr = freq. of arrests for prior

infractions

Page 36: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Econometric Model of Crime

crimei = 0 + 1wagei + 2othinci + 3freqarri + 4freqconvi + 5avgseni + 6agei + I

freqconv = frequency of convictionsavgsen = average length of sentenceage= age in years= stochastic error term

Page 37: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Econometric Model of Crime

The stochastic error term contains all of the unobserved factors, e.g. wage for criminal activity, prob of arrest, etc.

We could add variables for family background, parental education, etc, but we will never get rid of

Page 38: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Wage and Education

wagei = 0 + 1educi + 2exper + 3tenurei + I

What are the signs of the betas?Run Regression in Gretl! (wage1.gdt)

Page 39: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Step 3: Gathering Data

Types of Data:Cross-Sectional DataTime Series DataPooled Cross SectionsPanel/Longitudinal Data

Page 40: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Cross-Sectional Data

A sample of individuals, households, firms, cities, states, or other units, taken at a given point in time

Random SamplingMostly used in applied microeconomicsExamples

General Social SurveyUS CensusMost other surveys

Page 41: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Cross-Sectional Data

Obs wage educ exper female married

1 3.10 11 2 1 0

2 3.24 12 22 1 1

3 6.00 11 3 0 1

… … … … … …

525 3.50 16 4 0 0

526 4.25 14 5 1 0

Page 42: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Time Series DataObservations on a variable or several

variables over timeE.g. stock prices, money supply, CPI,

GDP, annual homicide rates, etc.Because past events can influence future

events, and lags in behavior are common in economics, time is an important dimension of time-series

Page 43: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Time Series DataMore difficult to analyze than cross-

sectional dataObservations across time are not

independentMay also have to control for seasonality

Page 44: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Time Series Data

Obs year avgmin avgcov unemp gnp

1 1950 0.20 20.1 15.4 878.7

2 1951 0.21 20.7 16.0 925.0

3 1952 0.23 22.6 14.8 1015.9

… … … … … …

37 1986 3.35 58.1 18.9 4281.6

38 1987 3.35 58.2 16.8 4496.7

Page 45: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Pooled Cross-SectionsBoth time series and cross-sectional featuresSuppose we collect data on households in 1985

and 1990We can combine both of these into one data set

by creating a pooled cross-sectionGood if there is a policy change between yearsNeed to control for time in analysis

Page 46: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Pooled Cross-Sections

Obs year hprice proptax

1 1993 85,500 42

2 1993 67,300 36

… … … …

250 1993 134,000 41

251 1995 65,000 16

252 1995 182,400 20

… … … …

520 1995 57,200 16

Page 47: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Panel/Longitudinal Data

A panel data set consists of a time series for each cross-sectional member

E.g. select a random sample of 500 people, and follow each for 10 years.

Page 48: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Panel Data

obs personid year wage dinout

1 1 1990 5.50 2

2 1 1992 6.50 4

3 1 1994 6.75 4

4 2 1990 10.50 6

5 2 1992 10.50 5

6 2 1994 11.25 2

7 3 1990 7.75 5

… … … … …

900 300 1994 15.00 2

Page 49: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Causality & Ceteris Paribus

What we really want to know is: does the independent variable have a causal effect on the dependent variable

But: Correlation does not imply causationSuppose we want to know if higher

education leads to higher worker productivity

Page 50: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Causality and Ceteris Paribus

If we find a relationship between education and wages, we don’t know much

Why? What if highly educated people have higher IQs, and it’s really high IQ that leads to higher wages?

If you give a random person more education, will they get higher wages?

Page 51: Econ 488 Lecture 2 Cameron Kaplan. Hypothesis Testing Suppose you want to test whether the average person receives a B or higher (3.0) in econometrics

Causality and Ceteris Paribus

What we want to know is… Does higher education lead to higher wages ceteris paribus… holding all else constant

We have to control for IQ, experience, gender, job training, etc.

But we can’t control for everything!