I have a dataframe consisting of log-returns for 5 assets, with no missing values etc. I am trying to estimate the DCC-GARCH(1,1) model using rmgarch in jupyter notebook. I already installed/imported the package in notebook. However, when estimating the model, I keep getting the following error:
RRuntimeError: Error in round(object@mfit$matcoef, 6):non-numeric argument to mathematical function.
I am really stuck here. Does someone know how to solve this?
See below my code (after installing/importing the package):
%%R
# define GARCH(1,1) model
univariate_spec <- ugarchspec(mean.model = list(armaOrder = c(0,0)),
variance.model = list(garchOrder = c(1,1),model = "sGARCH"),distribution.model = "norm")
# define DCC(1,1) model
n <- dim(data)[2]
dcc_spec <- dccspec(uspec = multispec(replicate(n, univariate_spec)),
dccOrder = c(1,1),model=c("DCC"),distribution = c("mvnorm"))
%%R
dcc_fit <- dccfit(dcc_spec, data=data)
dcc_fit
First-step: univariate case (which works)
# garch_fit <- ugarchfit(spec = univariate_spec, data = data)
# garch_fit
I already converted the dataframe to as.numeric()
. I also checked whether the first step (univariate) would work and it works perfectly. The problem really exists when estimating the second step, thus multivariate dccfit case. Moreover, I tried for only 2 assets or 3 etc, in order to see if that works. I also ran the code in RStudio because I thought maybe it is not working in python, but still the same error. I really don't see what the problem seems to be!