Commit 25bded24 authored by Gilles Kratzer's avatar Gilles Kratzer
Browse files

updated package following CRAN submission

parent e99a1c59
Pipeline #1688 passed with stage
in 1 second
......@@ -15,7 +15,6 @@
}}
\examples{
\dontrun{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
library(abn) #for the cache of score function
......@@ -44,18 +43,7 @@ bsc.compute.asia <- buildscorecache(data.df = asia,
data.dists = dist.asia,
max.parents = 2)
mcmc.out.asia <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(1000,99,1000),
seed = 42,
verbose = FALSE,
start.dag = "random",
prob.rev = 0.03,
prob.mbr = 0.03,
prior.choice = 2)
}
}
\keyword{datasets}
......@@ -15,7 +15,6 @@
}}
\examples{
\dontrun{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
......@@ -39,6 +38,5 @@ dist.asia <- list(Asia = "binomial",
XRay = "binomial",
Dyspnea = "binomial")
}
}
\keyword{datasets}
......@@ -15,7 +15,7 @@
}}
\examples{
\dontrun{
\donttest{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
library(abn) #for the cache of scores computing function
......
......@@ -91,16 +91,23 @@ Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journ
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
# the number of MCMC run is delibaretelly chosen too small (computing time)
# no thinning (usually not recommended)
# no burn-in (usually not recommended,
# even if not supported by any theoretical arguments)
data("mcmc_run_asia")
mcmc.out.asia <- mcmcabn(score.cache = bsc.compute.asia,
# let us run: 0.03 REV, 0.03 MBR, 0.94 MC3 MCMC jumps
# with a random DAG as starting point
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(1000,99,10000),
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = "random",
......@@ -108,5 +115,66 @@ mcmc.out.asia <- mcmcabn(score.cache = bsc.compute.asia,
prob.mbr = 0.03,
prior.choice = 2)
summary(mcmc.out.asia)
}}
summary(mcmc.out.asia.small)
# Uniquelly with MC3 moves
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = "random",
prob.rev = 0,
prob.mbr = 0,
prior.choice = 2)
summary(mcmc.out.asia.small)
#let us define a starting DAG (empty matrix = no arcs)
startDag <- matrix(data = 0,nrow = 8,ncol = 8)
#name it
colnames(startDag) <- rownames(startDag) <- names(dist.asia)
# Additionally, let us use the non informative prior
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = startDag,
prob.rev = 0,
prob.mbr = 0,
prior.choice = 1)
summary(mcmc.out.asia.small)
# let us define our very own prior
# we know that there should be a link between Smoking and LungCancer nodes
# empty matrix
priorDag <- matrix(data = 0,nrow = 8,ncol = 8)
# name it
colnames(priorDag) <- rownames(priorDag) <- names(dist.asia)
# parent = smoking; child = LungCancer
priorDag["LungCancer","Smoking"] <- 1
mcmc.out.asia.small <- mcmcabn(score.cache = bsc.compute.asia,
score = "mlik",
data.dists = dist.asia,
max.parents = 2,
mcmc.scheme = c(100,0,0),
seed = 42,
verbose = FALSE,
start.dag = startDag,
prob.rev = 0,
prob.mbr = 0,
prior.choice = 3,
prior.dag = priorDag)
summary(mcmc.out.asia.small)
}
......@@ -19,7 +19,7 @@
}}
\examples{
\dontrun{
\donttest{
## This data set was generated using the following code:
library(bnlearn) #for the dataset
library(abn) #for the cache of score function
......
......@@ -42,10 +42,12 @@ Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journ
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
data("mcmc_run_asia")
#plot the mcmc run
plot(mcmc.out.asia)
}}
#plot cumulative max score
plot(mcmc.out.asia, max.score = TRUE)
}
......@@ -30,10 +30,7 @@ There exists a \code{\link{summary}} S3 function that displays more details.
\author{Gilles Kratzer}
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
data("mcmc_run_asia")
#print the MCMC run
print(mcmc.out.asia)
}}
}
......@@ -36,10 +36,7 @@ Scutari, M. (2010). Learning Bayesian Networks with the bnlearn R Package. Journ
\examples{
\dontrun{
## Example from the asia dataset from Lauritzen and Spiegelhalter (1988) provided by Scutari (2010)
data("mcmc_run_asia")
#summary the MCMC run
summary(mcmc.out.asia)
}}
}
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment