partitionMCMC {BiDAG} | R Documentation |
DAG structure sampling with partition MCMC
Description
This function implements the partition MCMC algorithm for the structure learning of Bayesian networks. This procedure provides an unbiased sample from the posterior distribution of DAGs given the data.
The search space can be defined either by a preliminary run of the function iterativeMCMC
or by a given adjacency matrix (which can be the full matrix with zero on the diagonal, to consider the entire space of DAGs, feasible only for a limited number of nodes).
Usage
partitionMCMC(
scorepar,
moveprobs = NULL,
iterations = NULL,
stepsave = NULL,
alpha = 0.05,
gamma = 1,
verbose = FALSE,
scoreout = FALSE,
compress = TRUE,
startspace = NULL,
blacklist = NULL,
scoretable = NULL,
startDAG = NULL
)
## S3 method for class 'partitionMCMC'
plot(
x,
...,
burnin = 0.2,
main = "DAG logscores",
xlab = "iteration",
ylab = "logscore",
type = "l",
col = "#0c2c84"
)
## S3 method for class 'partitionMCMC'
print(x, ...)
## S3 method for class 'partitionMCMC'
summary(object, ...)
Arguments
scorepar |
an object of class |
moveprobs |
(optional) a numerical vector of 5 values in
|
iterations |
integer, the number of MCMC steps, the default value is |
stepsave |
integer, thinning interval for the MCMC chain, indicating the number of steps between two output iterations, the default is |
alpha |
numerical significance value in |
gamma |
tuning parameter which transforms the score by raising it to this power, 1 by default |
verbose |
logical, if set to TRUE (default) messages about progress will be printed |
scoreout |
logical, if TRUE the search space and score tables are returned, FALSE by default |
compress |
logical, if TRUE adjacency matrices representing sampled graphs will be stored as a sparse Matrix (recommended); TRUE by default |
startspace |
(optional) a square matrix, of dimensions equal to the number of nodes, which defines the search space for the order MCMC in the form of an adjacency matrix; if NULL, the skeleton obtained from the PC-algorithm will be used. If |
blacklist |
(optional) a square matrix, of dimensions equal to the number of nodes, which defines edges to exclude from the search space; if |
scoretable |
(optional) object of class |
startDAG |
(optional) an adjacency matrix of dimensions equal to the number of nodes, representing a DAG in the search space defined by startspace. If startspace is defined but |
x |
object of class 'partitionMCMC' |
... |
ignored |
burnin |
number between |
main |
name of the graph; "DAG logscores" by default |
xlab |
name of x-axis; "iteration" |
ylab |
name of y-axis; "logscore" |
type |
type of line in the plot; "l" by default |
col |
colour of line in the plot; "#0c2c84" by default |
object |
object of class 'partitionMCMC' |
Value
Object of class partitionMCMC
, which contains log-score trace as well
as adjacency matrix of the maximum scoring DAG, its score and the order score. Additionally, returns all sampled DAGs (represented by their adjacency matrices), their scores,
orders and partitions See partitionMCMC class
.
Note
see also extractor functions getDAG
, getTrace
, getSpace
, getMCMCscore
.
Author(s)
Jack Kuipers, Polina Suter, the code partly derived from the partition MCMC implementation from Kuipers J, Moffa G (2017) <doi:10.1080/01621459.2015.1133426>
References
P. Suter, J. Kuipers, G. Moffa, N.Beerenwinkel (2023) <doi:10.18637/jss.v105.i09>
Kuipers J and Moffa G (2017). Partition MCMC for inference on acyclic digraphs. Journal of the American Statistical Association 112, 282-299.
Geiger D and Heckerman D (2002). Parameter priors for directed acyclic graphical models and the characterization of several probability distributions. The Annals of Statistics 30, 1412-1440.
Heckerman D and Geiger D (1995). Learning Bayesian networks: A unification for discrete and Gaussian domains. In Eleventh Conference on Uncertainty in Artificial Intelligence, pages 274-284.
Kalisch M, Maechler M, Colombo D, Maathuis M and Buehlmann P (2012). Causal inference using graphical models with the R package pcalg. Journal of Statistical Software 47, 1-26.
Kuipers J, Moffa G and Heckerman D (2014). Addendum on the scoring of Gaussian directed acyclic graphical models. The Annals of Statistics 42, 1689-1691.
Examples
## Not run:
myScore<-scoreparameters("bge", Boston)
partfit<-partitionMCMC(myScore)
plot(partfit)
## End(Not run)