Bayesian Gaussian Graphical Models
Needs a package facing archival
BFpack in Imports Fix due 19 Nov 2026 21 days left
- CRAN checks, method
Method
Checks and health
CRAN runs every current package through
R CMD checkon a set of machines and publishes a result for each one. The health shown on a package page comes from these results alone.- Problems
- Notes alone never count against a package, but a warning, an error or a failure on any platform is a problem. Open CRAN deadlines are a fact of their own, shown as a clock after the mark, so the mark always says what the checks found.
- Checks only
- Health reflects CRAN's check results and nothing else. Even a package with no tests, no coverage or no recent release can have every platform OK.
- Once a day
- Results are collected once a day from files CRAN publishes. Each platform is one machine set-up, named by its R version, operating system, architecture and compiler, such as r-devel-linux-x86_64-fedora-clang.
- Platforms counted
- The 13 in 3 of 13 is the number of platform rows CRAN published for that package on the day of collection. The set of machines changes over time, so the number is not fixed, and a package missing from a platform counts as neither passing nor failing there.
- All OK13 platforms
- CRAN 30-day downloads, method
- 1,019−4.4% down on the 30 days before, the worse direction
- Dependent packages, method
Method
Reverse dependencies
Dependent packages are other packages that list this one under
Depends,ImportsorLinkingToin theirDESCRIPTIONfile. Those fields list the packages a package needs to install, so dependents break if this one is archived or broken.- As declared
- The counts follow the declarations as written, not whether a package uses the other one when it runs.
- Suggests apart
- Packages that list this one only under
Suggestsinstall and run without it, and use it for tests, examples or an optional feature. They are counted as Suggested by, never among the dependents, and a package that also lists it under one of the three fields is a dependent and is not counted again. - Zero
- Zero dependents means no current CRAN package declares a need for this one, though some may suggest it. On 29 Oct 2026, 19,585 of the 25,593 current CRAN packages had no dependent package.
- 1none suggest it
- Test coverage, method
Method
Test coverage
Test coverage is measured by downloading each CRAN package's current source file, installing its dependencies, building it and running its tests under covr.
- Almost half of CRAN has no tests to run
- Only CRAN packages are measured. Many have no percentage, most often because the package has no tests, and that blank is a recorded outcome, not missing data.
- NOT_CRAN
- Tests run with NOT_CRAN=true, so tests that skip themselves on CRAN run here, and the figure can differ from what CRAN's own checks see.
- Current version only
- Only the current version is measured, and a new version on CRAN is measured again. Older rows are kept but never filled in later. This is one package's run.
- Never 0%
- On a package page three states stay apart: measured, no tests, and not measured. Neither of the last two is ever shown as 0%.
- No testsnothing to run
- Advisories, method
Method
Security advisories
Advisories come from the R Consortium advisory database, a community record of security problems in R packages, as OSV publishes it.
- The copy
- The record is read once a day. The data is published under the Apache License 2.0 and is credited on the advisories list.
- Box under the name
- Under the package's name, a box names any advisory that affects the current release, with its fix or that there is none.
- Ranges
- Advisories state ranges, such as from 0.9.12 up to but not including 1.8.8. Each range is checked against every version CRAN has published, using the version rules R itself uses, so a release that came out after the advisory was written is still caught by its range.
- Not the package
- The rating is for the library flaw itself, not for how exposed the R package is, and it is never added up into a figure for the package.
- None known
About
Method, About Method Licence figures come from the Licences
License field of each package's DESCRIPTION file, read the way R itself reads it. No licence file is opened.tools::analyze_license() and R's own licence database, as CRAN's checks read it.| is read, so one string can offer two families.
Fit Bayesian Gaussian graphical models. The methods are separated into two Bayesian approaches for inference: hypothesis testing and estimation. There are extensions for confirmatory hypothesis testing, comparing Gaussian graphical models, and node wise predictability.
Full description
Fit Bayesian Gaussian graphical models. The methods are separated into two Bayesian approaches for inference: hypothesis testing and estimation. There are extensions for confirmatory hypothesis testing, comparing Gaussian graphical models, and node wise predictability. These methods were recently introduced in the Gaussian graphical model literature, including Williams (2019) <doi:10.31234/osf.io/x8dpr>, Williams and Mulder (2019) <doi:10.31234/osf.io/ypxd8>, Williams, Rast, Pericchi, and Mulder (2019) <doi:10.31234/osf.io/yt386>.
- Maintainer
- Philippe Rast
- Licence
- GPL-2
- Latest release
- 24 Sep 2026
- First release
- 6 Feb 2020
More details
- Releases
- 13
- Needs compilation
- Yes
- Needs R
- >= 4.0.0
- Config/roxygen2/version
- 8.0.0
- Config/testthat/edition
- 3
- Date
- 2026-09-23
- LazyData
- true
- RdMacros
- Rdpack
- RoxygenNote
- 8.0.0
Task views (0)
Earlier: Psychometric Models and Methods (until 7 Jul 2021).
Subjects (1) Method, SubjectsMethod
Subjects and collections
Subjects are the site's own grouping of CRAN packages, found by clustering. Collections are sets of packages that communities declare, such as the tidyverse.
- Subjects
- Subjects are found by clustering the words of current CRAN packages and the packages they use. No one edits them by hand.
- Collections
- Collections are sets that communities declare, through a package that installs the set or an organization on GitHub. The site finds them by rules.
- Who made each
- Subjects are marked Site and collections Community. Subjects, collections and task views are never mixed in one list.
- The day of the data
- Subjects and collections were last worked out on 22 Oct 2026.
Cite
Package
Run in R for the authors' preferred citation:
citation("BGGM")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
Balamuta, J. J. (2026). R Observatory: Metrics for BGGM version 2.2.0 [Data set]. HJJB, LLC. Data release v2026-10-29. https://doi.org/10.5281/zenodo.21843040
About
From data release v2026-10-29, which the citation names so these numbers can be found later.
Health
All 13 check platforms pass.
r-devel-linux-x86_64-debian-clangThe unreleased R on Linux, x86_64, debian-clang
OK
- Version checked
- 2.2.0
- Time taken
- 461 s
r-devel-linux-x86_64-debian-gccThe unreleased R on Linux, x86_64, debian-gcc
OK
- Version checked
- 2.2.0
- Time taken
- 320 s
r-devel-linux-x86_64-fedora-clangThe unreleased R on Linux, x86_64, fedora-clang
OK
- Version checked
- 2.2.0
- Time taken
- 308 s
r-devel-linux-x86_64-fedora-gccThe unreleased R on Linux, x86_64, fedora-gcc
OK
- Version checked
- 2.2.0
- Time taken
- 319 s
r-devel-windows-x86_64The unreleased R on Windows, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 582 s
r-oldrel-macos-arm64The previous release of R on macOS, arm64
OK
- Version checked
- 2.2.0
- Time taken
- 150 s
r-oldrel-macos-x86_64The previous release of R on macOS, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 469 s
r-oldrel-windows-x86_64The previous release of R on Windows, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 619 s
r-patched-linux-x86_64The patched release of R on Linux, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 432 s
r-release-linux-x86_64The current release of R on Linux, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 440 s
r-release-macos-arm64The current release of R on macOS, arm64
OK
- Version checked
- 2.2.0
- Time taken
- 112 s
r-release-macos-x86_64The current release of R on macOS, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 462 s
r-release-windows-x86_64The current release of R on Windows, x86_64
OK
- Version checked
- 2.2.0
- Time taken
- 469 s
- 13 OK
Over time
No change since 5 Aug 2026
As a list (14)
| Changed | Worst status | OK | Notes | Warnings | Errors |
|---|---|---|---|---|---|
| 5 Aug 2026 | OK | 13 | 0 | 0 | 0 |
| 1 Aug 2026 | Note | 12 | 1 | 0 | 0 |
| 29 Jul 2026 | OK | 13 | 0 | 0 | 0 |
| 27 Jul 2026 | Error | 12 | 0 | 0 | 1 |
| 9 Jun 2026 | OK | 13 | 0 | 0 | 0 |
| 8 Jun 2026 | Error | 12 | 0 | 0 | 1 |
| 25 Apr 2026 | OK | 12 | 0 | 0 | 0 |
| 22 Apr 2026 | Note | 11 | 3 | 0 | 0 |
| 18 Apr 2026 | Error | 10 | 3 | 0 | 1 |
| 10 Apr 2026 | Note | 11 | 3 | 0 | 0 |
| 9 Apr 2026 | Error | 10 | 3 | 0 | 1 |
| 8 Apr 2026 | Note | 11 | 3 | 0 | 0 |
| 7 Apr 2026 | Error | 10 | 3 | 0 | 1 |
| 10 Mar 2026 | Note | 11 | 3 | 0 | 0 |
Since March 2026
Downloads
Method, Downloads Method Download figures count requests logged by each distribution channel. They are not counts of installs or of users, because each channel publishes its own totals and this site reads them.Downloads
- Total downloads in the last 30 days
- 1,177+1.4% up on the 30 days before, the better directionIt is the sum of 4 channels: CRAN, r2u, autoCRAN and c2d4u.
CRAN rank
3,638 of 26,553
CRAN
1,019 downloads in the last 30 days
- Rank
- 3,638 of 26,553
- Change
- −4.4% down on the 30 days before, the worse direction
It is in the total. Take it out
r2u
87 downloads in the last 30 days
- Rank
- 2,476 of 30,526
- Change
- +222% up on the 30 days before, the better direction
It is in the total. Take it out
autoCRAN
60 downloads in the last 30 days
- Rank
- 686 of 29,233
- Change
- +27.7% up on the 30 days before, the better direction
It is in the total. Take it out
c2d4u, no longer updated
11 downloads in the last 30 days
- Rank
- 1,551 of 7,575
- Change
- −47.6% down on the 30 days before, the worse direction
It is in the total. Take it out
The total is 1,177 downloads in the last 30 days. It is the sum of 4 channels: CRAN, r2u, autoCRAN and c2d4u.
Over time
Dependencies
Code
Method, Code Method Code metrics come from reading the released source of each package version. The package is never installed, loaded or run.Code metrics
README, vignettes, a NEWS file and the shares read from its help pages. Files kept only in the repository, such as a pkgdown configuration or CI files, are read by the repository scan instead.
- Functions
- 297
- Public exports
- 33
- Lines of R code
- 16,917
- Median complexity
- 1
Functions (297)
Size and composition
Lines by kind (28,958)
| Kind | Lines | Share |
|---|---|---|
| R code | 16,917 | 58% |
| Documentation | 6,259 | 22% |
| Guides | 2,275 | 8% |
| Compiled code | 3,507 | 12% |
Lines by language
| Language | Lines | Share |
|---|---|---|
| R | 16,917 | 58% |
| Rd | 6,259 | 22% |
| C++ | 3,507 | 12% |
| Vignettes | 2,275 | 8% |
Languages are counted from file extensions.
- Files
- 231
- R functions
- 205
- Compiled functions
- 94
- Object systems
- S3: 31 methods
Complexity
- Median
- 1
- Mean
- 3.93
- Highest
- 43
- Median lines per function
- 21
About complexity
Cyclomatic complexity counts the independent paths through a function: 1 is a straight line, higher is harder to test. R functions only.
Call graph figures
- R functions
- 205
- Calls
- 154
- Unconnected
- 79
- Groups
- 7
Growth (13 releases)
Release changes
Tests
The package was built and has no tests to run.
- Lines of tests
- 0
- Exports named in tests
- 0%
Test suite
- Has tests
- No
- Test frameworks
- testthat
- Test lines per line of code
- 0
Documentation
- Exports documented
- 100%
- Arguments documented
- 100%
- Return value documented
- 100%
- Help pages with examples
- 89.3%
- Examples run in checks
- 28%
Guides (10)
Other documentation
- README
- No
- Release notes file
- Yes
- Help pages
- 84
- Lines of documentation
- 6,259
Datasets
Method, Datasets Method The datasets inside packages are read from their R objects in datasets
data/ folders when the code is analysed. Each object is described by its class, its shape and its columns, and fingerprinted so the same data can be found in other packages.data() are listed, 76,182 on CRAN and 8,045 on Bioconductor, so the list is not every file in data/.
| Dataset | Size | Columns |
|---|---|---|
| SachsData: Sachs Networkalso in 2 other packages | 7,466 × 11 | Raf, Erk, Plcg, PKC, PKA, PIP2 and 5 more |
| asd_ | 17 × 17 | CI, UP, RO, CR, SI, SM and 11 more |
| bfiData: 25 Personality items representing 5 factorsalso in 2 other packages | 2,800 × 27 | A1, A2, A3, A4, A5, C1 and 21 more |
| cswsData: Contingencies of Self-Worth Scale (CSWS)also in 1 other package | 680 × 36 | croc1, croc2, croc3, croc4, croc5, croc6 and 30 more |
| depression_ | 403 × 16 | PHQ1, PHQ2, PHQ3, PHQ4, PHQ5, PHQ6 and 10 more |
| depression_ | 403 × 16 | PHQ1, PHQ2, PHQ3, PHQ4, PHQ5, PHQ6 and 10 more |
| gssData: 1994 General Social Surveyalso in 1 other package | 1,002 × 7 | INCOME, DEGREE, CHILDREN, PINCOME, PDEGREE, PCHILDREN and 1 more |
| ifitData: ifit Intensive Longitudinal Dataalso in 1 other package | 197 × 8 | id, interested, disinterested, excited, upset, strong and 2 more |
| iriData: Interpersonal Reactivity Index (IRI)also in 1 other package | 1,973 × 29 | davi1, davi2, davi3, davi4, davi5, davi6 and 23 more |
| ptsdData: Post-Traumatic Stress Disorderalso in 2 other packages | 221 × 20 | B1, B2, B3, B4, B5, C1 and 14 more |
| ptsd_ | 16 × 16 | X1, X2, X3, X4, X5, X6 and 10 more |
| ptsd_ | 16 × 16 | X1, X2, X3, X4, X5, X6 and 10 more |
More datasets (5)
| Dataset | Size | Columns |
|---|---|---|
| ptsd_ | 16 × 16 | X1, X2, X3, X4, X5, X6 and 10 more |
| ptsd_ | 16 × 16 | X1, X2, X3, X4, X5, X6 and 10 more |
| rsaData: Resilience Scale of Adults (RSA)also in 1 other package | 675 × 34 | F1, F2, F3, F4, F5, F6 and 28 more |
| tasData: Toronto Alexithymia Scale (TAS)also in 1 other package | 1,925 × 21 | tas1, tas2, tas3, tas4, tas5, tas6 and 15 more |
| women_ | 1,190 × 6 |
People
Method, People Method People on the site are the names packages give them in their Author and maintainer identity
DESCRIPTION files: authors from the author list, and the maintainer from the Maintainer field. Spellings of one name become one person only where the rules below allow it, and when in doubt the rules keep people apart.
Maintainer since 2.1.1 (2024), previously Donald Williams (1.0.0 to 2.0.4), author
Author
Author
Repository
Method, figures by host Method Repository signals are the figures read from the source repository a package links to: stars, forks, issues, commits, releases and the time issues take to close. They are read from GitHub, GitLab, Codeberg and Bitbucket.Repository signals
URL and BugReports fields of its DESCRIPTION file. Read-only mirrors, the cran and bioc accounts on GitHub and git.bioconductor.org, are left out.
- Stars
- 4no change on 30 days ago
- Forks
- 2
- Open issues
- 1
- Last commit
- 24 Sep 2026
Activity
- Commits
- 1,212
- Open pull requests
- 0
- Tagged releases
- 0
- Latest tagged release
- –
- Issues closed in
- 22 days (median)
- Pull requests closed in
- 0 days (median)
- Pull requests merged
- 100%
- Created
- 1 Dec 2025
- Licence file reads as
- GPL-2.0
Development practices (12)
| Kind | Found |
|---|---|
| Continuous integration | GitHub Actions, R CMD check workflow The R CMD check workflow runs on Linux, macOS and Windows |
| Docs source | README.Rmd, pkgdown GitHub Pages site last deployed 2026-09-24 The repository has a site deploy workflow pkgdown site last built 2026-09-24 |
| Coverage | Coverage reporting |
| Reproducibility and dev environment | data-raw/ |
| CRAN release process | cran-comments.md |
| Research and citation | JOSS paper |
| Lint, format, editor | RStudio project |
| Git structural | .gitattributes |
Method, repository practices Method Beta Each week a scan of the public source repository a package links to looks for the tools a maintainer has set up, and the Repository section lists the findings. Repositories on GitHub and GitLab are scanned.Repository practices
R CMD build reads .Rbuildignore and leaves out files used only in development, such as .github/, .lintr, renv/, a Dockerfile and cran-comments.md, so the released source file holds almost none of them. The repository is the one place these files stay visible.
AI tools
Method, AI tools Method Beta What is found in a repository is not a measure of the code.AI tool findings
Tools
| Tool | First seen | Found | Commits crediting it |
|---|---|---|---|
| Claude Code | 15 Jan 2026 | Seen in the repository.claude.claude/agentsNamed in .Rbuildignore.claude | 33 at least |
- Seen in the repository
- Named in .Rbuildignore
Models
| Model | Commits | First commit | Last commit | Credit lines of |
|---|---|---|---|---|
| Claude Opus 5 | 19 | 16 Sep 2026 | 22 Sep 2026 | Claude Code |
| Claude Opus 4.8 | 1 | 3 Sep 2026 | 3 Sep 2026 | Claude Code |
| Claude Sonnet 5 | 12 | 1 Jul 2026 | 2 Jul 2026 | Claude Code |
| Claude Opus 4.5 | 1 | 15 Jan 2026 | 15 Jan 2026 | Claude Code |
History
Method, History Method Archived is built from CRAN's archive records, its list of check deadlines and Bioconductor's package records. Every figure is counted to 29 Oct 2026, the day the data was read.Packages leaving
- On CRAN
- Archived
- Release
Archived and back
| Archived | Back | CRAN's reason | Kind |
|---|---|---|---|
| 13 Oct 2023 | 23 Feb 2024 | requires archived package 'BFpack' | Needs an archived package |
| 6 Jul 2021 | 20 Aug 2021 | check issues were not corrected in time. donttest check | Checks not fixed |
| Version | Released | R | Events |
|---|---|---|---|
| 2.2.0 current | 24 Sep 2026 | 4.6.1 | |
| 2.1.6 | 2 Dec 2025 | 4.5.2 | |
| 2.1.5 | 22 Dec 2024 | 4.4.2 | |
| 2.1.4 | 13 Dec 2024 | 4.4.2 | |
| 2.1.3 | 5 Jul 2024 | 4.4.1 | |
| 2.1.2 | 22 Jun 2024 | 4.4.1 | |
| 2.1.1 | 23 Feb 2024 | 4.3.2 | Back on CRAN 23 Feb 2024 Maintainer: Philippe Rast |
| 2.0.4 | 20 Aug 2021 | 4.1.1 | Back on CRAN 20 Aug 2021 Archived 13 Oct 2023 “requires archived package 'BFpack'” |
Earlier versions (5)
Release notes (2.2.0)
New features
- `select.explore()` gains a `method = "BMA"` option: Bayesian model averaging as an alternative to the hard Bayes factor threshold (
method = "BF_cut"). For each edge the posterior is a spike-and-slab mixture with massP(H0 | Y)at zero and the posterior under the alternative otherwise; the reported network weights (pcor_mat_zero) are the median of this mixture, computed exactly under a normal approximation of the posterior of the Fisher-z partial correlation (truncated at 0 for one-sided hypotheses). The result is therefore deterministic and does not require stored posterior draws. The newprior.prob.H0argument (default 0.5) sets the prior probability of the null. All alternatives are supported. Foralternative = "exhaustive"the mixture has three states -- a spike at zero (H0), a positive slab (H+), and a negative slab (H-) -- mixed by the posterior hypothesis probabilities;pos_mat/neg_mat/null_matthen classify each edge by the sign of the model-averaged median (so an edge is null when the median is 0, which can happen even when H0 is not the most probable hypothesis). Thanks to Joris Mulder for the suggestion. - `select.explore()` returns edge inclusion probabilities (`incl_prob`): a matrix of posterior edge inclusion probabilities
q * BF / (q * BF + 1 - q)with prior inclusion probabilityq = 1 - prior.prob.H0(BF_10for"two.sided",BF_20for"greater"/"less", and1 - P(H0 | Y)for"exhaustive"). - `prior.prob.H0` now affects the selected graph under `method = "BF_cut"`, not only under
method = "BMA". An edge is selected when its posterior inclusion probability exceedsBF_cut / (BF_cut + 1), and is called null when the posterior probability of the null hypothesis exceeds that cutoff. With the defaultprior.prob.H0 = 0.5this is identical to the previous Bayes factor rule (BF > BF_cut) for"two.sided","greater"and"less". Foralternative = "exhaustive"the null keepsprior.prob.H0and the two directional hypotheses split the remainder equally (0.5 / 0.25 / 0.25 by default); becauseBF_1u + BF_2u = 2the inclusion probability then equals the one of"two.sided", so both alternatives select the same edges, with"exhaustive"labelling each selected edge positive or negative by the larger of the two directional probabilities.alternative = "exhaustive"withmethod = "BF_cut"now also returnspcor_mat_zero. Previously"exhaustive"used fixed equal 1/3 priors and thresholded each hypothesis separately, which madeBF_cut = 3correspond to a two-sided Bayes factor of 1.5. - `truncnorm` added to `Imports`: required for the truncated-normal draws used in the one-sided BMA alternatives.
- `explore()` no longer samples the prior by default: the Bayes factors only need the prior sd of the Fisher-z partial correlations, which is now computed analytically (numerical integration of the marginal prior
rho ~ 2 * Beta(delta/2, delta/2) - 1, independent ofp) and stored asprior_sd_z. Draws from the joint prior (prior_samp) are returned only with the new argumentstore_prior_draws = TRUE(defaultFALSE), which halves time and memory use for large networks by default.select.explore(),ggm_compare_explore()andbggm_missing()useprior_sd_z; olderexploreobjects still work inselect(). Bayes factors change slightly, because the previously sampled prior sd was affected by the matrix-F approximation (e.g. about 0.69-0.70 instead of 0.684 forprior_sd = 0.5). - `explore()` gains `store_post_draws` (default `TRUE`): all samplers used by
explore()now keep running posterior summaries of the partial correlations (post_samp$pcor_mat,pcor_sd,z_mean,z_sd). Withstore_post_draws = FALSEthep x p x iterarrayspost_samp$pcorsandpost_samp$fisher_zare not stored, so memory use no longer grows with the number of iterations.select()(all methods and alternatives) andsummary()work from these summaries when the draws are not stored; functions that need the draws (posterior_samples(),convergence(),coef(),pcor_to_cor(),predict(),predictability(),posterior_predict(),constrained_posterior()) stop with an informative error, andbggm_missing()always stores the draws. - `explore()` gains `burnin` (default 50) and `thin` (default 1): after
burniniterations,iterpost-burn-in iterations are run and everythin-th draw is stored; the running posterior summaries use all post-burn-in iterations.explore()objects no longer store the burn-in draws:post_samp$pcors,fisher_z,betaandthreshnow contain only the kept draws (previouslyiter + 50, including 50 burn-in draws). Downstream functions locate the post-burn-in draws with an internal helper, so objects created with earlier versions keep working. Objects fromestimate(),confirm()and the other functions are unchanged.
Bug fixes
- `explore(iter = )` is now the number of post-burn-in ITERATIONS, not the number of draws kept after thinning. Previously
explore(iter = i, thin = t)ranburnin + i * titerations and storedidraws, so raisingthinsilently multiplied the run time byt; it now runsburnin + iiterations and storesceiling(i / thin)of them, returned in the newn_drawselement.iterin the fitted object is the iteration count andn_drawsthe stored-draw count. With the defaultthin = 1nothing changes. - `seed = NULL` no longer re-seeds the RNG:
explore(),confirm(),ggm_compare_confirm(),ggm_search()andvar_estimate()calledset.seed(seed)unconditionally before the guardedif (!is.null(seed)) set.seed(seed). With the defaultseed = NULLthe first call wasset.seed(NULL), which re-initialises the RNG from the current time and process ID, discarding any seed the user had set and making repeated calls on the same data irreproducible even insideset.seed(). The unguarded call has been removed, so withseed = NULLthese functions now use the ambient RNG stream and are reproducible underset.seed(), asestimate()already was. Results of existing scripts that relied on the implicit re-seeding will change. - Corrected the exhaustive posterior hypothesis probabilities: for
alternative = "exhaustive", the positive/negative Bayes factors were referenced to the null modelH0instead of the unrestricted modelHu, so each carried an extra factor of the two-sided Bayes factor and double-counted the two-sided evidence. All three Bayes factors are now referenced toHuper Eq. 9 of Williams & Mulder (2019). Affectspost_proband the derivednull_mat/pos_mat/neg_matunder bothmethod = "BF_cut"andmethod = "BMA". - Corrected the prior sd in the `"greater"`, `"less"` and `"exhaustive"` selection branches of `select.explore()`: the
"greater"branch averaged a hardcoded 3x3 prior mask (upper.tri(diag(3))), giving wrong Bayes factors whenever the number of variables was not 3, and the"less"/"exhaustive"branches averaged the (near-zero) matrix diagonal into the prior standard deviation. All branches now use the off-diagonal (edge) prior sd, matching the"two.sided"branch. - Fixed a crash in `summary()` for `select.explore()` with `alternative = "less"`: the
"less"summary branch produced an emptyRelationcolumn (mat_names[upper.tri(mat_names)]on an already-flattened vector), causing a "differing number of rows" error. The greater/less summaries now share one correct branch. - `select.explore()` now uses all post-burn-in draws for the posterior mean/sd (previously the last 50 stored draws were dropped), and no longer returns
NAon the diagonal of the exhaustivenull_mat/pos_mat/neg_mat(where the posterior sd is 0). - Fixed `bggm_missing()` dropping the wrong column with `mice` >= 3.17.0 (#2):
bggm_missing()removed the.idcolumn frommice::complete(action = "long")by position (column 2), which was correct only beforemice3.17.0. Sincemice3.17.0 places.imp/.idin the last two columns, this stripped a real data column and let.idleak into the model, corrupting the data passed toestimate()/explore(). The column is now removed by name, which is robust tomice's column order. Reported by \@LilyTeesson. - `bggm_missing()` now pools the posterior draws of the imputed data sets correctly: it stacked all draws of each fit, including their 50 burn-in draws, and set
itertoiter * m + 50, so the methods that use draws51:(iter + 50)included the burn-in draws of imputations 2 to m and indexed beyond the stored draws; summaries came from the first imputation only. The pooled object now contains the 50 burn-in draws of the first fit followed by the post-burn-in draws of all fits, withiter = iter * m.betaandthreshare pooled whenever present, andpcor_mat(and, forexplore, the posterior summaries) are recomputed from the pooled draws. Also works form = 1. - `explore()` for large or n < p networks: the starting value is regularized (
solve(cov(Y) + 0.1 I)), and the matrix-F prior now usesepsilon = min(0.01, 1 / (10 p))instead of a fixed 0.01, so thatnu = 1 / epsilonstays well abovep - 1(required for a proper prior, Williams & Mulder, 2020). Results change slightly forp > 10. - C++ samplers no longer truncate the matrix-F degrees of freedom to integers (non-integer
deltafromprior_sd). - Fixed `rref_ei` not found error: Added
simple_rref()function inhelpers.Rto replace commented-outpracma::rref()call. This fixes a crash increate_matrices()when validating constraint matrices for hypothesis testing with multiple groups. - Fixed `ggm_search()` crash: The C++
searchfunction now handles edge cases where the adjacency matrix becomes all zeros or all ones, preventing "sample more elements than in x" errors. - Fixed `qplot()` deprecation warning: Replaced deprecated
qplot()withggplot()+geom_density()inplot_prior(). - Fixed `ggm_search()` proposal-set shadowing bug and BIC creep: The C++
search()function had a variable-shadowing bug wherezerosandnonzeros(pools of candidate edges) were re-declared instead of re-assigned after accepting a move, freezing them at the starting graph's configuration for the entire run. This caused systematic BIC drift under probabilistic acceptance and made reversing bad moves impossible.ggm_search()now implements a proper Metropolis-Hastings sampler with a birth-death Hastings correction as the default (probabilistic = TRUE); the greedy deterministic hill-climb is still available viaprobabilistic = FALSE. Theburn_inparameter is restored and now actually applied to discard pre-burn-in samples before computing the Bayesian Model Averaging (BMA) solution (probabilistic search only). Note: the greedy hill-climb was found to be nearly non-functional on realistic test cases, typically accepting only a single edge flip out of thousands of attempts.
Performance
- Removed unused posterior arrays from the C++ samplers used by `explore()` (also used by
estimate(),confirm()and theggm_compare_*()functions) and byvar_estimate():Theta_mcmc,cors_mcmcandSigma_mcmc(each p x p x iter) were allocated but never filled or returned inTheta_continuous,sample_prior,mv_continuous,mv_binary,mv_ordinal_albert,copulaandvar;copulaalso allocated an unused n x p x iter array of latent data. This reduces memory use substantially for large networks (e.g.mv_continuous, used withformula, allocated five p x p x iter arrays and now two). - `missing_copula` (mixed data with `impute = TRUE`) no longer returns `post_samp$Y_collect`: this n x p x iter array was never filled (all zeros) and was not used anywhere in BGGM.
Maintenance
- Added
rlangto Imports for proper use of.datapronoun in ggplot2 aesthetics. - Added unit tests for multiple functions.
- Refactored `bggm_fast.cpp` for clarity and efficiency: Removed two functions unreachable from R (
mv_ordinal_cowles,trunc_mvn; ~390 lines). Extractedcov_to_cor()andconditional_normal_params()helper functions, eliminating 17 duplicated blocks and a matrix inversion that was being computed twice per variable per MCMC iteration across 9 sampler functions. Removed dead commented-out debug code. No behavior change; file reduced from 3199 to ~2850 lines. - Fixed the `ggm_search()` test suite and added regression tests: Corrected tests that were silently exercising non-existent parameters (
bma = TRUEinstead ofbma_mean, astart =argument that doesn't exist,gamma =instead ofprior_prob,prior_sd =which isn't a parameter at all) and aplot.ggm_search()test that could never fail since no such method exists. Rewrote with correct parameter names and assertions on the returned object's fields, and added regression tests tied directly to the bugs above (probabilistic search must accept a healthy fraction of proposals;bma_posterior()must not error on the new default's output). Addedtests/testthat/test-search_cpp.Rexercising the C++search()/bic_fast()/hft_algorithm()functions directly, including a check for systematic BIC drift across a long run.