SAS pp 198-202

# SAS pp 198-202 - HETEROSKEDASTIC ERRORS set w heat i f t...

This preview shows pages 1–3. Sign up to view the full content.

HETEROSKEDASTIC ERRORS set wheat; if t<=13; data wheat2; t>=14; Apply least squares to the separate data partitions obtain results in Equation 15.2.12. Output residuals for later use. proc reg data=wheat1; wheat1:model q = p t; output out=out1 r=ehat1; reg data=wheat2; wheat2:model q = p output out=out2 r=ehat2; 15.2.3 Testing Heteroskedasticity 15.2.3a The Goldfeld-Quandt Test The GOLDFELD-QUANDT test heteroskedasticity is described Section 15.2.3 of text. Given regression output from the two sample partitions above it easy to calculate the GQ statistic with a hand calculator, by dividing one estimated error variance by other. Here we use a SAS DATA statement to carry out the computations. First MERGE the two sets containing residuals from part ions. data wheatout; merge outl out2; keep ehatl ehat2; Use proc means to compute the sums of squared residuals, and output them to a SAS dataset. proc means USSj output out=sumsout uss=ssel sse2; Create a new SAS dataset the Goldfeld-Quandt using the sums of squared residuals. set sumsout; Define the sample sizes and numbers regressors. t1 = 13; t2 = 13; kl = 3; k2 = 3: Estimate variances partitions. 198

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1 siglsq = ssel/(tl-kl); sig2sq = sse2/(t2-k2); The GQ test statistic is formed by dividing the two estimated error variances. = siglsq/sig2sq; Calculate the F-distribution critical value, and p-value of the GQ statistic and print results. fcrit = finv(.95,t1-kl,t2-k2); pval = 1 - probf(GQ,t1-k1.t2-k2); proc print; var sig1sq sig2sq GQ pval; run; Compare output to results in text. OBS SIG1SQ SIG2SQ FeRIT PVAL 641.641 57.7585 11.1090 2.97824 .00036423 The small indicates that we reject null hypothesis that variances the two sample partitions are equal. To apply the Goldfeld-Quandt the food expenditure model we first must sort data according
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

SAS pp 198-202 - HETEROSKEDASTIC ERRORS set w heat i f t...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online