*SHAZAM PROGRAM FILE TO TO SIMULATE FORWARD AND SPOT EXCHANGE RATE * TIME PATHS UNDER DIFFERENT ASSUMPTIONS ABOUT AGENT'S INFORMATION * * The program assumes that the real exchange rate is a random walk and * that the domestic and foreign inflation rates exhibit zero trend. * * [NOTE: THESE COMMENTS WILL NOT ALWAYS CORRECTLY APPEAR IN THE SHAZAM * OUTPUT. IT SEEMS THAT SHAZAM SWALLOWS SOME OF THE MATHEMATICAL * NOTATION IN A MISGUIDED ATTEMPT TO EXECUTE IT.] * * The innovation in the time-series process generating the real exchange * rate is assumed to be composed of two parts---a random component that * agents can know about with error, and a random component that is pure * news. We thus generate two random terms E1 and E2 and assume that * agents' basic exchange rate prediction is a weighted average of these * to error terms with G being the weight attached to E1 and (1-G) being * the weight attached to E2. Larger values of G imply that the proportion * of future exchange rate innovations that agents can forecast is * correspondingly larger. In order to ensure that the variance of the * shock to the real exchange rate is the same whatever agents know * about it the G and (1-G) weights have to be scaled to ensure that their * squared values sum to unity. This is done by dividing both raw weights * by a scale factor S equal to the square root of the sum of the square of * G and the square of (1-G). That is, the scale factor will equal * * S = sqrt ( [ G^2 + (1-G)^2] ) [^ means "to the power of"] * * so that the scaled weights will be G/S and (1-G)/S. This scaling follows * from the fact that the variance of the weighted sum of two independent * random variables * * T = [G/S] E1(t) + [(1-G)/S] E2(t) * * equals * * Var{T} = [G/S]^2 Var{E1} + [(1-G)/S]^2 Var{E2}. * * * For Var{T} to always be unity, given that Var{E1} and Var{E2} are unity * by construction, it is required that * * (G^2)/(S^2) + [(1-G)^2]/(S^2) = ((G^2) + [(1-G)^2])/(S^2) = 1. * * This is guaranteed by our definition of S. * * In addition to the two random variables E1(t) and E2(t), we need a third * random variable U(t) to incorporate agents' prediction errors. These * errors, also having unit variance by construction, add to agents forward * rate prediction based on the weighting of the error terms E1(t) and E2(t). * The variance of U(t) is scaled by the factor Z to incorporate the degree * of prediction error desired in any given simulation---Z can range from * zero upward. * * FIRST WE SET THE SAMPLE SPACE * SAMPLE 1 300 * * EDIT THE TWO LINES BELOW TO IMPOSE ON THE SIMULATION RUN THE DESIRED * VALUES OF G AND Z. THE CLOSER G IS TO 1.0 THE GREATER THE FRACTION * OF THE EXCHANGE RATE INNOVATION POTENTIALLY PREDICTABLE BY AGENTS. * THE BIGGER Z IS ABOVE 0.0, THE BIGGER AGENTS' PREDICTION ERRORS---A * VALUE OF Z = 1.0 IMPOSES A VARIANCE OF AGENTS' PREDICTIONS OF UNITY, * WHICH IS THE SAME AS THE VARIANCE OF THE INNOVATIONS TO THE REAL * EXCHANGE RATE. GEN1 G = 0.0 GEN1 Z = 0.5 * GEN1 S = (sqrt((G**2)+((1-G)**2))) GEN1 CHKNUM = (G**2)/(S**2)+((1-G)**2)/(S**2) GEN1 CHKNUM * * When we give the regression coefficients in the forward discount * hypothesis an errors in the variables interpretation, we can show that * the true value of the coefficient b1 equals the ratio of [(G^2)/S^2)] to * ( [(G^2)/(S^2)] + Z^2 ). Here Z^2 is the variance of the prediction * error (which equals the square of the scale factor Z times the variance * of U(t) which is unity by construction. * * SO WE CALCULATE THE TRUE VALUE OF THE COEFFICIENT b1 as * GEN1 B1 = (G**2/S**2)/((G**2/S**2)+Z**2) * * NEXT WE CONSTRUCT THE THREE ERROR TERMS * GENR E1 = NOR(1) GENR E2 = NOR(1) GENR U = NOR(1) * * NEXT WE CONSTRUCT THE REAL EXCHANGE RATE SERIES * GENR REX = (G/S)*E1+((1-G)/S)*E2 SAMPLE 2 300 GENR REX = LAG(REX)+(G/S)*E1+((1-G)/S)*E2 * * AND THEN THE FORWARD EXCHANGE RATE SERIES * GENR FPREX = LAG(REX)+(G/S)*E1+Z*U * * THE CHANGE IN THE SPOT RATE FROM t-1 TO t IS * GENR CHGREX = REX-LAG(REX) * * AND THE LAGGED FORWARD DISCOUNT OR FORWARD PREDICTION OF THE CHANGE * IN THE SPOT RATE IS * GENR LAGFDISC = FPREX-REX * * NOW WE PLOT THE SERIES. * * COMMENT OUT THE THREE LINES BELOW TO SUPRESS THE PLOTS PLOT REX FPREX / TIME PLOT REX FPREX PLOT CHGREX LAGFDISC * * RUN THE REGRESSION POSED BY THE FORWARD RATE HYPOTHESIS * OLS REX FPREX / NOCONSTANT COEF=ESTBO STDERR=SEBO * * EXTRACT AND RENAME IMPORTANT STATISTICS * THE R2 GEN1 RSQFR=$R2 * THE MEAN SQUARED ERROR GEN1 MSE=$SSE/$DF * THE ESTIMATE OF B0 IS GIVEN BY THE VARIABLE ESTBO * THE STANDARD ERROR OF ESTIMATED B0 IS GIVEN BY THE VARIABLE SEBO * THE t-ratio FOR THE DEVIATION OF b0 FROM UNITY -- FORWARD RATE HYPOTHESIS GEN1 TRATFR = (1-ESTBO)/SEBO * * RUN THE REGRESSION POSED BY THE FORWARD DISCOUNT HYPOTHESIS * OLS CHGREX FPREX / NOCONSTANT COEF=ESTB1 STDERR=SEB1 * * EXTRACT AND RENAME IMPORTANT STATISTICS * THE R2 GEN1 RSQFD=$R2 * THE MEAN SQUARED ERROR GEN1 MSE=$SSE/$DF * THE ESTIMATE OF B1 IS GIVEN BY THE VARIABLE ESTB1 * THE STANDARD ERROR OF ESTIMATED B1 IS GIVEN BY THE VARIABLE SEB1 * THE t-ratio FOR THE DEVIATION OF ESTIMATED B1 FROM TRUE B1 --- FORWARD * DISCOUNT HYPOTHESIS (ERRORS IN VARIABLES INTERPRETATION) GEN1 TRATFD = (ESTB1 - B1)/SEB1 * * PRESENT CALCULATED STATISTICS * GEN1 ESTBO GEN1 TRATFR GEN1 RSQFR * GEN1 B1 GEN1 ESTB1 GEN1 TRATFD GEN1 RSQFD * * COMMENT OUT THE TWO LINES BELOW TO PREVENT THE DATA GENERATED IN THIS * SIMULATION RUN FROM BEING PRINTED WRITE(REXSIM.MAT) REX FPREX CHGREX LAGFDISC * STOP