Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ src/*.dll
/Meta/
src/Makevars
src/Makevars.win
docs/*
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Maintainer: Maarten Marsman <m.marsman@uva.nl>
Description: Bayesian variable selection methods for analyzing the structure of a Markov random field model for a network of binary and/or ordinal variables.
Copyright: Includes datasets 'ADHD' and 'Boredom', which are licensed under CC-BY 4. See individual data documentation for license and citation.
License: GPL (>= 2)
URL: https://Bayesian-Graphical-Modelling-Lab.github.io/bgms/
URL: https://Bayesian-Graphical-Modelling-Lab.github.io/bgms/, https://github.com/Bayesian-Graphical-Modelling-Lab/bgms
BugReports: https://github.com/Bayesian-Graphical-Modelling-Lab/bgms/issues
Imports:
Rcpp (>= 1.0.7),
Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<!-- badges: start -->

[![CRAN
Expand All @@ -7,7 +6,12 @@ Version](https://www.r-pkg.org/badges/version/bgms)](https://cran.r-project.org/
[![Total](https://cranlogs.r-pkg.org/badges/grand-total/bgms)](https://cran.r-project.org/package=bgms)
<!-- badges: end -->

# bgms <a href="https://bayesiangraphicalmodeling.com"><img src="inst/bgms_sticker.svg" height="200" align="right" /></a>
<div style="display:flex; align-items:center; justify-content:space-between;">
<h1>bgms</h1>
<a href="https://bayesiangraphicalmodeling.com">
<img src="man/figures/bgms_sticker.svg" height="200" alt="bgms website" />
</a>
</div>

**Bayesian analysis of graphical models with binary and ordinal
variables**
Expand All @@ -23,28 +27,28 @@ corresponding pseudoposterior distribution of the model parameters.

The package has two main entry points:

- `bgm()` – estimates a single network in a one-sample design.
- `bgm()` – estimates a single network in a one-sample design.
- `bgmCompare()` – compares networks between groups in an
independent-sample design.

## Effect selection

Both functions support **effect selection** with spike-and-slab priors:

- **Edges in one-sample designs**:
- **Edges in one-sample designs**:
`bgm()` models the presence or absence of edges between variables.
Posterior inclusion probabilities indicate the plausibility of each
edge and can be converted into Bayes factors for conditional
independence tests (see Marsman et al., 2025; Sekulovski et al.,
2024).

- **Communities/clusters in one-sample designs**:
- **Communities/clusters in one-sample designs**:
`bgm()` can also model community structure. Posterior probabilities
for the number of clusters quantify the plausibility of clustering
solutions and can be converted into Bayes factors (see Sekulovski et
al., 2025).

- **Group differences in independent-sample designs**:
- **Group differences in independent-sample designs**:
`bgmCompare()` models differences in edge weights and category
thresholds between groups. Posterior inclusion probabilities indicate
the plausibility of parameter differences and can be converted into
Expand All @@ -56,9 +60,9 @@ Both functions support **effect selection** with spike-and-slab priors:
For worked examples and tutorials, see the package vignettes:

- [Getting
Started](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/intro.html)
Started](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/intro.html)
- [Model
Comparison](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/comparison.html)
Comparison](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/comparison.html)
- [Diagnostics and Spike-and-Slab
Summaries](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/diagnostics.html)

Expand Down Expand Up @@ -86,7 +90,7 @@ association between the unconnected pair.
When analyzing an MRF, we often want to compare competing hypotheses:

- **Edge presence vs. edge absence** (conditional dependence
vs. independence) in one-sample designs.
vs. independence) in one-sample designs.
- **Parameter difference vs. parameter equivalence** in
independent-sample designs.

Expand All @@ -99,7 +103,7 @@ Bayesian inference avoids this problem. Using **inclusion Bayes
factors** (Huth et al., 2023; Sekulovski et al., 2024), we can quantify
evidence in both directions:

- **Evidence of edge presence** vs. **evidence of edge absence**, or
- **Evidence of edge presence** vs. **evidence of edge absence**, or
- **Evidence of parameter difference** vs. **evidence of parameter
equivalence**.

Expand All @@ -112,9 +116,9 @@ evidence*.
The current developmental version can be installed with

``` r
if (!requireNamespace("remotes")) {
install.packages("remotes")
}
if (!requireNamespace("remotes")) {
install.packages("remotes")
}
remotes::install_github("Bayesian-Graphical-Modelling-Lab/bgms")
```

Expand Down
36 changes: 21 additions & 15 deletions Readme.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@ output: github_document
bibliography: inst/REFERENCES.bib
csl: inst/apa.csl
---

```{r, echo = FALSE, message=F}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
dev = "png",
dpi = 200,
fig.align = "center",
knitr::opts_chunk$set(comment = NA)
)
library(bgms)
```

<!-- # bgms <a href="https://bayesiangraphicalmodeling.com"><img src="man/figures/bgms_sticker.svg" height="200" align="right" alt="bgms website" /></a> -->
<div style="display:flex; align-items:center; justify-content:space-between;">
<h1>bgms</h1>
<a href="https://bayesiangraphicalmodeling.com">
<img src="man/figures/bgms_sticker.svg" height="200" alt="bgms website" />
</a>
</div>

<!-- badges: start -->
[![CRAN Version](https://www.r-pkg.org/badges/version/bgms)](https://cran.r-project.org/package=bgms)
[![Downloads](https://cranlogs.r-pkg.org/badges/bgms)](https://cran.r-project.org/package=bgms)
[![Total](https://cranlogs.r-pkg.org/badges/grand-total/bgms)](https://cran.r-project.org/package=bgms)
<!-- badges: end -->

# bgms <a href="https://bayesiangraphicalmodeling.com"><img src="inst/bgms_sticker.svg" height="200" align="right" /></a>

**Bayesian analysis of graphical models with binary and ordinal variables**

Expand All @@ -38,37 +44,37 @@ distribution of the model parameters.

The package has two main entry points:

- `bgm()` – estimates a single network in a one-sample design.
- `bgm()` – estimates a single network in a one-sample design.
- `bgmCompare()` – compares networks between groups in an independent-sample
design.

## Effect selection

Both functions support **effect selection** with spike-and-slab priors:

- **Edges in one-sample designs**:
- **Edges in one-sample designs**:
`bgm()` models the presence or absence of edges between variables. Posterior
inclusion probabilities indicate the plausibility of each edge and can be
converted into Bayes factors for conditional independence tests [see @MarsmanVandenBerghHaslbeck_2024; @SekulovskiEtAl_2024].

- **Communities/clusters in one-sample designs**:
- **Communities/clusters in one-sample designs**:
`bgm()` can also model community structure. Posterior probabilities for the
number of clusters quantify the plausibility of clustering solutions and can
be converted into Bayes factors [see @SekulovskiEtAl_2025].

- **Group differences in independent-sample designs**:
- **Group differences in independent-sample designs**:
`bgmCompare()` models differences in edge weights and category thresholds
between groups. Posterior inclusion probabilities indicate the plausibility
of parameter differences and can be converted into Bayes factors for tests of
parameter equivalence [see @MarsmanWaldorpSekulovskiHaslbeck_2024].

## Learn more

For worked examples and tutorials, see the package vignettes:

- [Getting Started](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/intro.html)
- [Model Comparison](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/comparison.html)
- [Diagnostics and Spike-and-Slab Summaries](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/diagnostics.html)
- [Getting Started](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/intro.html)
- [Model Comparison](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/comparison.html)
- [Diagnostics and Spike-and-Slab Summaries](https://bayesian-graphical-modelling-lab.github.io/bgms/articles/diagnostics.html)

You can also access these directly from R with:

Expand All @@ -79,23 +85,23 @@ browseVignettes("bgms")

## Why use Markov Random Fields?

Graphical models or networks have become central in recent psychological and psychometric research [@RobinaughEtAl_2020; @MarsmanRhemtulla_2022_SIintro; @ContrerasEtAl_2019]. Most are **Markov random field (MRF)** models, where the graph structure reflects partial associations between variables [@KindermannSnell1980].
Graphical models or networks have become central in recent psychological and psychometric research [@RobinaughEtAl_2020; @MarsmanRhemtulla_2022_SIintro; @ContrerasEtAl_2019]. Most are **Markov random field (MRF)** models, where the graph structure reflects partial associations between variables [@KindermannSnell1980].

In an MRF, a missing edge between two variables implies **conditional independence** given the rest of the network [@Lauritzen2004]. In other words, the remaining variables fully explain away any potential association between the unconnected pair.

## Why use a Bayesian approach?

When analyzing an MRF, we often want to compare competing hypotheses:

- **Edge presence vs. edge absence** (conditional dependence vs. independence) in one-sample designs.
- **Edge presence vs. edge absence** (conditional dependence vs. independence) in one-sample designs.
- **Parameter difference vs. parameter equivalence** in independent-sample designs.

Frequentist approaches are limited in such comparisons: they can reject a null hypothesis, but they cannot provide evidence *for* it. As a result, when an edge or difference is excluded, it remains unclear whether this reflects true absence or simply insufficient power.

Bayesian inference avoids this problem. Using **inclusion Bayes factors** [@HuthEtAl_2023_intro; @SekulovskiEtAl_2024], we can quantify evidence in both directions:

- **Evidence of edge presence** vs. **evidence of edge absence**, or
- **Evidence of parameter difference** vs. **evidence of parameter equivalence**.
- **Evidence of edge presence** vs. **evidence of edge absence**, or
- **Evidence of parameter difference** vs. **evidence of parameter equivalence**.

This makes it possible not only to detect structure and group differences, but also to conclude when there is an *absence of evidence*.

Expand Down
File renamed without changes
Loading