Skip to contents

Avin, Shpitser and Pearl (2005) define the g-specific effect as the effect transmitted along a chosen subgraph g of edges with all other edges turned off; in linear systems these path-restricted effects are sums of products of path coefficients along the retained paths (Pearl 2001, Section 2). For an acyclic coefficient matrix B with B[i, j] the coefficient on the edge from i to j, the unit-change effect along g is entry (x, y) of \((I - B_g)^{-1} = I + B_g + B_g^2 + \dots\) where B_g zeroes every edge outside g. The full graph gives the total effect; the single edge from x to y gives the direct effect; total minus direct is the indirect effect. In linear models natural and controlled path-specific effects coincide.

Usage

Pseudo(B, x, y, edges = NULL)

Arguments

B

Square acyclic coefficient matrix.

x

Cause index (1-based).

y

Outcome index (1-based).

edges

Optional list of retained edges, each a length-2 vector of 1-based indices c(i, j); default all edges.

Value

List with estimate, total, direct, indirect, n_edges_used, method.

References

Avin, C., Shpitser, I. and Pearl, J. (2005), Identifiability of path-specific effects, Proc. 19th IJCAI, 357-363, Section 2. Pearl, J. (2001), Direct and indirect effects, Proc. 17th UAI, 411-420, Section 2.

Examples

# x1 -> x2 -> x3 and x1 -> x3: B[i, j] is the coefficient of x_i in x_j's equation
B <- matrix(0, 3, 3); B[1, 2] <- 0.5; B[2, 3] <- 0.4; B[1, 3] <- 0.3
Pseudo(B, x = 1, y = 3)[c("total", "direct", "indirect")]   # 0.5 * 0.4 + 0.3
#> $total
#> [1] 0.5
#> 
#> $direct
#> [1] 0.3
#> 
#> $indirect
#> [1] 0.2
#> 
Pseudo(B, x = 1, y = 3, edges = list(c(1, 2), c(2, 3)))$estimate   # only the mediated path
#> [1] 0.2