@ Green, Palmquist, and Schickler (1997). @ @ "Macropartisanship: A Replication and Critique" @ @ REVISED program to simulate fractionally integrated data @ @ This program is a companion to arboot.gss, in that it @ @ generates simulated data and then calculates the number @ @ of lags before the autocorrelation of Y becomes negative.@ let stackc[1,2]=. . ; m=0; do while m < 1000; d=.83; @ fractional integration paramter @ nobs=176; @ number of observation in each sample @ i=1; kappa=1; kapsum=0; v=1; rho=1; sig=1.8; @ standard deviation of disturbance @ let stackr[1,3]=. . .; @ this routine generates a series of AR and MA coefficients @ @ going back nlags in time @ nlags=400; do while i <= nlags; kappa=kappa*(1/i)*(i-1-d); v=v*(1/i)*(i-1+d); kapsum=kapsum+kappa; @ next line generates autocorrelations @ @ but won't work if i > 169 @ @rho=(gamma(i+d)*gamma(1-d))/(gamma(i-d+1)*gamma(d));@ @ delete the next comment to compare results to Fuller @ @print i~v~kappa~rho;@ stackr=stackr|(i~v~kappa); i=i+1; endo; @print;@ @print kapsum " sum of all AR coefficients";@ stackr=trimr(stackr,1,0); theta=rev(stackr[.,2]); /* @ delete comment and add comment below to @ @ simulate the effects of a single disturbance @ u=zeros(1000,1); u[451,1]=1; */ u=sig*rndn(2000,1); q=1; let y[1,1]=.; @ generate a (0,d,0) series y @ do while q < rows(u)-rows(stackr); y=y|sumc(u[q:rows(stackr)+q,.] .* (theta|1)); q=q+1; endo; @y_out=y[2:1401,1];@ y_out=y[2:(nobs+1),1]; @ generate autocorrelation function @ w=1; c=1; do while c > 0; c=corrx(y_out[1+w:rows(y_out),.]~y_out[1:rows(y_out)-w,.]); c=c[2,1]; @print w~c;@ w=w+1; endo; format /ld 8,3; print w~c; stackc=stackc|w~c; m=m+1; endo; /* library pgraph; graphset; xy(seqa(1,1,rows(y)),y); screen off; output file=d.out reset; format /rd 8,5; y_out; output off; screen on; */ print; stackc=trimr(stackc,1,0); print "empirical mean and std of lags"; meanc(stackc); stdc(stackc);