I try to find additive and innovative outliers in the German Stock Index (dax) using the method Doornik & Ooms explained in 2002:
Step 1 Estimate the baseline GARCH model to obtain log-likelihood (lb)and residuals
Step 2 Find the largest (in absolute value) standardized residual at t = s. Estimate the extended GARCH model with dummy dt=1 if (t = s) in the mean, and dt−1 in the variance. This gives estimates for the added parameters and log-likekihood (lm).
Step 3 If 2(lm-lb) < C then terminate: no further outliers are present with C=5.66+1.88log(T). T is the number of observations.
The data is the DAX (Deutscher Aktienindex) from 2014-06-02 till 2016-01-01 and I got it via Datastream cause pdfetch did not work proper at that time. My question is how I implement the dummy variables into the extended GARCH model.
My code so far:
# Preparation:
library("rugarch")
library("tseries")
library("xts")
dax <-read.csv2("~/Bachelorarbeit/Daten/DAXINDX_Time_Series_010114_010116_final.csv", stringsAsFactors=FALSE)
dax_xts<-xts(dax, order.by=as.Date.character(dax$Date, format="%Y-%m-%d")) #Convert into xts-format
dax_xts$Date=NULL #Remove "Date"-Column
storage.mode(dax_xts)<- "numeric"
colnames(dax_xts)<-c("Dax") #Rename Column-Names
dax.logs.prep<-diff(log(dax$Index), lag=1)
dax.date<-dax$Date[-1]
dax.logs<-data.frame(dax.date,dax.logs.prep)
dax_ret<-xts(dax.logs, order.by=as.Date.character(dax.logs$Date, format="%Y-%m-%d")) #Convert into xts-format
dax_ret$Date=NULL #Remove "Date"-Column
storage.mode(dax_ret)<- "numeric"
colnames(dax_ret)<-c("Index Returns") #Rename Column-Names
# Step 1: Estimate baseline GARCH model to obtain log-likelihood and residuals
dax_mod<-garch(dax_ret, order = c(1,1))
l.b<-dax_mod$n.likeli
dax_mod.res<-data.frame(dax.date, dax_mod$residuals)
# Step 2: Find largest absolute standardized residual
max(abs(dax_mod.res$dax_mod.residuals/sd(dax_mod.res$dax_mod.residuals, na.rm = TRUE)), na.rm = TRUE)
specgarch <- ugarchspec(variance.model=list(model="sGARCH", external.regressors= dummy), mean.model=list(external.regressor=dummy), distribution="norm")
garchfit <- ugarchfit(data=dax_ret, spec=specgarch)