I implemented a parallel rugarch script by looping over 4 input parameters
and writing some output into two files for optimal AIC and BIC,
respectively. My PC has 4 cores.
I write output when the new AIC or BIC are  more negative than the current
ones (see the snippet below).  But now my question is: can the
parallel sessions be confused about which AIC/BIC are current? And could
ihtis implementation miss some parameter combos?
Thank you, Alec

result <- foreach(ka = ka0:kaa, .packages = 'rugarch')  %:%
  foreach(kb = kb0:kbb) %:%
  foreach(km = km0:kmm) %:%
  foreach(kn = kn0:knn) %dopar% {


#    print(c(ka, kb, km, kn))
    GARCHspec <- ugarchspec( variance.model = list(model = garchType,
garchOrder = c(km, kn)),
                             mean.model = list(armaOrder = c(ka, kb),
include.mean = TRUE),
                             distribution.model = dist)


    #fit
    aic <- infocriteria(fit)[1]  #AIC
    bic <- infocriteria(fit)[2]  #BIC
    if(aic < currAIC) {
      currAIC <- aic
      ka_aic <- ka
      kb_aic <-kb
      km_aic <- km
      kn_aic <- kn
      aic_sigma <- sigma(fit)[L]
      msg <- sprintf("%d %d %d %d %.3E %.3E\n",
                      ka, kb, km, kn, currAIC, aic_sigma)
      cat(msg, file = aic_garch_outfile, append = TRUE, sep=',')

    }
    if(bic < currBIC) {
      currBIC <- bic
      ka_bic <- ka
      kb_bic <-kb
      km_bic <- km
      kn_bic <- kn
      bic_sigma <- sigma(fit)[L]
      msg <- sprintf("%d %d %d %d %.3E %.3E\n",
                    ka, kb, km, kn, currBIC, bic_sigma)
      cat(msg, file = bic_garch_outfile, append = TRUE, sep=',')
    }

        [[alternative HTML version deleted]]

_______________________________________________
[email protected] 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.

Reply via email to