causalEffects: Direct and total causal effects trajectories

Description Usage Arguments Value Examples

Description

Computes direct and total causal effects of a list of GBN objects.

This function enables to get back the trajectories of direct and undirect causal effects through a MCMC.GBN run.

Usage

1
causalEffects(full.run)

Arguments

full.run

list - full.run can be a result of MCMC.GBN function. It's a list of gaussian bayesian networks. They must have the same number of nodes and the same names.

Value

This function returns a list of two arguments :

alphaRes

matrix - direct causal effects. The ith line of alphaRes corresponds to the direct causal effects matrix of the ith GBN of full.run.

betaRes

matrix - total causal effects. The ith line of alphaRes corresponds to the direct causal effects matrix of the ith GBN of full.run.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
seed = 1990
n = 3000
p <- 10
m<-rep(0,10)
sigma<-rep(0.1,10) 

W <- 1*upper.tri(matrix(0,p,p))

data <- dataCreate(nbData = 2*p, p = 10,KO = list(1,9), nbKO = c(p,p), W = W , m = m,sigma = sigma, seed = seed)$data

# Initial Value

W1=1*upper.tri(matrix(0,p,p)) 
m1=rep(0,p)
s1=rep(10e-4,p)
colnames(W1)=names(m1)=names(s1)=rownames(W1)=paste("N",1:p,sep="")

firstGBN = new("GBNetwork",WeightMatrix=W1,resMean=m1,resSigma=s1)
firstGBN = GBNmle(firstGBN,data,lambda= 0,sigmapre=s1)$GBN

# Algorithm

results=MCMC.GBN(data, firstGBN, nbSimulation=2000, burnIn=20, seq=1, verbose=TRUE,verbose.index=100, 
              alpha=1,lambda=0) 

alphaRes <- causalEffects(results$full.run)$alphaRes
betaRes <- causalEffects(results$full.run)$betaRes

andreamrau/GBNcausal documentation built on May 12, 2019, 3:34 a.m.