-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathReadme.Rmd
More file actions
109 lines (82 loc) · 3.97 KB
/
Readme.Rmd
File metadata and controls
109 lines (82 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output: github_document
---
<!-- README.md is generated from Readme.Rmd. Please edit that file -->
```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
dev = "png",
dpi = 200
)
```
<p align="center">
<img src="man/figures/bgms-banner.svg" width="100%" alt="bgms">
</p>
<!-- badges: start -->
[](https://cran.r-project.org/package=bgms)
[](https://cran.r-project.org/package=bgms)
[](https://cran.r-project.org/package=bgms)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://app.codecov.io/gh/Bayesian-Graphical-Modelling-Lab/bgms)
<!-- badges: end -->
**Bayesian analysis of graphical models**
The **bgms** package provides Bayesian estimation and edge selection for
Markov random field models of mixed binary, ordinal, and continuous
variables. The variable types in the data determine the model: an
**ordinal MRF** for ordinal data, a **Gaussian graphical model** for
continuous data, or a **mixed MRF** combining both. Posterior inference
uses Markov chain Monte Carlo, combining a Metropolis approach for between-model
moves (i.e., edge selection) with the No-U-Turn sampler for within-model
parameter updates. The package supports both single-threaded and parallel
chains, and uses a C++ backend for computational efficiency.
## Main functions
- `bgm()` — estimate a graphical model in a one-sample design.
- `bgmCompare()` — compare graphical models between groups.
Both functions support **edge selection** via spike-and-slab priors,
yielding posterior inclusion probabilities for each
edge. `bgm()` can additionally model **community structure**, and
`bgmCompare()` can test for **group differences** in individual
parameters.
## Installation
Install from CRAN:
```r
install.packages("bgms")
```
Or install the development version from GitHub:
```r
# install.packages("remotes")
remotes::install_github("Bayesian-Graphical-Modelling-Lab/bgms")
```
## Citation
If you use bgms in your work, please cite:
1. Marsman, M., van den Bergh, D., & Haslbeck, J. M. B. (2025).
Bayesian analysis of the ordinal Markov random field.
*Psychometrika*, *90*(1), 146–182.
[](https://doi.org/10.1017/psy.2024.4)
Related methodological papers:
2. Sekulovski, N., Keetelaar, S., Huth, K. B. S., Wagenmakers, E.-J.,
van Bork, R., van den Bergh, D., & Marsman, M. (2024). Testing
conditional independence in psychometric networks: An analysis of
three Bayesian methods. *Multivariate Behavioral Research*, *59*,
913–933.
[](https://doi.org/10.1080/00273171.2024.2345915)
3. Marsman, M., Waldorp, L. J., Sekulovski, N., & Haslbeck, J. M. B.
(2025). Bayes factor tests for group differences in ordinal and
binary graphical models. *Psychometrika*, *90*(5), 1809–1842.
[](https://doi.org/10.1017/psy.2025.10060)
4. Sekulovski, N., Arena, G., Haslbeck, J. M. B., Huth, K. B. S.,
Friel, N., & Marsman, M. (2025). A stochastic block prior for
clustering in graphical models.
[](https://osf.io/preprints/psyarxiv/29p3m_v3)
You can also retrieve the citation from R:
```r
citation("bgms")
```
## Contributing
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for
how to get started.
## Code of Conduct
This project follows the [Contributor Covenant Code of
Conduct](CODE_OF_CONDUCT.md).