/* EXGAUSS1.PRO: EXAMPLE PROGRAM TO USE THE VARHAC ESTIMATOR IN THE GAUSS PROCEDURE VHGAUSS1.SRC May 17, 1996 The input is a data matrix "datin" where each row is a different observation it1: first observation to be used it2: last observation to be used k1: first column to be used k2: last column to be used imax: maximum lag order considered ilag: if equal to 1, then all elements enter with the same lag if equal to 2, then the own lag can enter with a different lag if equal to 3, then only the own lag enters imodel: if equal to 1, then AIC is used if equal to 2, then SCHWARTZ is used if equal to 3, then fixed lag order imax is used imean: if equal to 1, then the mean will be subtracted from each series iprint: if equal to 1, then if the covariance matrix and the chosen lag order will be printed on the screen */ /* DATA SECTION: As an example, we generate 5 data series. The first one is an AR(2) and the other 4 are i.i.d. */ seed = 11211995; datin = rndns(1100,5,seed); dex = datin; datin[1,1] = 0.; datin[2,1] = 0.; i = 3; do while i <= 1100; datin[i,1] = 1.4*datin[i-1,1] - 0.5*datin[i-2,1] + dex[i,1]; i = i+ 1; endo; datin[1:1000,1] = datin[101:1100,1]; /* PARAMETER SECTION */ it1 = 1; it2 = 1000; k1 = 1; k2 = 5; ilag = 1; imodel = 2; imax = 4; imean = 0; iprint = 1; /* CALL THE VARHAC PROCEDURE */ ccc = varhac(datin,it1,it2,k1,k2,imax,ilag,imodel,imean,iprint); format /M1 /RD 10,4; print " "; print " VARHAC VARIANCE-COVARIANCE MATRIX"; print ccc; print " "; end;