SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

centralityPlot documentation says standardized by default, but actually raw0 #73

Closed mattnw closed 1 year ago

mattnw commented 1 year ago

Hi Sacha, all,

In the ?centralityPlot documentation, it says:

Note that under default setting the plot functions show the standardized centrality indices. That is, z-scores instead of raw centrality indices.

However, by default centralityPlot returns a Strength centrality plot with "raw0" scaling (i.e., raw centrality, but with the x axis modified to always include zero). Quick demonstration:

library(psych)
library(qgraph)
data(bfi)
# Compute correlations:
CorMat <- cor_auto(bfi[,1:25])
EBICgraph <- qgraph(CorMat, graph = "glasso", sampleSize = nrow(bfi),
                    tuning = 0.5, layout = "spring", title = "BIC", details = TRUE)
# Compare centrality and clustering:
centralityPlot(EBICgraph) #Default plot
centralityPlot(EBICgraph, scale = "raw0") #Notice how this matches the default plot
centralityPlot(EBICgraph, scale = "z-score") #This is the plot with z-score standardisation, which is probably the intended default (?)
centralityTable(EBICgraph) #The plot above matches the Strength values in centralityTable, so those are standardised.
SachaEpskamp commented 1 year ago

Fixed in devel version, thanks for letting me know!