When I remove outliers the model doesn't converge but when I estimate it without removing the outliers it converges!
When I intend to estimate the model by removing outlier data, I use returns data instead of price index data for estimation from the outset.
Here is the code:
Code: Select all
*
* Replication file for Baillie and Bollerslev, "The Message in Daily
* Exchange Rates: A Conditional Variance Tale", JBES 1989, vol 7, pp
* 297-305
*
open data data.xlsx
data(format=xlsx,org=columns) 1 3232 sto dow
*
labels sto
# "Stock"
*
* Unit root tests
* Table 1
*
source ppunit.src
report(action=define)
dofor s = sto
report(col=new,atrow=1) %l(s)
@ppunit(lags=22,det=trend) s
report(col=current,atrow=2) %cdstat
@ppunit(lags=22) s
report(col=current,atrow=3) %cdstat
end dofor
report(action=format,picture="*.###")
report(action=show)
*
* Table 2 estimates
*
report(action=define)
dofor dx = sto
report(col=new,atrow=1) %l(s)
linreg(noprint) dx
# constant dx{1}
report(col=curr,atrow=2) %beta(1)
report(col=curr,atrow=3,special=parens) %stderrs(1)
report(col=curr,atrow=4) %sigmasq
report(col=curr,atrow=5) %logl
set ustd = %resids/sqrt(%seesq)
corr(print,qstats,number=15,method=yule) ustd
report(col=curr,atrow=6) %qstat
set usqr = ustd^2
corr(print,qstats,number=15,method=yule) usqr
report(col=curr,atrow=7) %qstat
stats(noprint) %resids
report(col=curr,atrow=8) %skewness
report(col=curr,atrow=9) %kurtosis
end dofor dx
report(action=format,picture="*.###",align=decimal)
report(action=show)
*
* Table 3
*
* The DOW series is 1 for Saturday,...,5 for Wednesday. Create dummies for
* each day of the week.
*
dec vect[series] dd(5)
do i=1,5
set dd(i) = dow==(i)
end do i
*
*
* SKIP is a dummy variable which will be 1 if and only if there is a
* skipped weekday.
*
set(first=1.0) skip = .not.(dow{1}+1==dow.or.(dow{1}==5.and.dow==1))
*
nonlin(parmset=meanparms) b0 b1 b2 b3 b4 b5=-(b1+b2+b3+b4) b6
nonlin(parmset=garchshifts) w0 w1 w2 w3 w4 w5=-(w1+w2+w3+w4) w6 w7
nonlin(parmset=garchparms) alpha1 beta1 rnu
declare series uu h u
frml hmeanf = w1*dd(1)+w2*dd(2)+w3*dd(3)+w4*dd(4)+w5*dd(5)+w6*skip+w7*skip{1}
frml varf = w0+alpha1*uu{1}+beta1*h{1}+hmeanf-(alpha1+beta1)*hmeanf{1}
frml meanf = b0+b1*dd(1)+b2*dd(2)+b3*dd(3)+b4*dd(4)+b5*dd(5)+b6*dx{1}
frml logl = (u=dx-meanf),(uu(t)=u^2),(h(t)=varf(t)),%logtdensity(h,u,1./rnu)
* Create two parallel reports, one for the model estimates, one for the summary statistics
*
report(action=define,use=garchestimates)
report(action=define,use=garchsummary,hlabels=||"","Stock"||)
report(use=garchsummary,atrow=1,atcol=1,fillby=columns) "$Log L$" "$Q(15)$" "$Q^2(15)$" "$m_3$" "$m_4$" $
"$3(\hat \nu - 2)(\hat \nu - 4)^{ - 1}$"
dofor dx = sto
*
* * Get preliminary guess values for the mean parameters estimating just the mean model
*
nlls(parmset=meanparms,frml=meanf) dx
* Use the variance of the estimation to initialize the uu and h series
compute hinit=%seesq
*
set uu = %resids^2
set h = hinit
set u = %resids
*
* * Estimation of the full GARCH model will use 1 less data point than
* the mean model.
compute gstart=%regstart()+2,gend=%regend()
*
* Use base guess values for the variance mean function to avoid
* problems with negative variances.
*
compute w0=hinit,w1=w2=w3=w4=w5=w6=w7=0.0
*
* Set initial guess values for the reciprocal degrees of freedom, and
* the GARCH parameters.
compute rnu=.10
compute alpha1=.1,beta1=.8
*
maximize(parmset=meanparms+garchshifts+garchparms,pmethod=simplex,piter=10,method=bfgs,reject=(alpha1+beta1)>1.05) logl gstart gend
report(use=garchestimates,regressors,extra=stderrs)
report(use=garchsummary,col=new,atrow=1) %funcval
stats u gstart gend
set ustd gstart gend = u/sqrt(h)
corr(print,qstats,number=15,method=yule) ustd gstart gend
report(use=garchsummary,col=current,atrow=2) %qstat
set usqr gstart gend = ustd^2
corr(print,qstats,number=15,method=yule) usqr gstart gend
report(use=garchsummary,col=current,atrow=3) %qstat
stats(noprint) ustd
report(use=garchsummary,col=current,atrow=4) %skewness
report(use=garchsummary,col=current,atrow=5) %kurtosis
report(use=garchsummary,col=current,atrow=6) 3.0*(1.0/rnu-2.0)/(1.0/rnu-4.0)
end dofor dx
report(action=define,use=Table3,title="Table 3 Daily GARCH Models",$
hlabels=||"","Stock"||)
*
Regardless of whether the model converges or not, the software produces the following error, do you think any part of the convergence issue with the model is not related to this error?
The Error Occurred At Location 154, Line 7 of loop/block
## NL6. NONLIN Parameter B0 Has Not Been Initialized. Trying 0
The Error Occurred At Location 154, Line 7 of loop/block
## NL6. NONLIN Parameter B1 Has Not Been Initialized. Trying 0
The Error Occurred At Location 154, Line 7 of loop/block
## NL6. NONLIN Parameter B2 Has Not Been Initialized. Trying 0
The Error Occurred At Location 154, Line 7 of loop/block
## NL6. NONLIN Parameter B3 Has Not Been Initialized. Trying 0
The Error Occurred At Location 154, Line 7 of loop/block
## NL6. NONLIN Parameter B4 Has Not Been Initialized. Trying 0
The Error Occurred At Location 154, Line 7 of loop/block
## NL6. NONLIN Parameter B6 Has Not Been Initialized. Trying 0