betaFromW: Computes total causal effects

Description Usage Arguments Value See Also Examples

Description

In the case of a gaussian bayesian network where W is the weightmatrix (direct causal effects), beta is the matrix of total causal effects.

The function computes the inverse of (I-W)^p even if W is not upper triangular. In the case of a GBN, the graph is acyclic, it exists at least one topological order. W is upper triangular and nilpotent under these orderings.

The function is ordering rows and columns of W to make the matrix upper triangular, then computes I+W+W^2+...+W^(p-1) where p is the number of rows and columns of W.

Usage

1
betaFromW(Wgt)

Arguments

Wgt

matrix - Weightmatrix of the graph (direct causal effects). Must have dimnames of the form "N#" where # is a number.

Value

The function returns the matrix of total causal effects.

See Also

Lfct

Examples

1
2
3
4
5
6
7
p <- 10
W <- 1*upper.tri(matrix(0,10,10))
ord <- sample(1:p,10,replace = FALSE)
colnames(W) = rownames(W) = paste("N",1:p,sep = "")
W <- W[ord,ord]

betaFromW(W)

andreamrau/GBNcausal documentation built on May 12, 2019, 3:34 a.m.