** Chapter 6.4 ** for W.H. Greene, Econometric Analysis 5th ed. ***************** * (c) Noel Roy 2008 * * MODELING AND TESTING FOR A STRUCTURAL BREAK * The tutorial for this section will review the following tasks in SHAZAM: * • Skipping observations (SKIPIF command) * • Use of temporary variables * • Storing covariance matrix of estimates (/COV= option) * • PDF and CDF calculation (DISTRIB command) * • Introducing matrix manipulation (MATRIX command) * *=============================================================================== * * Example 6.6 The World Health Report (p. 124) * READ (TableF6-2.txt) comp,dale,year,hexp,hc3,small,country,groupti,oecd,gini,geff,voice,tropics,popden,pubthe,gdpc /SKIPLINES=2 * * The example is based on data from 1997 only. * Turn off warnings of skipped observations. SET NOWARNSKIP * Skip observations when year is not 1997. SKIPIF (year .ne. 1997) * The dataset includes political subunits of countries, which must be extracted. * Skip observations when SMALL is greater than 0 (0 implies country unit). SKIPIF (small .gt. 0) * Create Education squared variable GENR hc3sq = hc3**2 * * 6.4.1 Different Parameter Vectors * * Do the all country regressions OLS dale hexp hc3 hc3sq OLS dale hexp hc3 hc3sq gini tropics popden pubthe gdpc geff voice * Test significance of the additional variables in the second regression. TEST TEST gini TEST tropics TEST popden TEST pubthe TEST gdpc TEST geff TEST voice END * The temporary variables $N (number * of observations), $SSE (sum of squared errors), * and $K (number of coefficients, including the constant term) are temporary variables * available following an OLS command. Save these to test for a structural break * between OECD and non-OECD countries later. GEN1 SSE=$SSE GEN1 K=$K GEN1 N=$N * Do the OECD regressions. * Skip if country is not in the OECD. SKIPIF (oecd .eq. 0) OLS dale hexp hc3 hc3sq OLS dale hexp hc3 hc3sq gini tropics popden pubthe gdpc geff voice /COEF=theta1 COV=V1 * The coefficient vector theta1 and the covariance matrix of the coefficients V1 have * been saved for later use in calculating the Wald statistic (6-17). * Test significance of additional variables TEST TEST gini TEST tropics TEST popden TEST pubthe TEST gdpc TEST geff TEST voice END * Save sum of squared errors (SSE) to test for structural break . GEN1 SSE1=$SSE * Non-OECD regressions * We must restore the non-OECD countries to the sample. *Remove the skip indicators. DELETE SKIP$ * Restore the skipping of all except 1997 countries SKIPIF (year .ne. 1997) SKIPIF (small .gt. 0) * Skip if country is OECD member. SKIPIF (OECD .EQ. 1) OLS dale hexp hc3 hc3sq OLS dale hexp hc3 hc3sq gini tropics popden pubthe gdpc geff voice /COEF=theta2 COV=V2 * Test significance of additional variables TEST TEST gini TEST tropics TEST popden TEST pubthe TEST gdpc TEST geff TEST voice END * Save sum of squared errors (SSE) to test for structural break. GEN1 SSE2=$SSE * Calculate F statistic for structural break (p. 125) GEN1 F = ((SSE-(SSE1+SSE2))/K)/((SSE1+SSE2)/(N-2*K)) PRINT F *Calculate degrees of freedom GEN1 DF=N-2*K * * The DISTRIB command will compute the probability density function (PDF) and * the cummulative density function (CDF) for certain distributions. This is * useful when adequate statistical tables are unavailable. The general format * is: DISTRIB vars / options, where vars is a list of variables and options is * a list of the options that are required on the specified type of distribution. * The TYPE= option specifies the type of distribution, and the DF= (DF1= and * DF2= option for the F-distribution) specifies the degrees of freedom. So, * the command * DISTRIB F /TYPE=F DF1=K DF2=DF * * gives the p-value of the test statistic (area under the tail of the * distribution) as 1-CDF. See Chapter 36 of the SHAZAM Manusl for further * information on the DISTRIB command. * * 6.4.4 Tests of structural break with unequal variances * The calculation of the Wald test statistic W in equation (6-17) requires the use * of SHAZAM's matrix manipulation capabilities. * See chapter 33 of the SHAZAM manual for more information on the MATRIX command. * MATRIX W = (theta1-theta2)'INV(V1+V2)(theta1-theta2) PRINT W * The Wald statistic is asymptotic chi-square, so we can use the DISTRIB * command to calculate its p value. DISTRIB W /TYPE=CHI DF=K STOP * *=============================================================================== * * Updated September 2, 2008