Economics 310 Lecture 13 Heteroscedasticity Continued.

22
Economics 310 Lecture 13 Heteroscedasticity Continued
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    220
  • download

    1

Transcript of Economics 310 Lecture 13 Heteroscedasticity Continued.

Page 1: Economics 310 Lecture 13 Heteroscedasticity Continued.

Economics 310

Lecture 13Heteroscedasticity Continued

Page 2: Economics 310 Lecture 13 Heteroscedasticity Continued.

Tests to be Discussed Goldfeld-Quandt Test

Assumes variance monotonically associated with some variable.

Breusch-Pagan-Godfrey Test Variance linear function of set of variables

or function of a linear combination of variables.

White General Heteroscedasticity Test Source unknown, but may exist.

Page 3: Economics 310 Lecture 13 Heteroscedasticity Continued.

Goldfeld-Quandt Test

dasticity Heterosce: H

sticity Homosceda: H6.

top.on is estimate riancelargest va so arrange ,ˆ

ˆ F

freedom. of degrees 2

c-n

2

c-n with Fan is statisticTest 5.

group. eachfor estimates ceGet varian 4.

groups. thirdandfirst thein model Estimate.3

.2

c-n,,

2

c-n size of groups 3 intodata Divide2.

Z. toaccordingdata Order 1.

