Learn R Programming

qgraph (version 1.6.9)

FDRnetwork: Model selection using local False Discovery Rate

Description

This function is a wrapper arounf fdrtool to easilly compute a correlation or partial correlation network in which all nonsignificant edges are set to zero.

Usage

FDRnetwork(net, cutoff = 0.1, method = c('lfdr', 'pval', 'qval'))

Arguments

net

A correlation or partial correlation matrix

cutoff

The cutoff value to use. The edges of which the value of the first element of method are higher than the cutoff are removed. Thus, by default, edges with a local false discovery rate of higher than 0.1 are removed from the graph.

method

The method to use with the cutoff. Can be 'lfdr' for the local false discobvery rate, 'pval' for the p-value of 'qval' for the q-value.

Details

method = 'lfdr' could result in a very sparse network, so also looking at other values is advisable.

References

Bernd Klaus and Korbinian Strimmer. (2014). fdrtool: Estimation of (Local) False Discovery Rates and Higher Criticism. R package version 1.2.12. http://CRAN.R-project.org/package=fdrtool

Examples

Run this code
# NOT RUN {
### Using bfi dataset from psych ###
library("psych")
data(bfi)

### CORRELATIONS ###
# Compute correlations:
CorMat <- cor_auto(bfi[,1:25])

# Run local FDR:
CorMat_FDR <- FDRnetwork(CorMat)

# Number of edges remaining:
mean(CorMat_FDR[upper.tri(CorMat_FDR,diag=FALSE)]!=0)

# None, so might use different criterion:
CorMat_FDR <- FDRnetwork(CorMat, method = "pval")


# Compare:
L <- averageLayout(CorMat, CorMat_FDR)

layout(t(1:2))
qgraph(CorMat, layout = L, title = "Correlation network", 
       maximum = 1, cut = 0.1, minimum = 0, esize = 20)
qgraph(CorMat_FDR, layout = L, title = "Local FDR correlation network", 
       maximum = 1, cut = 0.1, minimum = 0, esize = 20)

# Centrality:
centralityPlot(list(cor=CorMat, fdr = CorMat_FDR))


### PARTIAL CORRELATIONS ###
# Partial correlation matrix:
library("parcor")
PCorMat <- cor2pcor(CorMat)

# Run local FDR:
PCorMat_FDR <- FDRnetwork(PCorMat, cutoff = 0.1, method = "pval")

# Number of edges remaining:
mean(PCorMat_FDR[upper.tri(PCorMat_FDR,diag=FALSE)]!=0)

# Compare:
L <- averageLayout(PCorMat, PCorMat_FDR)

layout(t(1:2))
qgraph(PCorMat, layout = L, title = "Partial correlation network", 
          maximum = 1, cut = 0.1, minimum = 0, esize = 20)
qgraph(PCorMat_FDR, layout = L, title = "Local FDR partial correlation network", 
          maximum = 1, cut = 0.1, minimum = 0, esize = 20)

# Centrality:
centralityPlot(list(cor=PCorMat, fdr = PCorMat_FDR))
# }

Run the code above in your browser using DataLab