hfgolino/EGAnet

Is it incompatible with Apple Silicon?

Closed this issue · 5 comments

Congratulations on the release of the new version of EGAnet. I personally have high expectations for it. However, I was wondering if you've tested it on Apple Silicon. Even in very simple examples like below, an R Session Aborted error pops up and I'm curious whether it's not compatible with Apple Silicon.

library(EGAnet)
data <- read.delim("https://raw.githubusercontent.com/rafavsbastos/data/main/HSQ.txt")
ega.HSQ <- EGA(data)
image

Hi @AnselmJeong ,

Thanks for sending along a minimal reproducible example.

Although we haven't tested the package on silicon Macs yet (to my knowledge), there shouldn't be anything in the package that would conflict (to my knowledge)

The crash is due to data being out of range. In the data, there are -1 values which extend beyond the range of what's expected for the polychoric correlations in C (which expects values to be at minimum greater than or equal to 0 and hence the crash)

An update will be pushed that will throw an error for the expected range of the data so that R will error before it reaches the crash. Here's an example:

> library(EGAnet)
> data <- read.delim("https://raw.githubusercontent.com/rafavsbastos/data/main/HSQ.txt")
> ega.HSQ <- EGA(data)
Error: Minimum of 'data' (-1) does not match expected range(s). Range must be between: '0' and '11'

Depending on what -1 is supposed to represent should be handled appropriately. For example, I assume the -1 is missing data so below works:

library(EGAnet)
data <- read.delim("https://raw.githubusercontent.com/rafavsbastos/data/main/HSQ.txt")
data[data == -1] <- NA
ega.HSQ <- EGA(data)

With the summary:

Model: GLASSO (EBIC with gamma = 0.5)
Correlations: auto
Lambda: 0.0757329457039116 (n = 100, ratio = 0.1)

Number of nodes: 32
Number of edges: 189
Edge density: 0.381

Non-zero edge weights: 
     M    SD    Min   Max
 0.030 0.108 -0.472 0.460

----

Algorithm:  Walktrap

Number of communities:  4

 Q1  Q2  Q3  Q4  Q5  Q6  Q7  Q8  Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 Q20 Q21 
  1   2   3   4   1   2   3   4   1   2   3   4   1   2   3   4   1   2   3   4   1 
Q22 Q23 Q24 Q25 Q26 Q27 Q28 Q29 Q30 Q31 Q32 
  2   3   4   1   2   3   3   1   2   3   4 

----

Unidimensional Method: Louvain
Unidimensional: No

----

TEFI: -40.604

Adding a note for posterity: Previous behavior in this situation, based on qgraph::cor_auto, would treat -1 as an ordinal category, which is not ideal

Reopened in case of Silicon issue

Working smoothly in Apple Silicon, thank you...