predict,D2C-method | R Documentation |
predict if there is a connection between node i and node j
## S4 method for signature 'D2C'
predict(object, i, j, data)
object |
: a D2C object |
i |
: index of putative cause ( |
j |
: index of putative effect ( |
data |
: dataset of observations from the DAG |
list with response and prob of the prediction
Gianluca Bontempi, Maxime Flauder (2015) From dependency to causality: a machine learning approach. JMLR, 2015, http://jmlr.org/papers/v16/bontempi15a.html
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.