/* Version: 7/9/2008 made by Wen-Jen Tsay, The Institute of Economics, Academia Sinica, Taiwan */ /* Please acknowledge the copyright of this code */ new; library pgraph; graphset; load data[244,1] = new_price_deflator.txt; data = ln(data[1:244,.]); data = data[2:rows(data),1] - data[1:rows(data)-1]; data = 100*data; s1 = rows(data); load res[s1,1] = msarfima.res; t1 = rows(res); load ax[s1,3] = state11; state = ax[.,2]; d1 = 0.6261; d2 = 0.6092; p11 = 0.9866; p22 = 0.9261; sigmasq1 = (0.2819)^2; sigmasq2 = (1.1006)^2; mu1 = 0.5423; mu2 = 1.6778; phi1 = -0.2522; theta1 = -0.0129; coef1 = lowmat(toeplitz(1|cumprodc(seqa(d1,1,t1-1)./seqa(1,1,t1-1)))); coef2 = lowmat(toeplitz(1|cumprodc(seqa(d2,1,t1-1)./seqa(1,1,t1-1)))); a1 = zeros(t1,1); a1[1] = res[1]; i=2;do until i>t1; a1[i] = res[i] + phi1*a1[i-1] + theta1*res[i-1]; i=i+1;endo; a = zeros(t1,1); i=1;do until i>t1; a[i,1] = ( (state[i,1]~(1-state[i,1]))* (sqrt(sigmasq1)|sqrt(sigmasq2)) )*a1[i,1]; ; i=i+1;endo; yfit = zeros(t1,1); i=1;do until i>t1; y1 = coef1[i,.]*a[.,1]; y2 = coef2[i,.]*a[.,1]; yfit[i,1] = (state[i,1]~(1-state[i,1]))*(y1|y2) + (state[i,1]~(1-state[i,1]))*(mu1|mu2) ; ; i=i+1;endo; y = ((data))~((yfit)); x = 1947+2/4+seqa(1,1,t1)/4; output file = gout.dc; output on; screen on; format /rd 8,4; a = data-yfit; a; _ptitlht = 0.15; _paxes = 1; _pcross = 0; xlabel("\202 Year (A.D.)"); ylabel("\202Fitted Inflation Rate from MS-ARFIMA(1,d,1)"); _paxht = 0; _pnum = 2; _pnumht = 0; _pxpmax = 3; _pypmax = 3; asclabel(0,0); _pframe = 0|1; _pgrid = 0|2; _pbox =0; _pdate = ""; _ptek = "xy.tkf"; _plctrl = 0|0; _pltype = 6|3; _plwidth = 2|8 ; _pstype = 8|4; _psymsiz = 3; _pcolor = 7|4; _pmcolor = 15; _plegstr = ""; @_plegctl = 1;@ _parrow =0; _psym = 0; xy(x,y); end;