Additive outlier detection

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
Anja
Posts: 8
Joined: Tue Aug 12, 2008 10:44 am

Additive outlier detection

Unread post by Anja »

Hi,
has anyone any experience of identifying additive outliers in particular the method of Franses and Ghijsels (1999)?
Thank you.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Additive outlier detection

Unread post by TomDoan »

The following will find the largest LM statistic for an additive outlier in a simple GARCH model with the mean model being just the mean and any previously detected outliers (or any other shifts).

Code: Select all

procedure GARCHOutlier y start end previous
type vect[series] *previous
*
local vect[series] dd
local series h eps dh deps grad
local integer test gstart gend
*
garch(p=1,q=1,reg,hseries=h,resids=eps,derives=dd) start end y
# constant previous 
compute gstart=%regstart(),gend=%regend()
set lmstat gstart gend = 0.0
do test=gstart,gend
   set deps gstart gend = (t==test)
   set(first=0.0) dh gstart gend = %beta(%nreg)*dh{1}+%beta(%nreg-1)*eps{1}*deps{1}
   set grad gstart gend = -.5*dh/h+.5*(eps/h)^2*dh-(eps/h)*deps
   cmom(zxmatrix=xu)
   # dd
   # grad
   compute lmstat(test)=%qform(%xx,xu)
end do test
ext(print) lmstat gstart gend
end
The following is an example using the data set from the GARCHUV.PRG example.

Code: Select all

open data garch.asc
all 1867
data(format=free,org=columns) / bp cd dm jy sf
set dlogdm = 100*log(dm/dm{1})
dec vect[series] outliers(0)
@GARCHOutlier dlogdm / outliers
dim outliers(1)
set outliers(1) = (t==1448)
@GARCHOutlier dlogdm / outliers
The process gets a bit trickier if the mean model is an AR(1) (for instance). The additive outlier needs to adjust the mean of process, not the intercept in the mean equation, that is, the mean model needs to take the form

(y(t)-mu(t))=a*(y(t-1)-mu(t-1))+eps(t)

where mu is a linear function. GARCH(REG) won't estimate a model in that form. (It wants the linear form y(t)=intercept(t)+a*y(t-1)+eps(t)).
Last edited by TomDoan on Tue Jan 27, 2009 4:31 pm, edited 1 time in total.
Anja
Posts: 8
Joined: Tue Aug 12, 2008 10:44 am

Re: Additive outlier detection

Unread post by Anja »

Thanks for the reply. But I've been trying to run the program but keep getting an error:

## SX22. Expected Type INTEGER, Got VECTOR(SERIES) Instead
>>>>er dlogdm outliers<<<<

Any ideas what I should do next?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Additive outlier detection

Unread post by TomDoan »

I corrected the example (second code segment) above. It was missing a / between dlogdm and outliers.
Post Reply