* * Examples of ACF's from pages 50-51 * all 20 * * These use the procedure eqntoacf to produce the autocorrelation * functions for a model. The EQUATION instruction is used to input * the models. For this use, we use the AR and MA parameters (3rd and * 4th) on the EQUATION instruction to set the number of AR's and MA's. * A constant is added by default - since an intercept doesn't matter * for our purposes, we use the NOCONSTANT option to leave it out. The only * exception to this is the white noise equation, which wouldn't have * any explanatory variables if not for the constant. We put the generated * autocorrelation functions into five separate series. * equation(const,coeffs=||0.0||) arma y 0 0 @eqntoacf(number=20,corrs) arma acfwn equation(noconst,coeffs=||0.8||) arma y 0 1 @eqntoacf(number=20,corrs) arma acfma1 equation(noconst,coeffs=||-.6,+.3,-.5,+.5||) arma y 0 4 @eqntoacf(number=20,corrs) arma acfma4 equation(noconst,coeffs=||0.8||) arma y 1 0 @eqntoacf(number=20,corrs) arma acfar1 equation(noconst,coeffs=||-.8||) arma y 1 0 @eqntoacf(number=20,corrs) arma acfar1n * * Graph the five series in five cells of a 3x2 matrix of graphs. The collection of * options number=0,min=-1.0,max=1.0,style=bar is the standard set for graphing * autocorrelations. The point of using min and max is to ensure that the graphs * have a common range so a given value will have the same height no matter how * large or small the other correlations are for the same series. * grparm(font=helvetica) hlabel 24 spgraph(vfields=3,hfields=2,header='Figure 3.1 Autocorrelation Functions for Assorted ARMA Processes') graph(number=0,min=-1.0,max=1.0,style=bar,hlabel='White Noise') # acfwn graph(number=0,min=-1.0,max=1.0,style=bar,hlabel='MA(4)') # acfma4 graph(number=0,min=-1.0,max=1.0,style=bar,hlabel='AR(1) with -.8') # acfar1n graph(number=0,min=-1.0,max=1.0,style=bar,hlabel='MA(1)') # acfma1 graph(number=0,min=-1.0,max=1.0,style=bar,hlabel='AR(1) with .8') # acfar1 spgraph(done) * * This computes and graphs the first lag autocorrelation for the MA(1) process * y(t)=u(t)+theta*u(t-1) for various values of theta. To get the appearance * of a continuous curve, the autocorrelations are computed on a fine grid. Here * this runs from -2.99 to 3.00 by steps of .01. The "q" on the hlabel gets * translated into a theta in symbol font. * grparm(font=symbol) hlabel 24 set theta 1 600 = (t-300)*.01 set corrs 1 600 = theta/(1+theta**2) scatter(style=lines,vmax=1.0,vmin=-1.0,vgrid=||.5,-.5||,$ header='Figure 3.2 First Autocorrelation for an MA(1) Process',hlabel='q') # theta corrs