DCCroll - realGARCH(1, 1) Estimation problem: Singularity

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DCCroll - realGARCH(1, 1) Estimation problem: Singularity

Reinhardus, Asse
Hi,

I am currently trying to do a multivariate forecast using the DCCroll function for a portfolio of 15 stocks (Forecast length should be 400). I tried it two times (reduced the forecast length in the second run): After around 200-260 times the function broke down due to the fact that the "system is computationally singular". I understand that this results from linearly dependent columns , i.e. strongly correlated variables or more variables than observations (I have 1216 observations per stock and 15 stocks. So this should not be the problem, I assume.)
When I checked my return correlationmatrix and my realized volatilities correlation matrix, there were no indications that I face issues such as strong correlation.
Stock Return Correlation Matrix:

Stock RV Correlation Matrix:

Also what seems odd to me is that the forecast can be done  for the first 200-260 days and then it breaks down, as this suggests that the majority of the forecasting process is working. 

Further I already forecast the univariate realGARCH time series with the same stocks before. So I know that the first stage of the DCC estimation should work.

What are possible solution strategies that I can follow?

Best, 
Asse

This is the code I am using: 
Creating the return and rv matrix:

stocks.comp <- list()
for (i in 1:length(ticker_names))
{
  stocks.comp[[i]]<-subset(data_sentivola, data_sentivola[,"ticker"] == paste(ticker_names[i]))
}


stocks.comp <- do.call(cbind, stocks.comp)

stocks.return<-as.data.frame(lapply("return", function(nm)
  stocks.comp[, colnames(stocks.comp) == nm, drop = FALSE])[[1]])
colnames(stocks.return)<-ticker_names
stocks.return<-as.xts(stocks.return, order.by=as.POSIXct(unique(data_sentivola[,"Date"]), format = "%m/%d/%Y"))
stocks.return <- stocks.return["2012-03-5/2016-12-30"]
#realized volatility
stocks.rv<-as.data.frame(lapply("rv", function(nm)
  stocks.comp[, colnames(stocks.comp) == nm, drop = FALSE])[[1]])
colnames(stocks.rv)<-ticker_names
stocks.rv<-as.xts(stocks.rv, order.by=as.POSIXct(unique(data_sentivola[,"Date"]), format = "%m/%d/%Y"))
stocks.rv<-as.xts(as.matrix(stocks.rv), order.by=as.POSIXct(unique(data_sentivola[,"Date"]), format = "%m/%d/%Y"))
stocks.rv<- stocks.rv["2012-03-5/2016-12-30"]
stocks.rv<- sqrt(stocks.rv)

This is a list of external regressors that I feed into the realGARCH spec:
ext_reg <- list(ext_reg1,ext_reg2, ext_reg3, ext_reg4) (only used in the first stage of estimation, hence this should not be a problem as I already did the univariate fitting)

This creates the different specifications that I want to use for the univariate realGARCH in the first stage estimation: data_sentivola is the initial dataset
spec.comp <- list()
for (m in 1:4) {
  for (i in 1:length(ticker_names))
  {
    data_sentivola_INT<-subset(data_sentivola, data_sentivola[,"ticker"] == paste(ticker_names[i]))
    xts_sentivola_ticker<- as.xts(data_sentivola_INT[,c("return","rv")], order.by=as.POSIXct(data_sentivola_INT[,"Date"], format = "%m/%d/%Y"))
    xts_sentivola_ticker <- xts_sentivola_ticker["2012-03-5/2016-12-30"]
   
    exter_reg <- subset(as.data.frame(ext_reg[[m]][,])
                        ,as.data.frame(ext_reg[[m]][,])[,"ticker"]==paste(ticker_names[i]))
   
    xts_external_regressors <- exter_reg[,2:ncol(exter_reg)]
    xts_external_regressors <- as.xts(xts_external_regressors,
                                      order.by=as.POSIXct(data_sentivola_INT[,"Date"], format = "%m/%d/%Y"))
    xts_external_regressors <-xts_external_regressors["2012-03-5/2016-12-30"]
    
    spec.comp[[(m-1)*15 + i]] <- ugarchspec(mean.model = list(armaOrder = c(1,0), include.mean = FALSE),
                             variance.model = list(model = 'realGARCH', garchOrder = c(1,1)
                                                   , external.regressors = xts_external_regressors)
                             , distribution.model = "sstd")
  }
}

This runs the DCCroll:
#run DCC

dccroll.comp <- list()
uspec.n = multispec(spec.comp[1:15])
dccspec.n = dccspec(uspec.n,  dccOrder = c(1,1), model = "DCC", distribution = "mvnorm")
cl = makePSOCKcluster(7)
clusterExport(cl,as.list(unique(c(ls(.GlobalEnv),ls(environment())))),envir=environment())

dccroll.comp[[1]]= dccroll(dccspec.n, data = stocks.return, n.ahead = 1, forecast.length = 285,
        solver = "solnp", refit.every = 1, refit.window = "moving",
        realizedVol = stocks.rv,
        cluster = cl,
        save.fit = TRUE,
        save.wdir = "C:/Users/asser/Documents/Master Thesis/R-Code/FitFolder")
stopCluster(cl)


_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.