The goal of bayesnetworks is to do MCMC fitting of Bayesian networks, including source & sink constraints and external network info.
And the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("USCbiostats/bayesnetworks")
The network is fitted by passing in data and network structure
library(bayesnetworks)
set.seed(1234)
x <- bn_mcmc(X = network$data, graph = network$dag_info, N = 50000)
Some diagnostic plots:
library(ggplot2)
ggplot(x, aes(iter, globalLL)) +
geom_line()
ggplot(x, aes(iter, FN)) +
geom_line(aes(color = "FN")) +
geom_line(aes(y = FP, color = "FP")) +
labs(y = "value")
ggplot(x, aes(iter, deletions)) +
geom_line(aes(color = "deletions")) +
geom_line(aes(y = additions, color = "additions")) +
labs(y = "count")
Please note that the ‘bayesnetworks’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.