dag: Causality DAGS

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/dag.R

Description

Create, test, or manipulate objects of type "causality.dag"

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
dag(nodes, edges, validate = TRUE)

is_valid_dag(graph)

is.dag(graph)

as.dag(graph)

## Default S3 method:
as.dag(graph)

## S3 method for class 'causality.graph'
as.dag(graph)

## S3 method for class 'causality.pdag'
as.dag(graph)

## S3 method for class 'causality.pattern'
as.dag(graph)

## S3 method for class 'causality.pag'
as.dag(graph)

Arguments

nodes

A character array of node names

edges

A m x 3 character matrix. Each row is an edge in the form of (node1, node2, edgetype), with node1 and node2 being in nodes. Valid edge types are listed below

validate

logical value to determine whether or not to check to see if the graph is valid before returning it. Default is TRUE

graph

A graph to coerced or tested

Details

A causality DAG is a causality graph that is directed and acylic (hence the name DAG). DAGs are typically used to represent Bayesisan Networks and Structural Equation Models (SEMs).

is_valid_dag checks to see if the input is a valid "causality.dag". Specifically, it checks that the graph is directed and acyclic.

is.dag tests whether or not an object has the class "causality.dag"

Value

dag returns object of class "causality.dag", or an error if the graph is invalid (assuming validate = TRUE).

is_valid_dag returns TRUE or FALSE depending on whether or not the input is a valid "causality.dag".

is.dag returns TRUE or FALSE.

Author(s)

Alexander Rix

References

Spirtes et al. “Causation, Prediction, and Search.”, Mit Press, 2001, p. 109.

Spirtes P. Introduction to causal inference. Journal of Machine Learning Research. 2010;11(May):1643-62.

Pearl, Judea. Causality. Cambridge university press, 2009.

See Also

Other causality classes: cgraph, pattern

Examples

1
2
3
4
5
d <- dag(c("X1", "X2", "X3"), c("X1", "X2", "-->",
                                "X2", "X3", "-->"))
d <- dag(c("X1", "X2", "X3"), c("X1", "X2", "-->",
                                "X2", "X3", "-->",
                                "X3", "X1", "-->"))

tzimiskes/causality documentation built on Sept. 15, 2019, 8:41 p.m.