1

I'm attempting to perform two versions of Pearson's X2 test on a network.

Here is the code i'm running:

library(bnlearn)
library(Rgraphviz)
library(gRain)
library(graph)
library(grid)
library(snow)
dag <- empty.graph(names(alarm))
modelstring(dag) <- paste("[HIST|LVF][CVP|LVV][PCWP|LVV][HYP][LVV|HYP:LVF]",
                              "[LVF][STKV|HYP:LVF][ERLO][HRBP|ERLO:HR][HREK|ERCA:HR][ERCA][HRSA|ERCA:HR]",
                              "[ANES][APL][TPR|APL][ECO2|ACO2:VLNG][KINK][MINV|INT:VLNG][FIO2]",
                              "[PVS|FIO2:VALV][SAO2|PVS:SHNT][PAP|PMB][PMB][SHNT|INT:PMB][INT]",
                              "[PRSS|INT:KINK:VTUB][DISC][MVS][VMCH|MVS][VTUB|DISC:VMCH]",
                              "[VLNG|INT:KINK:VTUB][VALV|INT:VLNG][ACO2|VALV][CCHL|ACO2:ANES:SAO2:TPR]",
                              "[HR|CCHL][CO|HR:STKV][BP|CO:TPR]", sep = "")
alarm.gs <- gs(alarm, test = "x2")
alarm.mc <- gs(alarm, test = "mc-x2", B=10000)

The x2 test runs, but the mc-x2 test staals.

I hope someone will assist in solving it.

  • Does this also stall: `alarm.mc <- gs(alarm, test = "mc-x2")` ? – Rafs Jul 30 '20 at 13:47
  • Yes, unfortunately it does. – Anders Schelde Jørgensen Aug 03 '20 at 08:24
  • Running `gs(alarm, test = "mc-x2", B=1, debug = TRUE)` in Rstudio also cause it too crash without message for me. However, these sort of things are often memory issues, and when I run it in the terminal , R crashes with error "*xmalloc: out of virtual memory*". When roughly tracking the memory with `top` I can see the memory creeping up. I'll try it on a larger PC later to see if it persists. – user20650 Aug 06 '20 at 15:22
  • ... ps please note that the permutation tests are wrong in the cran bnlearn version; these are fixed in the snapshot (from https://www.bnlearn.com/) -- but there wont really be a difference in a dataset as large as `alarm`. pps 10k permutations is a pretty big number and will take ages even if you parallelise it (see `cluster` argument. – user20650 Aug 06 '20 at 15:22
  • I will have to look into improving on my equipment. As I involve myself in more and more complex problems this issue appear more often than usually. Thank you for your help – Anders Schelde Jørgensen Aug 20 '20 at 08:08
  • okay, so I eventually tested this on my other PC. Running with `B=1` caused the memory to increase up to 64GB quickly then crash. Using `B=`100`, then learning continued until I stopped it after 10 hours. At this stage the memory was up to 85%. I think there may be either some issue with releasing memory, or perhaps there is some caching of results which will grows with the number of tests? But in a more practical issue, a permutation test is probably not required for a data set of this size, particularly if it is non-sparse. – user20650 Sep 03 '20 at 09:20

0 Answers0