Skip to content

Task failed #2

Description

@TheTS

This code crashes at some point when T is above 200 (and when T = 300, doesn't seem to run at all):

SSDANOVA(hyp1="mu1=mu2=mu3", # H0
         hyp2 = "mu3>mu2>mu1", # H1
         type= 'equal', 
         f1 = c(0,0,0),
         f2=c(59.7,62.7,65.7), 
         var = c(6^2,6^2,6^2), 
         BFthresh = 3, 
         eta = 0.8, 
         T = 200, 
         seed = 10) 

The error produced is:

Error in { : task 236 failed - "missing value where TRUE/FALSE needed"

The traceback is:

traceback()
8: stop(simpleError(msg, call = expr))
7: e$fun(obj, substitute(ex), parent.frame(), e$data)
6: (function (obj, ex) 
   {
       e <- getDoPar()
       e$fun(obj, substitute(ex), parent.frame(), e$data)
   })(structure(list(args = (1:T)(.doRNG.stream = list(c(10407L, 
   636094904L, 1218453593L, 1782017094L, 1260864015L, 1859758340L, 
   2061863989L), c(10407L, -149956858L, -1342296740L, -977115029L, 
   1023403086L, -190978272L, -259017114L), c(10407L, -485421075L, 
   1390978645L, -1319636584L, -1052524345L, -1844081638L, 214077476L
   ), c(10407L, 1783509965L, -1888243428L, -1548404885L, -1452847580L, 
   -1614725690L, -713037210L), c(10407L, -1693492711L, 1839378532L, 
   -1350739592L, 738045061L, 756670425L, 2093061979L), c(10407L, 
   518235033L, 38796219L, -586960374L, 339843962L, 2043009591L, 
   925691322L), c(10407L, 1253899904L, -1960811876L, 1914288393L, 
   2060118580L, 1099291283L, -206179298L), c(10407L, -373769194L, 
   1066706016L, -2072836583L, 661937307L, -991318806L, 1309593129L
   ), c(10407L, 1060109385L, -823291193L, 1696634367L, 175818162L, 
   470220536L, 107956782L), c(10407L, 930102777L, -25880024L, 1289359440L, 
   1438611799L, -732326323L, 1197724552L), c(10407L, -697378553L, 
   1014213538L, -643914820L, -1655933141L, -901427596L, -1755975558L
    ...
5: do.call(`%dopar%`, list(obj, ex), envir = parent.frame())
4: foreach(i = 1:T) %dorng% {
       library(bain)
       if (type == "equal") {
           library(bain)
           datalist_temp <- unlist(lapply(1:length(m), function(x) rnorm(N, 
               m[x], mean(sd))))
           L_temp <- unlist(lapply(1:length(m), function(x) rep(x, 
               length = N)))
           datalist <- matrix(datalist_temp, nrow = length(m) * 
               N, ncol = 1)
           L <- matrix(L_temp, nrow = length(m) * N, ncol = 1)
           dd <- data.frame(datalist, L)
           mu <- factor(dd$L)
           y <- lm(dd$datalist ~ mu - 1)
           estimate <- coef(y)
           n <- table(dd$L)
           var1 <- summary(y)$sigma^2
           Sigma <- lapply(1:length(m), function(x) matrix(var1/n[x], 
               nrow = 1, ncol = 1))
       }
    ...
3: cal_bf_anova(N, mu1, sd, T, J, varnames, hyp2, flag_output = 0, 
       flag_fast, type, hyp2, seed)
2: cal_medbf_anova(N_min, mu1, mu2, sd, T, J, varnames, hyp1, hyp2, 
       ERr2, IRr2, BFthresh, eta, flag_fast, type, seed)
1: SSDANOVA(hyp1 = "mu1=mu2=mu3", hyp2 = "mu3>mu2>mu1", type = "equal", 
       f1 = c(0, 0, 0), f2 = c(59.7, 62.7, 65.7), var = c(6^2, 6^2, 
           6^2), BFthresh = 3, eta = 0.8, T = 265, seed = 10)

SessionInfo():

sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default


locale:
[1] LC_COLLATE=English_New Zealand.utf8  LC_CTYPE=English_New Zealand.utf8    LC_MONETARY=English_New Zealand.utf8
[4] LC_NUMERIC=C                         LC_TIME=English_New Zealand.utf8    

time zone: Pacific/Auckland
tzcode source: internal

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] doRNG_1.8.6       rngtools_1.5.2    doParallel_1.0.17 iterators_1.0.14  foreach_1.5.2     pkgmaker_0.32.10 
 [7] registry_0.5-1    conflicted_1.2.0  stringr_1.5.0     tictoc_1.2        SSDbain_0.1.0     bain_0.2.9       

loaded via a namespace (and not attached):
 [1] compiler_4.3.0   Rcpp_1.0.10      wdman_0.2.6      bitops_1.0-7     assertthat_0.2.1 fastmap_1.1.1   
 [7] pbivnorm_0.6.0   R6_2.5.1         semver_0.2.0     knitr_1.43       rlang_1.1.1      cachem_1.0.8    
[13] stringi_1.7.12   xfun_0.39        caTools_1.18.2   quadprog_1.5-8   memoise_2.0.1    RSelenium_1.7.9 
[19] cli_3.6.1        withr_2.5.0      magrittr_2.0.3   digest_0.6.31    rstudioapi_0.14  xtable_1.8-4    
[25] lifecycle_1.0.3  lavaan_0.6-16    mnormt_2.1.1     glue_1.6.2       codetools_0.2-19 stats4_4.3.0    
[31] binman_0.1.3     httr_1.4.6       tools_4.3.0 

Note that it will run when hyp2 = "Ha"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions