* ARCH model * Data = WPI cal 1960 1 4 ;* set calendar to begin 1960:Q1 all 0 1992:2 ;* data runs until 1992:Q2 open data wpi.wk1 ;* data is assumed to be on drive a:\ data(format=wks,org=obs) / wpi set lwpi = log(wpi) * ACF plot of the raw data cor(partial=pacf,qstats,number=36,span=12,dfc=4) lwpi source(noecho) bjident.src @bjident lwpi * Since it appears non-stationary, we take a first difference. set dlwpi = lwpi - lwpi{1} ;* transform data set y = dlwpi cor(partial=pacf,qstats,number=36,span=12,dfc=4) y source(noecho) bjident.src @bjident y * Estimating ARMA model(1,4) for the differenced data boxjenk(constant,ar=1,ma=4) y / U cor(partial=pacf,qstats,number=36,span=12,dfc=4) U * Testing for arch effects set u2 = u*u lin u2 # constant u2{1 to 4} * Estimating GARCH models *source(noecho) garch.src *@GARCH y / res1 Ht1 ; * Choose ar=1, ma=4, p=1, q=1, det=const * ar=1, ma=4, p=1, q=1, det=const garch(p=1,q=1,regressors,hseries=h1) / y # constant y{1} %mvgavge{1 to 4} *asymmetric model garch(p=1,q=1,regressors, asymmetric, hseries=h2) / y # constant y{1} %mvgavge{1 to 4} *asymmetric model garch(p=1,q=1,regressors, exponenial, hseries=h3) / y # constant y{1} %mvgavge{1 to 4} graph(header="Plots of h(t)", key = below) 3 # h1 # h2 # h3 **************************************************** cal(q) 1960:1 all 2008:2 open data quarterly.xls data(format=xls,org=obs) set y = cpicore log y / ly dif ly / dly set growth = 100*dly gra(hea='Inflation Rate using CPI Core',overlay=line, $ patterns,key=below,nokbox,ovl='billions of $',vla='rate of growth') 2 ;# growth ; # y garch(p=1,q=1,hseries=hvar) / growth gra(hea='Plot of h(t) and inflation') 2; # growth; #hvar garch(p=1,q=1,exp,asymmetric, hseries=hvar2, regressors) / growth # constant %mvgavge{1} gra(hea='Plot of h(t) and inflation, EGARCH(1,1), MA(1)') 2; # growth; #hvar2