Skip to content
BayesVL package for Bayesian statistical analyses in R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LectureNotes v0.8.5 Jun 14, 2019
bin v0.6.5 Apr 30, 2019
data v0.8 May 17, 2019
man v0.8.1 May 19, 2019
.gitignore first version Dec 30, 2018
BayesVL Package for Bayesian Statistical Analyses in R.pdf BayesVL Package for Bayesian Statistical Analyses in R Apr 17, 2019
BayesVL Versioning.pdf Versioning rules Apr 6, 2019 Update May 15, 2019
NAMESPACE Update May 23, 2019
documentation Versioning Rules Apr 6, 2019


The R package for visually learning the graphical structures of Bayesian networks, and performing Hamiltonian Markov chain Monte Carlo (MCMC) with 'Stan'.


* Creating the (starting) graphical structure of Bayesian networks
* Creating one or more random Bayesian networks learned from dataset with customized constraints
* Generating Stan code for structures of Bayesian networks for sampling and parameter learning
* Plotting the Bayesian network graphs 
* Performing Markov chain Monte Carlo (MCMC) simulations and plotting various graphs for posteriors check
* Compatibility with R 3.4 or newer versions

Here is the CHANGELOG

Get started


Getting started and installing the latest snapshot type in the R console:

> install.packages("devtools")
> devtools::install_github("sshpa/bayesvl")

Create appropriate Bayesian network structures

Creating a node for each variable in the proposed network

dag <- bayesvl()
dag <- bvl_addNode(dag, "B")
dag <- bvl_addNode(dag, "C")
dag <- bvl_addNode(dag, "T")
dag <- bvl_addNode(dag, "DC")
dag <- bvl_addNode(dag, "MD")

Starting to add arcs between variables (nodes) using the survey data

dag <- bvl_addArc(dag, "B", "DC")
dag <- bvl_addArc(dag, "C", "DC")
dag <- bvl_addArc(dag, "T", "DC")

Generate 'Stan' code

Generating the 'Stan' code required for building structures of the Bayesian networks required for sampling and parameter learning

stan_code <- bvl_model2Stan(dag)

Getting the model's parameters

params <- bvl_stanParams(dag)

Sample and fit the 'Stan' model

Sampling the predefined 'Stan' model

stan_fit <- bvl_modelFit(dag, data, iter=20000 , warmup=2000 , chains=4 , cores=4)
You can’t perform that action at this time.