Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

34
Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan

Transcript of Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Page 1: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Econ 488Lecture 5 – Hypothesis TestingCameron Kaplan

Page 2: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Classical Assumptions

1. Regression is linear, correctly specified, and has additive error term

2. E(εi)=03. Correlation between Xki and εi is 0 for all k.4. εt is uncorrelated with εt+1 for all t.5. Var(εi)=σ2 [No Heteroskedasticity]6. No perfect multicollinearity and sometimes:7. εi~N(0, σ2)

Page 3: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Sampling Distribution of

• is assumed to be normally distributed because the stochastic error is assumed to be normally distributed (assumption 7)• Usually, we take a sample of size N from a

population to produce a single estimator of β, which we call .• But what if we took a different sample?• We should get a different result for

Page 4: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Sampling Distribution of

β

Page 5: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Sampling Distribution of

• In OLS, is unbiased, so E( )=β• OLS estimators also have the smallest variance

possible at any sample size (efficiency)• Finally, OLS estimators are consistent. As N

increases, variance shrinks.• As N->∞, β->

Page 6: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Consistency

Page 7: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Hypothesis Testing

• Most times, we only take one sample, so we only get one estimate of

• How do we know if is meaningful I we can only observe one value in the distribution?

Page 8: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Example

• Suppose we are interested in whether school size has an effect on student performance.• Specifically, do students at small schools do

better?• We estimate the following equation:• math10i = β0+β1enrolli+β2staffi+β3totcompi+εi

Page 9: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Example

• math10i = β0+β1enrolli+β2staffi+β3totcompi+εi

• Where:• math10 = % of students passing the 10th grade

math portion of the Michigan Educational Assessment Program (MEAP) test• enroll = school size• staff = number of staff/1000 students (to control

for how much attention students get)• totcomp = average annual teaching

compensation (to control for teacher quality)

Page 10: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Hypothesis Testing

• We need to develop a null and alternative hypothesis before running the regression.• Null Hypothesis (H0)• Usually, you want to reject the null hypothesis• Most common null hypothesis: “there is no effect

of X on Y” or “β1=0”

• Alternative Hypothesis (HA or H1)• Usually, what you are trying to prove

Page 11: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Hypothesis Testing

• In our example, we would pick• H0:β1≥0 “there is no negative effect of school

size on student performance”• HA:β1<0 “There is a negative effect of school size

on student performance”

• Test this using meap93.gdt

Page 12: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Example 2

• Consider the wage equation• log(wagei)=β0+β1educi+β2exeri+β3tenurei+εi

• The null hypothesis H0: β2=0 says:• once education and tenure have been accounted

for, the number of years in the workforce has no effect on hourly wage• If β2>0, prior work experience contributes to

productivity, and to wage.

Page 13: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Alternative Hypothesis

• Usually, we want to reject the null hypothesis.• We form an alternative hypothesis – values we

don’t expect.• One-sided Alternatives• We expect there to be a sign on a particular

variable based on our economic model• e.g. HA: βK>0.

Page 14: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Hypothesis Testing

• log(wagei)=β0+β1educi+β2exeri+β3tenurei+εi

• In our example, we might set our hypotheses as• H0:β2≤0

• HA:β2>0• We believe that the effect of experience on

wages is positive, holding education and tenure fixed.

Page 15: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Hypothesis Testing

• log(wagei)=β0+β1educi+β2exeri+β3tenurei+εi

• What should the null and alternative hypotheses for the other coefficients be?• H0:β1≤0

• HA:β1>0

• H0:β3≤0

• HA:β3>0

Page 16: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Two sided alternatives• Yi=β0+β1X1i+…+βkXki+εi

• H0:β1=0

• HA:β1≠0

• Under the alternative, X1i has a significant effect on the dependent variable without specifying if it’s positive or negative• You should use this if you don’t know what sign

βk has (not well defined by theory)• Or…sometimes it is better to use because it

prevents us from forming our hypothesis after looking at the results

Page 17: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Other Hypotheses

• Although H0:βk=0 is the most common null hypothesis, sometimes, we want to test whether or not βk is equal to some other constant – usually 1 or -1.• Example: Suppose we want to look at the effect

of college enrollment on crime.• log(crimei)=β0+β1log(enrolli)+εi

• This is a constant elasticity model, where β1 is the elasticity of crime with respect to enrollment.

Page 18: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Other hypotheses

• log(crimei)=β0+β1log(enrolli)+εi

• We could test, H0:β1=0 & HA:β1≠0

• But more interesting would be to test if β1=1

