Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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'.

Author(s)

Sacha Epskamp \& Adela M. Isvoranu

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

Examples

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"))

qgraph

Graph Plotting Methods, Psychometric Data Visualization and Graphical Model Estimation

v1.6.9
GPL-2
Authors
Sacha Epskamp [aut, cre], Giulio Costantini [aut], Jonas Haslbeck [aut], Adela Isvoranu [aut], Angelique O. J. Cramer [ctb], Lourens J. Waldorp [ctb], Verena D. Schmittmann [ctb], Denny Borsboom [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.