Learn R Programming

D2C (version 1.2.1)

predict,D2C-method: predict if there is a connection between node i and node j

Description

predict if there is a connection between node i and node j

Usage

"predict"(object, i, j, data)

Arguments

object
: a D2C object
i
: index of putative cause ($1 \le i \le n$)
j
: index of putative effect ($1 \le j \le n$)
data
: dataset of observations from the DAG

Value

list with response and prob of the prediction

References

Gianluca Bontempi, Maxime Flauder (2014) From dependency to causality: a machine learning approach. Under submission

Examples

Run this code
require(RBGL)
require(gRbase)
require(foreach)
data(example)
## load the D2C object
testDAG<-new("simulatedDAG",NDAG=1, N=50,noNodes=5,
           functionType = "linear", seed=1,sdn=c(0.25,0.5))
## creates a simulatedDAG object for testing
plot(testDAG@list.DAGs[[1]])
## plot the topology of the simulatedDAG
predict(example,1,2, testDAG@list.observationsDAGs[[1]])
## predict if the edge 1->2 exists
predict(example,4,3, testDAG@list.observationsDAGs[[1]])
## predict if the edge 4->3 exists
predict(example,4,1, testDAG@list.observationsDAGs[[1]])
## predict if the edge 4->1 exists

Run the code above in your browser using DataLab