** Chapter 20.3 ** for W.H. Greene, Econometric Analysis 6th ed. ***************** * (c) Noel Roy 2003, 2008 * * MODELS WITH LAGGED VARIABLES * *=============================================================================== * * 20.3 SIMPLE DISTRIBUTED LAG MODELS * * Example 20.2 (p. 679) Expectations-Augmented Phillips Curve * READ (TableF5-1.prn)Year qtr realgdp realcons realinvs realgovt realdpi cpi M1 i u pop deltap realint / SKIPLINES=1 * * Estimate simple model. TIME 1950.1 4 SAMPLE 1950.3 2000.4 GENR DELINFL=DELTAP-LAG(DELTAP) OLS DELINFL U /COEF=B * * Calculate the natural rate of unemployment. GEN1 -B(2)/B(1) * * The Expectations model (20-14) must be estimated iteratively. * THIS IS A GOOD EXAMPLE OF HOW TO PROGRAM A GRID SEARCH. * Calculate expected inflation for all values of lambda between * 0 and 1, in steps of .01. * DIM SL 101 LAMBDAI 101 EDELP 204 GEN1 EEMIN=99999 SET NODOECHO SET NOWARN DO #=1,101 GEN1 LAMBDA=(#-1)/100 * Initial value SAMPLE 1950.3 1950.3 GENR EDELP=LAG(DELTAP) * Recursive formula SAMPLE 1950.4 2000.4 GENR EDELP=(1-LAMBDA)*LAG(DELTAP)+ LAMBDA*LAG(EDELP) * Estimate model by OLS for current value of Lambda. SAMPLE 1950.3 2000.4 GENR DELINFL=DELTAP-EDELP ?OLS DELINFL U ?GEN1 SSE=$SSE * Store values of SSE and Lambda to generate Figure 20.2. MATRIX SL(#) = SSE MATRIX LAMBDAI(#) = LAMBDA * If SSE is less than previous values, store SSE and Lambda. IF1 (SSE .LT. EEMIN) LAMDAMIN=LAMBDA IF1 (SSE .LT. EEMIN) EEMIN=SSE ENDO * * Replicate the plot in Figure 19.2. * SAMPLE 1 101 GRAPH SL LAMBDAI /LINEONLY NOKEY * * Reestimate the model at the value of LAMBDA that minimizes SSE. * GEN1 LAMBDA=LAMDAMIN PRINT LAMBDA SAMPLE 1950.3 1950.3 GENR EDELP=LAG(DELTAP) SAMPLE 1950.4 2000.4 GENR EDELP=(1-LAMBDA)*LAG(DELTAP)+ LAMBDA*LAG(EDELP) SAMPLE 1950.3 2000.4 GENR DELINFL=DELTAP-EDELP OLS DELINFL U /COEF=BETA PREDICT=YEHAT GEN1 SIG2=$SIG2 * * The standard errors listed are invalid because they are conditional * on a value for LAMBDA that is an estimate, and therefore a random variable. * The covarance matrix of the non-linear least sqaures estimator must be * estimated. * Calculate the partial derivative of EDELP with respect to Lambda, w3. DIM W3 204 * Calculate w3 recursively. SAMPLE 1950.3 1950.3 * Initial value. GENR W3=0 SAMPLE 1950.4 2000.4 GENR W3=LAG(EDELP)-LAG(DELTAP)+LAMBDA*LAG(W3) * * Calculate the estimated covariance matrix of the estimates (including * lambda). * SAMPLE 1950.3 2000.4 GENR ONE=1 COPY ONE U W3 W MATRIX SIGMA=SIG2*INV(W'W) * * Calculate and print the standard errors. * MATRIX STERR=SQRT(DIAG(SIGMA)) PRINT STERR * * Take t-statistic on Lambda. GEN1 T=LAMBDA/STERR(3) DISTRIB T /TYPE=T DF=200 * * Calculate natural rate of unemployment. * GEN1 USTAR=-BETA(2)/BETA(1) PRINT USTAR * * Calculate standard error of USTAR using delta method. * MATRIX SEUSTAR=SQRT(SIGMA(1,1)/BETA(1)**2+SIGMA(2,2)*BETA(2)**2/BETA(1)**4-2*SIGMA(2,1)*BETA(2)/BETA(1)**3) PRINT SEUSTAR * * Calculate 95% confidence interval. * GEN1 LOWER=USTAR-SEUSTAR*1.96 GEN1 UPPER=USTAR+SEUSTAR*1.96 PRINT LOWER UPPER * STOP * *=============================================================================== * Updated November 12, 2008