270 likes | 1.2k Views
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.
E N D
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.
Data Organization Group 1 (n-c)/2=(20-4)/2=8 obs C=4 Group 2 (n-c)/2=(20-4)/2=8 obs
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.
Shazam Commands sample 1 859 read (d:\econom~1\classe~1\ob1_het.txt) cases rate los cost billed neo mcph mcpm genr charge=billed/los ols los rate charge diagnos / chowone=589
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
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.
Shazam Code for OB Example * performing Breusch-Pagan Test on cases and mcph ?ols los rate charge / resid=e dn anova gen1 sigsq=$sig2 genr esq=e*e genr p=esq/sigsq ols p cases mcph / anova gen1 ess=$ssr gen1 pbg=ess/2 Print pbg
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
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
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.
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
Shazam code for White 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 gen1 numb=$n gen1 white=numb*rsqaux print white
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
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.
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