simulGBN: Simulate data from Gaussian Bayesian Networks

Description Usage Arguments Value Examples

Description

simulGBN simulates data from a GBN.

Usage

1
simulGBN(N, m, s, W, int = numeric(0), int_data = matrix(runif(N * length(int)), nrow = N), seed)

Arguments

N

integer - Number of observations to simulate.

m

vector - Mean of the simulation law. Must be the of the same dimension as s and columns of W.

s

vector - Variance of the simulation law. Must be the of the same dimension as m and columns of W.

W

matrix - Weightmatrix of the GBNetwork.

int

integer or vector of integers - Columns of the simulated data mentionned in int will have the corresponding value of int_data.

int_data

vector - Values of the columns mentionned in int.

seed

integer - The function simulate the data according to the seed.

Value

The function return a matrix of the simulated data : the number of rows is N and the number of columns is equal to the dimension of W.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Simulate data from a GBN with intervention on nodes 1 and 9. 

p<-10

W1=1*upper.tri(matrix(0,p,p))
m1=rep(0,10)
sigma1=rep(0.1,10)

X=simulGBN(2*p,m1,sigma1,W1,seed = 1990)
X=rbind(X,simulGBN(p,m1,sigma1,W1,int=1,int_data=0,seed = 1990)) 
X=rbind(X,simulGBN(p,m1,sigma1,W1,int=9,int_data=0,seed = 1990)) 

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