@ Green, Palmquist, and Schickler (1997). @ @ "Macropartisanship: A Replication and Critique" @ @ REVISED program to simulate fractionally integrated data @ @ The purpose of this program is to provide predicted values @ @ based on an ARFIMA(0,d,0) regression of macropid on approval.@ @ Below, approval (mean-centered for each party) is inputted @ @ as the disturbance distribution. @ d=.785; i=1; kappa=1; kapsum=0; v=1; rho=1; sig=1.8; 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); */ @ simulate the effects of mics @ @ mac.dat: gal_grn, micspdiff, apppdiff @ load dat[176,3]=mac.dat; u=zeros(400,1)|(.025*dat[.,3]); 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; library pgraph; graphset; xy(seqa(1,1,rows(y)),y); @y_out=y[2:1401,1];@ y_out=trimr(y,1,0); screen off; output file=prdapp.out reset; format /rd 8,5; y_out; output off; screen on; print "avg absolute change"; meanc(abs(y_out[2:rows(y_out),1]-y_out[1:(rows(y_out)-1),1]));