Z). allfor 00 (i.e. function. monotonica is

and variablesome is Z where)( assumesTest

a

0

21

22

2i

kandk

c

dZ

dfor

dZ

dff

Zf i

Page 4: Economics 310 Lecture 13 Heteroscedasticity Continued.

Data Organization

Observation Y X1 X2 Z1 370.11 10.00 30.00 0.22 361.45 12.65 28.79 0.43 351.30 15.65 27.36 0.64 342.23 17.95 25.94 0.85 332.64 20.09 24.22 1.06 325.50 22.96 23.73 1.27 314.92 25.90 22.24 1.48 310.00 27.97 21.58 1.69 302.15 30.69 20.96 1.810 297.38 32.93 20.72 2.011 291.26 35.16 20.07 2.212 285.30 37.84 19.78 2.413 277.43 40.08 19.02 2.614 272.61 42.76 18.81 2.815 261.92 45.16 17.20 3.016 259.55 47.24 16.97 3.217 246.14 49.69 15.03 3.418 240.57 51.95 14.11 3.619 229.52 54.08 12.14 3.820 220.45 56.92 11.42 4.0

Group 1

(n-c)/2=(20-4)/2=8 obs

C=4

Group 2

(n-c)/2=(20-4)/2=8 obs

Page 5: Economics 310 Lecture 13 Heteroscedasticity Continued.

Obstetrics Example Data from 800+ hospitals. Dependent variable is the average

length of stay in maternity ward. Explanatory variables is the charge per

day and % of deliveries that are c-sections.

Expect greater variability in length of stay at hospitals that are not subject to high managed care.

Page 6: Economics 310 Lecture 13 Heteroscedasticity Continued.

Shazam Commands

sample 1 859read (d:\econom~1\classe~1\ob1_het.txt) cases rate los cost billed neo mcph mcpmgenr charge=billed/losols los rate chargediagnos / chowone=589

Page 7: Economics 310 Lecture 13 Heteroscedasticity Continued.

Shazam Output for Goldfeld-Quandt Test

VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY NAME COEFFICIENT ERROR 856 DF P-VALUE CORR. COEFFICIENT AT MEANS RATE 4.1647 0.2426 17.17 0.000 0.506 0.4940 0.4056 CHARGE -0.43644E-03 0.2652E-04 -16.46 0.000-0.490 -0.4737 -0.3229 CONSTANT 2.1049 0.6367E-01 33.06 0.000 0.749 0.0000 0.9173 |_diagnos / chowone=589 REQUIRED MEMORY IS PAR= 123 CURRENT PAR= 500 DEPENDENT VARIABLE = LOS 859 OBSERVATIONS REGRESSION COEFFICIENTS 4.16471785492 -0.436436399782E-03 2.10491763784 SEQUENTIAL CHOW AND GOLDFELD-QUANDT TESTS N1 N2 SSE1 SSE2 CHOW PVALUE G-Q DF1 DF2 PVALUE 589 270 238.20 21.357 40.564 0.000 5.082 586 267 0.000

Page 8: Economics 310 Lecture 13 Heteroscedasticity Continued.

Breusch-Pagan-Godfrey Test

variable.random squared-Chi

above usingticity homoscedas of hypothesis null Test the .6

~)(2

1

define and above 4 regression for the SSR Obtain the .5

...p :regression theEstimate .4

~/ˆpConstruct .3

~ varianceof estimate Likelihood MaximumObtain 2.

residualsget and OLSby model Estimate .1

...

lyspecifical moreor )...(

...:

21

221i

22i

2

2212

2212

221

m

imimi

i

mimii

mimii

ikikii

SSR

ZZ

n

SSE

ZZ

ZZf

XXYModel

Page 9: Economics 310 Lecture 13 Heteroscedasticity Continued.

Example of BPG Test using OB Data Null hypothesis is

homoscedasticity Let the Z’s be (1) the number of of

OB cases per year and (2) whether the hospital is under high managed care

Expect variance to be negatively related to both variables.

Page 10: Economics 310 Lecture 13 Heteroscedasticity Continued.

Shazam Code for OB Example

* performing Breusch-Pagan Test on cases and mcph?ols los rate charge / resid=e dn anovagen1 sigsq=$sig2genr esq=e*egenr p=esq/sigsqols p cases mcph / anovagen1 ess=$ssrgen1 pbg=ess/2Print pbg

Page 11: Economics 310 Lecture 13 Heteroscedasticity Continued.

Shazam Output for OB Example

|_ols p cases mcph / anova VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY NAME COEFFICIENT ERROR 856 DF P-VALUE CORR. COEFFICIENT AT MEANS CASES -0.37767E-03 0.2353E-03 -1.605 0.109 -0.055 -0.0551 -0.5201 MCPH -0.52494 0.6677 -0.7861 0.432 -0.027 -0.0270 -0.1650 CONSTANT 1.6851 0.4774 3.529 0.000 0.120 0.0000 1.6851 |_gen1 ess=$ssr ..NOTE..CURRENT VALUE OF $SSR = 288.00 |_gen1 pbg=ess/2 |_Print pbg PBG 144.0017

Page 12: Economics 310 Lecture 13 Heteroscedasticity Continued.

Built in BPG Test in Shazam Shazam has a built in BPG test. Uses the explanatory variables as

the Zs. Invoked by using the command

“DIAGNOS” with the option “HET” right after the “OLS” command.

i.e. ols y x1 x2 diagnos / het

Page 13: Economics 310 Lecture 13 Heteroscedasticity Continued.

Using HET on OB example|_?ols los rate charge |_diagnos / het REQUIRED MEMORY IS PAR= 123 CURRENT PAR= 500 DEPENDENT VARIABLE = LOS 859 OBSERVATIONS REGRESSION COEFFICIENTS 4.16471785492 -0.436436399782E-03 2.10491763784 HETEROSKEDASTICITY TESTS E**2 ON YHAT: CHI-SQUARE = 19.852 WITH 1 D.F. E**2 ON YHAT**2: CHI-SQUARE = 80.223 WITH 1 D.F. E**2 ON LOG(YHAT**2): CHI-SQUARE = 1.018 WITH 1 D.F. E**2 ON X (B-P-G) TEST: CHI-SQUARE = 35.644 WITH 2 D.F. E**2 ON LAG(E**2) ARCH TEST: CHI-SQUARE = 0.027 WITH 1 D.F. LOG(E**2) ON X (HARVEY) TEST: CHI-SQUARE = 5.259 WITH 2 D.F. ABS(E) ON X (GLEJSER) TEST: CHI-SQUARE = 62.292 WITH 2 D.F.

Page 14: Economics 310 Lecture 13 Heteroscedasticity Continued.

White General Test for Heteroscedasticity This is a general test. No preconception of cause of

heteroscedasticity Is a Lagrange-Multiplier Test Regress squared residuals on

explanatory variables, their squares and their cross products.

n*R2 is chi-squared variable

Page 15: Economics 310 Lecture 13 Heteroscedasticity Continued.

White Test

2.

2

2

)1(

,11

2

)1(322k

212

221

2212i

i

221

*

...

...

...ˆ

:regressionauxillary following the

form and regression above from ,ˆ residuals, Obtain

...:

auxkk

ikiikkkii

kikik

kiki

ikikii

Rn

statisticTest

XXXX

XX

XX

XXYModel

Page 16: Economics 310 Lecture 13 Heteroscedasticity Continued.

Shazam code for White test for OB example

?ols los rate charge / resid=e genr esq=e*egenr rate2=rate*rategenr charge2=charge*chargegenr charrate=charge*rate?ols esq rate charge rate2 charge2 charrate gen1 rsqaux=$r2gen1 numb=$ngen1 white=numb*rsqauxprint white

Page 17: Economics 310 Lecture 13 Heteroscedasticity Continued.

Results of White’s test for OB example

|_?ols los rate charge / resid=e |_genr esq=e*e |_genr rate2=rate*rate |_genr charge2=charge*charge |_genr charrate=charge*rate |_?ols esq rate charge rate2 charge2 charrate |_gen1 rsqaux=$r2 ..NOTE..CURRENT VALUE OF $R2 = 0.44959 |_gen1 numb=$n ..NOTE..CURRENT VALUE OF $N = 859.00 |_gen1 white=numb*rsqaux |_print white WHITE 386.2005 Note: Critical chi-square 5 df. = 11.0705

Page 18: Economics 310 Lecture 13 Heteroscedasticity Continued.

White Correction Do not know the source of

heteroscedasticity. Forced to use OLS estimates. Consistent estimate of true

variance-covariance matrix of OLS estimators.

Gives test of hypothesis that are asymptotically unbiased.

Page 19: Economics 310 Lecture 13 Heteroscedasticity Continued.

Covariance Matrix OLS

matrix. covariance- varianceabove the

of estimate consistent a gives correction WhiteThe

'''

''''

''''

11

11

11

XXWXXXX

XXXeeXXXE

eXXXyXXXb

bb

Page 20: Economics 310 Lecture 13 Heteroscedasticity Continued.

OB Example with White Correction

|_ols los rate charge / hetcov USING HETEROSKEDASTICITY-CONSISTENT COVARIANCE MATRIX R-SQUARE = 0.3424 R-SQUARE ADJUSTED = 0.3409 VARIANCE OF THE ESTIMATE-SIGMA**2 = 0.34648 STANDARD ERROR OF THE ESTIMATE-SIGMA = 0.58863 SUM OF SQUARED ERRORS-SSE= 296.59 MEAN OF DEPENDENT VARIABLE = 2.2946 LOG OF THE LIKELIHOOD FUNCTION = -762.125 VARIABLE ESTIMATED STANDARD T-RATIO PARTIAL STANDARDIZED ELASTICITY NAME COEFFICIENT ERROR 856 DF P-VALUE CORR. COEFFICIENT AT MEANS RATE 4.1647 1.189 3.501 0.000 0.119 0.4940 0.4056 CHARGE -0.43644E-03 0.5672E-04 -7.694 0.000-0.254 -0.4737 -0.3229 CONSTANT 2.1049 0.1944 10.83 0.000 0.347 0.0000 0.9173

Page 21: Economics 310 Lecture 13 Heteroscedasticity Continued.

Estimated Generalized Least-Squares

11ˆ

111

)ˆ'(ˆ

isestimator squaresleast dgeneralize estimated theof

matrix covariance- varianceestimated The

ˆ')ˆ'(ˆ

it. of estimatean h matrix wit

covariance- varianceactual thereplacingby obtained is

estimator squaresleast dgeneralize estimated The

XWX

yWXXWX

Page 22: Economics 310 Lecture 13 Heteroscedasticity Continued.

Possible variance forms

i

iii

i

ii

i

ii

yweight

XyE

Xweight

estimatedbetoX

XweightX

ˆ1

)())((

Yof valueexpected toalproportion Variance .3

.,.2

1,.1

221

2222

2

ˆ

22

22