# R: H is singular

For my thesis I need to estimate BEKK GARCH models. For this I have tried several packages. I keep getting the same error: "H is singular". I have found that this can be caused by highly correlated series, or series very close to zero.

To make sure it had nothing to do with my data (I am modeling cryptocurrencies and other asset classes), I tried to run the BEKK model on different series. I have tried to run in on Google, IBM, microsoft, GOLD index and other series, but I keep getting this error.

One example of code I have tried where I got this error is:

getSymbols("MSFT", from = startDate, to = endDate)

getSymbols("GOOG", from = startDate, to = endDate)

data <- data.frame(dailyReturn(MSFT), dailyReturn(IBM))

log_returns1 <- diff(log(MSFT$MSFT.Adjusted), lag=1) log_returns2 <- diff(log(GOOG$GOOG.Adjusted), lag=1)

log_ret <- merge(log_returns1[-1,], log_returns2[-1,])

estimate <- BEKK(log_ret, order = c(1, 1), params = NULL, fixed = NULL, method = "BFGS", verbose = T)

I still obtain parameters but the results cannot be right. I get totally different parameter estimates with different packages. Also, when plotting the dynamic correlation obtained from the model it looks more like a return series that bounces between -1 and +1.

I did get "Valid" parameters for the BTC-VIX series using the MTS BEKK package, namely no significant volatility spillover. But even here the dynamic correlation obtained from the model was not correct.

I have used: MTS and mGARCH-BEKK package.

Any help would be greatly appreciated.

• I sympathise with you but I would suggest you start with simple simulated series that you know the answers for the parameters you are looking and then use the more complicated data / real-life series. As it stands you might have a variety of causes for this (e.g. extremely high volatility) and your question is unanswerable in that sense. – usεr11852 Apr 22 at 16:10
• Thank you for your answer. I have just simulated BEKK garch data using simulateBEKK function of mgarchBEKK package in R. Using the simulated series I still get the "H is singular" and "negative inverted hessian matrix element" error. Code used: simulated = simulateBEKK(2, 1000, c(1,1)) simulated <- do.call(cbind, simulated\$eps) testEst <- BEKK(simulated, order = c(1, 1), params = NULL, fixed = NULL, method = "BFGS", verbose = T) – David Daoe Apr 22 at 17:02
• Then go even simpler and see why this fails. I appreciate this is time-consuming but there are not many better alternatives. (You could also try reading the R code to see what it does in more detail.) – usεr11852 Apr 22 at 19:37