all 1566 open data daily.wk1 data(format=wk1,org=obs) / *set EGYPT = log(egp/egp{1}); set JORDAN = log(jor/jor{1}); set MOROCCO = log(mor/mor{1}); set USTATE = log(usa/usa{1}); source(noecho) DIAGNOST.src * ENTER YOUR OPTIONS HERE COMPUTE startl = 1 COMPUTE endl = 500 COMPUTE MAXLAG = 5 COMPUTE NSPAN = 4 COMPUTE NLAGS = 12 SET series = USTATE NONLIN a0 a1 c q1 p1 COMPUTE c=0.01, q1 = 0.1, p1=0.1 FRML epsilon = series - a0 - a1*series{1} LINREG(noprint) series startl+1 endl res #constant series{1} COMPUTE a0=%beta(1),a1=%beta(2) SET U startl endl = res SET H startl endl = %seesq FRML garchvar = c + abs(q1)*U{1}**2 + abs(p1)*H{1} FRML logl = H(T) = garchvar(T), U(T) = epsilon(T), $ -.5*(log(2*%PI)+log(H)+U**2/H) MAXIMIZE(method=simplex,noprint,iter=50) logl startl+MAXLAG endl NLPAR(subiter=250,cvcrit=0.000001) MAXIMIZE(method=bhhh,iter=100,recursive,trace) logl startl+MAXLAG endl ********************* ******************** DIAGNOSTICS PART ********************* SET cvar startl endl = 0.001 SET lcvar startl endl = 0.001 SET nresids startl endl = 0. SET residz startl endl = 0. DO t = startl+maxlag,endl COMPUTE residz(t) = U(t) COMPUTE cvar(t) = H(t) END DO SET nresids startl+maxlag endl = residz/sqrt(cvar) SET sqnresids startl+maxlag endl = nresids**2 DISPLAY ' ' DISPLAY ' ' DISPLAY $ '* Analyzing the normalized residuals for serial correlation and normality *' DISPLAY ' ' STATISTICS(noprint) nresids startl+maxlag endl DISPLAY @10 'Skewness' @40 'Kurtosis' DISP @10 ##.##### %skewness @40 ##.##### %kurtosis+3 @LB(lags=NLAGS,span=NSPAN,dfc=0) nresids startl+maxlag endl @JARQUEBERA nresids startl+maxlag endl @ARCHTEST(lags=NLAGS,span=NSPAN,dfc=0) nresids startl+maxlag endl DISPLAY ' ' DISPLAY ' ' DISPLAY $ '* Analyzing the squared normalized residuals for serial correlation *' @LB(lags=NLAGS,span=NSPAN,dfc=0) sqnresids startl+maxlag endl GRAPH(header='Estimated Conditional Variance') 1 #cvar startl+maxlag+1 *