qgraph (version 1.6.2)

pathways: Highlight shortest pathways in a network

Description

This function highlights the shortest paths between nodes in a network made by qgraph. Based on Isvoranu et al. (2016).

Usage

pathways(graph, from, to, fading = 0.25, lty = 3)

Arguments

graph

Output from qgraph.

from

A vector indicating the first set of nodes between which pathways should be highlighted. Can be numeric or characters corresponding to node labels.

to

A vector indicating the second set of nodes between which pathways should be highlighted. Can be numeric or characters corresponding to node labels.

fading

The fading of the edges that are not part of shortest paths between 'from' and 'to'.

lty

The line type of the edges that are not part of shortest paths between 'from' and 'to'.

References

Isvoranu, A. M., van Borkulo, C. D., Boyette, L. L., Wigman, J. T., Vinkers, C. H., Borsboom, D., & Group Investigators. (2016). A Network Approach to Psychosis: Pathways Between Childhood Trauma and Psychotic Symptoms. Schizophrenia bulletin, sbw055.

See Also

qgraph

Examples

Run this code
# NOT RUN {
library("qgraph")
library("psych")
data(bfi)

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

# Compute graph with tuning = 0 (BIC):
BICgraph <- qgraph(CorMat, graph = "glasso", sampleSize = nrow(bfi),
                   tuning = 0, layout = "spring", title = "BIC", details = TRUE)

# All paths between Agreeableness and Neuroticism:
pathways(BICgraph, 
         from = c("A1","A2","A3","A4","A5"), 
         to = c("N1","N2","N3","N4","N5"))

# }

Run the code above in your browser using DataCamp Workspace