* * ARIMA.PRG * Example 9.4 * * Taken from examples 16.1, 17.3, 18.1 .... in Pindyck and Rubinfeld (4th Edition, 1998) * (P&R use data through March, 1996, ours ends in February, 1996). * calendar 1960 1 12 allocate 1999:9 open data basics.wks data(format=wks,org=cols) / rate graph(key=upleft) # rate * Compute and graph autocorrelations: correlate(partial=rpcorrs,number=35) rate / rcorrs graph(key=below,style=bar,nodates,min=-1.0,max=1.0,number=1) 2 # rcorrs 2 36 # rpcorrs 2 36 * Now do same with first differences: diff rate / rdiff graph # rdiff smpl correlate(partial=rdpcorrs,number=35) rdiff / rdcorrs * Graph autcorrelations and partial autocorrleations: graph(key=below,style=bar,nodates,min=-1.0,max=1.0,number=1) 2 # rdcorrs 2 24 # rdpcorrs 2 24 * Look at second differences diff rdiff / rdiff2 graph(key=upleft) 1 # rdiff2 correlate(partial=rd2pcorrs,number=35) rdiff2 / rd2corrs graph(key=below,nodates,style=bar,min=-1.0,max=1.0,number=1) 2 # rd2corrs 2 36 # rd2pcorrs 2 36 ********************************************************************** *** Fitting ARIMA models: ********************************************************************** * Applying BOXJENK to the original (undifferenced) series, using * the DIFFS option to apply the differencing: boxjenk(ar=2,diffs=1,ma=2,constant,iters=100,define=arimaeq) rate * Alternatively, we can estimate the same model using the differenced * series (and omitting the DIFFS option): boxjenk(ar=2,ma=2,constant,iters=100,define=arimaeq) rdiff / resids * P&R try several fairly large (and hard to fit) models (AR=4,MA=4 fails to converge): boxjenk(ar=4,ma=4,constant,iters=100,define=arimaeq) rdiff boxjenk(ar=8,ma=2,constant,iters=100,define=arimaeq) rdiff boxjenk(ar=12,ma=2,constant,iters=100,define=arimaeq) rdiff * P&R settle on: boxjenk(ar=8,ma=4,constant,iters=100,define=arimaeq) rdiff / resids * 24-period ex poste forecats: smpl 1994:3 1996:2 forecast 1 # arimaeq rdiff_fore graph(key=below,header='Monthly Changes in Rate') 2 # rdiff # rdiff_fore * 18-month ex ante forecast: smpl 1995:10 1997:3 forecast 1 # arimaeq rdiff_forex graph(key=below,header='Monthly Changes in Rate') 2 # rdiff # rdiff_forex smpl * Forecast levels using identities: equation(coeffs=||1.0,1.0||) rateeq rate # rdiff rate{1} * 24-period ex poste forecats: smpl 1994:3 1996:2 forecast 2 # arimaeq rdiff_fore # rateeq rate_fore graph(key=below,header='Interest Rate Forecast') 2 # rate # rate_fore smpl * Let's try a simpler model, using non-consecutive MA lags: boxjenk(ar=0,ma=||1,6,7,9||,constant,iters=100,define=simple) rdiff / resids correlate(partial=respcorrs,number=24) resids / rescorrs graph(key=below,style=bar,nodates,min=-1.0,max=1.0,number=1) 2 # rescorrs 2 25 # respcorrs 2 25 clear rdiff_fore smpl 1995:1 1996:2 forecast 1 # arimaeq rdiff_fore forecast 1 # simple simple_fore graph(key=below,header='Monthly Changes in Rate') 3 # rdiff # rdiff_fore # simple_fore * In levels: forecast 2 # arimaeq rdiff_fore # rateeq rate_fore forecast 2 # simple simprdiff_fore # rateeq simprate_fore graph(key=below,header='Interest Rate Forecast') 3 # rate # rate_fore # simprate_fore