How to solve the singular matrix error in R?

I have tried to fit a dcc-garch model on 100 randome time series. To boost the performance, I have also used makePSOCKcluster Then I encountered the following error:

Error in solve.default(A) : 
  system is computationally singular: reciprocal condition number = 1.83252e-21

I have searched online, seems it is caused by a singular matrix. I have checked the determinant of my matrix, it is 0. So how could I solve this problem?

Here is my code, how can I improve it to fit the model?

start_time <- Sys.time()
#create randome 100 time series 
d <- data.frame(replicate(100,sample(0:1000,100,rep=TRUE)))
lst1 <- lapply(d, ts, start = 1909, end = 2009)

# convert t to matrix or data frame which is now a list to use in
df <-,lst1)
####c <- cov(df)
# fit dcc-Grach
garch100.spec <- ugarchspec(mean.model = list(armaOrder=c(0,0)),variance.model = list(garchOrder=c(1,1),model="sGARCH"),distribution.model = "std")
uspec = multispec(replicate(100,garch100.spec))
dcc.garch100.spec = dccspec(uspec = uspec,dccOrder = c(1,1),distribution = "mvt")

cl = makePSOCKcluster(4)
multf = multifit(uspec,df,cluster= cl) <- dccfit(dcc.garch100.spec, data=df)
#Trying to make use of multicore <- dccfit(dcc.garch100.spec, data=df, fit.control = list( = TRUE), fit = multf, cluster = cl)


end_time <- Sys.time()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.