• If β1>1, then a 1% increase in enrollment leads to a greater than 1% increase in crime, so crime is a bigger problem at large campuses• Set up our hypotheses as follows• H0:β1=1

• HA:β1≠1

Page 19: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

t-test

• Yi=β0+β1X1i+…+βkXki+εi

• t-statistic:

• = estimated regression coefficient of the kth variable• = The border value (usually zero) implied by

the null hypothesis• = The estimated standard error of the

coefficient on the kth variable

Page 20: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

t-test

• For example, suppose our hypotheses were:• H0:β1=0

• HA:β1>0• Then, suppose that we estimate that =6, and

that =2• We would calculate t as

Page 21: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

How does the t-test work?

β1

Distribution of if null is true

Suppose we found a value of way out here

It’s not very likely that the null hypothesis is true…

Page 22: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

t-test• How does this look for our example?• =6 and =2

0-2 2 6

Page 23: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

t-test

• We want to know, if H0 really is true (i.e. β1 really is 0), how likely is it that we could have observed a value of 6?• Not very.• We can probably say that H0 is not true.• But we need a rule to decide.

Page 24: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Hypothesis Testing• How do we decide when to reject the null?• Choose a level of significance• Rule of thumb: 5% level of significance• This means that we will rule out H0 if we would

have expected a value of at least as extreme as 6 less than 5% of the time.• Instead of trying to figure out this probability

using the sampling distribution, we transform the distribution to the t-distribution• The t-distribution is almost the same as the

standard normal distribution.

Page 25: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

t-test• In our example, t=6-0/2 = 3• Suppose our sample size was 23• We need to compare our t-statistic to the critical t-value,

which distinguishes the acceptance region from the rejection region.

• Look at inside cover of book• We want the t-value for 23-2-1= 20 degrees of freedom.• For a one sided test with 5% significance, this is tc=1.725

• Decision Rule: Reject H0 if |tk|>tc, and has the sign implied by HA, otherwise do not reject.

• Here, we reject the null in favor of the alternative, suggesting that X1 is significant

Page 26: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Choosing a Level of Significance• Rule of thumb – Significance level = 5%• If significance level is too low, we risk what is called a

type II error, where we reject the null hypothesis when it is actually true.• If we reject H0 at the 5% level, we say that the coefficient

is “statistically significant at the 5% level”• Sometimes researchers use asterisks• * means significant at 10%• ** means significant at 5%• *** means significant at 1%

Page 27: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Confidence Intervals

• Confidence Interval - The range that contains the population value a specified percent of the time.•

• The two-sided t-critical value at a specific significance level gives the (1-sig level) confidence interval.• So, the 5% significance level is equivalent to the

95% CI.

Page 28: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Confidence Intervals

• For our example, the t-critical value was 2.086• So the 95% CI= 6 ± 2*2.086 = 6±4.172• Or 1.828 to 10.172• We could say that with 95% confidence, the true

value of β is between 1.828 and 10.172• Notice that 0 is not in this range.• We can reject H0

Page 29: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

P-value• Alternative to t-test

• If the true population value was really 0, what is the probability we would have observed a value as extreme as 6?

• If p is small, reject the null.• This is calculated automatically by most econometrics

software• Reject the null if p is less than the significance level.

0

-2 62

Page 30: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

Example• Student performance and school size using data.

Page 31: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

F-test (Appendix Ch. 5)• What if you want to test a hypothesis that involves multiple

coefficients?• For example: Suppose we run this regression (data7-2.gdt):

• wagei = β0+β1educi+β2experi+β3clericali+β4mainti+β5craftsi+εi

• clerical, maint, and crafts are job type “dummies”• We want to test whether job type matters• We would need to test whether β3, β4, and β5 are “jointly

significant.• H0:β3=β4=β5=0

• HA: The null hypothesis is not true.

Page 32: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

F-test• Steps• 1. Run full regression, get RSS• 2. Run constrained regression (without job type variables),

get RSSM

• RSS = RSS from step 1• RSSM = RSS from step 2• M = # of excluded coeffs• N = # observations• K = # of coefficients in overall equation

Page 33: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

F-stat

• Calculate F-stat, and compare it to the critical value of F (from F-table)• Degrees of freedom numerator = M• Degrees of freedom denominator = N-K-1• If F>Fcrit reject null hypothesis• The variables are jointly significant if you can

reject the null.

Page 34: Econ 488 Lecture 5 – Hypothesis Testing Cameron Kaplan.

F-test

• In Gretl• Run the model• Select test>omit variables• Gives F-stat and related p-value