TIME 1961 4 SAMPLE 1961.1 1996.3 * Read the CANSIM data READ (RATES.txt) DATE PDEFL RATE * Compute an inflation rate GENR PDEFL=PDEFL/100 GENR INFL=LOG(PDEFL) - LOG(LAG(PDEFL)) * Compute a weighted moving average of past inflation rates GENR INFL4=0.2*LAG(INFL) + 0.3*LAG(INFL,2) + 0.3*LAG(INFL,3) + 0.2*LAG(INFL,4) * Because of the lags, there are 5 undefined observations at the * beginning of the sample. * Adjust the sample period to exclude the undefined observations. SAMPLE 1962.2 1996.3 * Generate a time trend GENR TREND=TIME(0) * Get an expected inflation rate as the predicted values * from an OLS regression. OLS INFL INFL4 TREND / PREDICT=EINFL * Compute a real interest rate. * The factor of 400 is needed to convert quarterly rates to * annual percentage rates. GENR RR = RATE - 400*EINFL * Write the results to a data file. SAMPLE 1963.1 1996.3 FORMAT(F10.1,2F8.2) WRITE (RR.txt) DATE RATE RR / FORMAT STOP