# NOT RUN {
##############################################
## example 1: use built-in simulated data set
##############################################
## this data comes with abn see ?ex1.dag.data
mydat <- ex1.dag.data
## setup distribution list for each node
mydists <- list(b1="binomial", p1="poisson", g1="gaussian", b2="binomial",
p2="poisson", b3="binomial", g2="gaussian", b4="binomial",
b5="binomial", g3="gaussian")
## Build cache may take some minutes for buildscorecache()
mycache <- buildscorecache(data.df = mydat, data.dists = mydists,
max.parents = 2);
# now peform 100 greedy searches
heur.res <- searchHillclimber(score.cache = mycache,
num.searches = 100, timing.on = FALSE)
plotabn(dag.m = heur.res$consensus, data.dists = mydists)
###########################
## example 2 - glmm example
###########################
## this data comes with abn see ?ex1.dag.data
mydat <- ex3.dag.data[,c(1:4,14)]
mydists <- list(b1="binomial", b2="binomial", b3="binomial",
b4="binomial")
## This takes a few seconds
mycache.mixed <- buildscorecache(data.df = mydat, data.dists = mydists,
group.var = "group", cor.vars = c("b1","b2","b3","b4"),
max.parents=2, which.nodes=c(1:4))
## Now peform 50 greedy searches
heur.res <- searchHillclimber(score.cache = mycache.mixed, num.searches = 50,
timing.on = FALSE)
## Plot the majority consensus network
plotabn(dag.m = heur.res$consensus, data.dists = mydists)
# }
Run the code above in your browser using DataLab