SEMpath {SEMgraph}R Documentation

Search for directed or shortest paths between pairs of source-sink nodes

Description

Find and fit all directed or shortest paths between two source-sink nodes of a graph.

Usage

SEMpath(graph, data, group, from, to, path, verbose = FALSE, ...)

Arguments

graph

An igraph object.

data

A matrix or data.frame. Rows correspond to subjects, and columns to graph nodes (variables).

group

A binary vector. This vector must be as long as the number of subjects. Each vector element must be 1 for cases and 0 for control subjects. If NULL (default), group influence will not be considered.

from

Starting node name (i.e., source node).

to

Ending node name (i.e., sink node).

path

If path = "directed", all directed paths between the two nodes will be included in the fitted model. If path = "shortest", only shortest paths will be returned.

verbose

Show the directed (or shortest) path between the given source-sink pair inside the input graph.

...

Currently ignored.

Value

A list of four objects: a fitted model object of class lavaan ("fit"), aggregated and node-specific group effect estimates and P-values ("gest"), the extracted subnetwork as an igraph object ("graph"), and the input graph with a color attribute mapping the chosen path ("map").

Author(s)

Mario Grassi mario.grassi@unipv.it

Examples


# Directed path fitting
path <- SEMpath(graph = sachs$graph, data = log(sachs$pkc),
                group = sachs$group,
                from = "PIP3",
                to = "Erk",
                path = "directed")

# Summaries
summary(path$fit)
print(path$gest)

# Graphs
gplot(path$map, main="path from PiP2 to Erk")
plot(path$map, layout=layout.circle, main="path from PiP2 to Erk")


[Package SEMgraph version 1.2.1 Index]