graph_from_top: Find graph from topological ordering

Description Usage Arguments Details Value See Also Examples

Description

Given data and a topological ordering of the causal graph this function will estimate the causal graph itself.

Usage

1
graph_from_top(X, top, measure = "deviance", which = "1se")

Arguments

X

A matrix containing the observed variables

top

A topological ordering of the variables

measure

Either "mse", "mae"

which

Either "min" or "1se"

Details

To estimate the graph, the parents of each variable is fund via model selection. As the underlying grap is assumed to be a DAG the parents of a variable X_{(j)} must be found among the variables with a lower ordering (X_{(i)})_{i<j}.

All model selection is done via cross-validation lasso.

Value

the coefficient graph estimated from the data. This is a graph which has values different from zero iff there is an arrow in the estimated causal graph. The values of the non-zero entries in this matrix are the estimated (causal) effects.

See Also

The wrapper function graph_est combines the function top_order, which estimates the topological ordering of the causal graph from data, and graph_from_top into one function that estimates the causal graph from the data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# we create some data from the graph B
n <- 1000
B <- matrix(c(0,1,0,1,
              0,0,2,0,
              0,0,0,1,
              0,0,0,0), ncol = 4, nrow = 4, byrow = TRUE)
X <- matrix(0, ncol = 4, nrow = n)
for (i in 1:4) {
  X[ ,i] <- X %*% B[ ,i] + rnorm(n)
}

# we then find the graph using a topological ordering
top <- c(1,2,3,4) # from B we know this to be the true ordering
graph_from_top(X, top)

Laksafoss/CausDiscEqVar documentation built on May 23, 2019, 1:58 a.m.