R/causal.parents.R

Defines functions causal.parents

causal.parents <- function(node, vi, G, G.obs, topo) {
  G.vi <- igraph::induced.subgraph(G, vi)
  cc <- c.components(G.vi, topo)
  t <- Find(function(x) node %in% x, cc)
  pa.t <- parents(t, G.obs)
  pa <- setdiff(pa.t, node)
  pa <- topo[which(topo %in% pa)]
  return(pa)
}

Try the causaleffect package in your browser

Any scripts or data that you put into this service are public.

causaleffect documentation built on July 14, 2022, 5:07 p.m.