hfgolino / EGAnet

43 stars 9 forks source link

Feature Request: Marginal Correlations Only? #164

Open emstruong opened 2 hours ago

emstruong commented 2 hours ago

Is your feature request related to a problem? Please describe. Would it be possible to use EGA for just the marginal correlations? Perhaps even use the cluster detections on the marginal correlations?

Describe the solution you'd like EGA(model = c("BGGM", "glasso", "TMFG", "marginal"), ...)

Describe alternatives you've considered Doing it by hand with library(qgraph) and library(correlation)

Additional context It'd be really handy...

AlexChristensen commented 2 hours ago

You can use community.detection on a correlation matrix:

# Example data
data <- wmt2[,7:24]

# Compute correlations
correlations <- auto.correlate(data)

# Set up EGA class object
ega_object <- list(
  network = correlations,
  wc = community.detection(correlations)
); class(ega_object) <- "EGA"

# Plot
plot(ega_object)
emstruong commented 2 hours ago

You can use community.detection on a correlation matrix:

# Example data
data <- wmt2[,7:24]

# Compute correlations
correlations <- auto.correlate(data)

# Set up EGA class object
ega_object <- list(
  network = correlations,
  wc = community.detection(correlations)
); class(ega_object) <- "EGA"

# Plot
plot(ega_object)

This is great! ...So any chance it could be completely automated as part of one of the EGA arguments? It's really handy when you're just quickly looking at a dataset that you've never seen before and have little understanding of.

AlexChristensen commented 1 hour ago

We could create an independent function that performs the code chunk above but we would not incorporate it directly into EGA

emstruong commented 1 hour ago

Works fine for me!