Skip to content

Commit

Permalink
Merge branch 'main' into support-distributional
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke authored Jan 31, 2025
2 parents a99307c + d8edd37 commit a134c85
Show file tree
Hide file tree
Showing 90 changed files with 581 additions and 627 deletions.
24 changes: 12 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Type: Package
Package: bayestestR
Title: Understand and Describe Bayesian Models and Posterior Distributions
Version: 0.14.0.11
Version: 0.15.1.2
Authors@R:
c(person(given = "Dominique",
family = "Makowski",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-5375-9967", Twitter = "@Dom_Makowski")),
comment = c(ORCID = "0000-0001-5375-9967")),
person(given = "Daniel",
family = "Lüdecke",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0002-8895-3206", Twitter = "@strengejacke")),
comment = c(ORCID = "0000-0002-8895-3206")),
person(given = "Mattan S.",
family = "Ben-Shachar",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0002-4287-4801", Twitter = "@mattansb")),
comment = c(ORCID = "0000-0002-4287-4801")),
person(given = "Indrajeet",
family = "Patil",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0003-1995-6531", Twitter = "@patilindrajeets")),
comment = c(ORCID = "0000-0003-1995-6531")),
person(given = "Micah K.",
family = "Wilson",
role = "aut",
Expand All @@ -32,7 +32,7 @@ Authors@R:
family = "Wiernik",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0001-9560-6336", Twitter = "@bmwiernik")),
comment = c(ORCID = "0000-0001-9560-6336")),
person(given = "Paul-Christian",
family = "Bürkner",
role = "rev",
Expand Down Expand Up @@ -66,8 +66,8 @@ Description: Provides utilities to describe posterior
Depends:
R (>= 3.6)
Imports:
insight (>= 0.20.4),
datawizard (>= 0.12.3),
insight (>= 1.0.0),
datawizard (>= 1.0.0),
graphics,
methods,
stats,
Expand All @@ -81,6 +81,7 @@ Suggests:
blavaan,
bridgesampling,
brms,
collapse,
curl,
distributional,
effectsize,
Expand All @@ -89,14 +90,13 @@ Suggests:
ggdist,
ggplot2,
glmmTMB,
httr,
httr2,
KernSmooth,
knitr,
lavaan,
lme4,
logspline (>= 2.1.21),
marginaleffects (>= 0.21.0),
marginaleffects (>= 0.24.0),
MASS,
mclust,
mediation,
Expand All @@ -113,7 +113,8 @@ Suggests:
rstanarm,
see (>= 0.8.5),
testthat,
tweedie
tweedie,
withr
License: GPL-3
URL: https://easystats.github.io/bayestestR/
BugReports: https://github.com/easystats/bayestestR/issues
Expand All @@ -128,4 +129,3 @@ Config/testthat/parallel: true
Config/rcmdcheck/ignore-inconsequential-notes: true
Config/Needs/website: easystats/easystatstemplate
Config/Needs/check: stan-dev/cmdstanr
Remotes: easystats/insight, easystats/datawizard
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ S3method(ci,sim.merMod)
S3method(ci,slopes)
S3method(ci,stanfit)
S3method(ci,stanreg)
S3method(cwi,data.frame)
S3method(describe_posterior,BFBayesFactor)
S3method(describe_posterior,BGGM)
S3method(describe_posterior,MCMCglmm)
Expand Down Expand Up @@ -643,7 +642,6 @@ export(contr.orthonorm)
export(convert_bayesian_as_frequentist)
export(convert_p_to_pd)
export(convert_pd_to_p)
export(cwi)
export(density_at)
export(describe_posterior)
export(describe_prior)
Expand Down
19 changes: 18 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# bayestestR (development version)
# bayestestR 0.15.2

## Changes

* `describe_posterior()` no longer re-samples a model when computing
indices.

# bayestestR 0.15.1

## Changes

* Several minor changes to deal with recent changes in other packages.

## Bug fixes

* Fix to `emmeans` / `marginaleffects` / `data.frame(<rvar>)` methods when using multiple credible levels (#688).

# bayestestR 0.15.0

## Changes

Expand Down
15 changes: 8 additions & 7 deletions R/bayesfactor.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#'
#' This function compte the Bayes factors (BFs) that are appropriate to the
#' input. For vectors or single models, it will compute [`BFs for single
#' parameters()`][bayesfactor_parameters], or is `hypothesis` is specified,
#' [`BFs for restricted models()`][bayesfactor_restricted]. For multiple models,
#' parameters`][bayesfactor_parameters], or is `hypothesis` is specified,
#' [`BFs for restricted models`][bayesfactor_restricted]. For multiple models,
#' it will return the BF corresponding to [`comparison between
#' models()`][bayesfactor_models] and if a model comparison is passed, it will
#' compute the [`inclusion BF()`][bayesfactor_inclusion].
#' models`][bayesfactor_models] and if a model comparison is passed, it will
#' compute the [`inclusion BF`][bayesfactor_inclusion].
#' \cr\cr
#' For a complete overview of these functions, read the [Bayes factor vignette](https://easystats.github.io/bayestestR/articles/bayes_factors.html).

Check warning on line 11 in R/bayesfactor.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/bayesfactor.R,line=11,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 148 characters.
#'
Expand All @@ -17,19 +17,20 @@
#' @inheritParams bayesfactor_models
#' @inheritParams bayesfactor_inclusion
#'
#' @return Some type of Bayes factor, depending on the input. See [bayesfactor_parameters()], [bayesfactor_models()] or [bayesfactor_inclusion()]
#' @return Some type of Bayes factor, depending on the input. See
#' [`bayesfactor_parameters()`], [`bayesfactor_models()`] or [`bayesfactor_inclusion()`].
#'
#' @note There is also a [`plot()`-method](https://easystats.github.io/see/articles/bayestestR.html) implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}.

Check warning on line 23 in R/bayesfactor.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/bayesfactor.R,line=23,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 179 characters.
#'
#' @examplesIf require("rstanarm") && require("logspline")
#' \dontrun{
#' library(bayestestR)
#'
#' prior <- distribution_normal(1000, mean = 0, sd = 1)
#' posterior <- distribution_normal(1000, mean = .5, sd = .3)
#' posterior <- distribution_normal(1000, mean = 0.5, sd = 0.3)
#'
#' bayesfactor(posterior, prior = prior, verbose = FALSE)
#'
#' \donttest{
#' # rstanarm models
#' # ---------------
#' model <- suppressWarnings(rstanarm::stan_lmer(extra ~ group + (1 | ID), data = sleep))
Expand Down
1 change: 0 additions & 1 deletion R/bayesfactor_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ bayesfactor_parameters.stanreg <- function(posterior,
}



#' @rdname bayesfactor_parameters
#' @export
bayesfactor_parameters.brmsfit <- bayesfactor_parameters.stanreg
Expand Down
11 changes: 0 additions & 11 deletions R/bci.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ bci <- function(x, ...) {
bcai <- bci



#' @rdname bci
#' @export
bci.numeric <- function(x, ci = 0.95, verbose = TRUE, ...) {
Expand All @@ -40,7 +39,6 @@ bci.numeric <- function(x, ci = 0.95, verbose = TRUE, ...) {
}



#' @rdname bci
#' @inheritParams p_direction
#' @export
Expand All @@ -66,7 +64,6 @@ bci.data.frame <- function(x, ci = 0.95, rvar_col = NULL, verbose = TRUE, ...) {
}



#' @export
bci.draws <- function(x, ci = 0.95, verbose = TRUE, ...) {
dat <- .compute_interval_dataframe(x = .posterior_draws_to_df(x), ci = ci, verbose = verbose, fun = "bci")
Expand All @@ -89,7 +86,6 @@ bci.MCMCglmm <- function(x, ci = 0.95, verbose = TRUE, ...) {
}



#' @export
bci.mcmc <- function(x, ci = 0.95, verbose = TRUE, ...) {
d <- as.data.frame(x)
Expand All @@ -99,7 +95,6 @@ bci.mcmc <- function(x, ci = 0.95, verbose = TRUE, ...) {
}



#' @export
bci.bamlss <- function(x,
ci = 0.95,
Expand All @@ -114,7 +109,6 @@ bci.bamlss <- function(x,
}



#' @export
bci.bcplm <- function(x, ci = 0.95, verbose = TRUE, ...) {
d <- insight::get_parameters(x)
Expand All @@ -137,7 +131,6 @@ bci.mcmc.list <- bci.bcplm
bci.BGGM <- bci.bcplm



#' @rdname bci
#' @export
bci.sim.merMod <- function(x,
Expand All @@ -161,7 +154,6 @@ bci.sim.merMod <- function(x,
}



#' @rdname bci
#' @export
bci.sim <- function(x, ci = 0.95, parameters = NULL, verbose = TRUE, ...) {
Expand All @@ -178,7 +170,6 @@ bci.sim <- function(x, ci = 0.95, parameters = NULL, verbose = TRUE, ...) {
}



#' @rdname bci
#' @export
bci.emmGrid <- function(x, ci = 0.95, verbose = TRUE, ...) {
Expand Down Expand Up @@ -249,7 +240,6 @@ bci.stanfit <- bci.stanreg
bci.blavaan <- bci.stanreg



#' @rdname bci
#' @export
bci.brmsfit <- function(x, ci = 0.95, effects = c("fixed", "random", "all"),
Expand Down Expand Up @@ -279,7 +269,6 @@ bci.brmsfit <- function(x, ci = 0.95, effects = c("fixed", "random", "all"),
}



#' @rdname bci
#' @export
bci.BFBayesFactor <- function(x, ci = 0.95, verbose = TRUE, ...) {
Expand Down
4 changes: 2 additions & 2 deletions R/bic_to_bf.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ bic_to_bf <- function(bic, denominator, log = FALSE) {
delta <- (denominator - bic) / 2

if (log) {
return(delta)
delta
} else {
return(exp(delta))
exp(delta)
}
}
3 changes: 0 additions & 3 deletions R/check_prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ check_prior <- function(model, method = "gelman", simulate_priors = TRUE, ...) {
}





#' @export
check_prior.brmsfit <- function(model,
method = "gelman",
Expand Down
1 change: 0 additions & 1 deletion R/contr.equalprior.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ contr.equalprior_deviations <- function(n, contrasts = TRUE, sparse = FALSE) {
}



# OLD ------------------------------

#' @export
Expand Down
5 changes: 2 additions & 3 deletions R/convert_pd_to_p.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#'
#' When `direction = "two-sided"`
#'
#' \deqn{p = 2 \times (1 - p_d)}{p = 2 * (1 - pd)}
#' \ifelse{html}{\out{p = 2 * (1 - p<sub>d</sub>)}}{\eqn{p = 2 \times (1 - p_d)}}
#'
#' When `direction = "one-sided"`
#'
#' \deqn{p = 1 - p_d}{p = 1 - pd}
#' \ifelse{html}{\out{p = 1 - p<sub>d</sub>}}{\eqn{p = 1 - p_d}}
#'
#' Note that this conversion is only valid when the lowest possible values of pd
#' is 0.5 - i.e., when the posterior represents continuous parameter space (see
Expand Down Expand Up @@ -95,7 +95,6 @@ p_to_pd <- function(p, direction = "two-sided", ...) {
}



#' @rdname pd_to_p
#' @export
convert_p_to_pd <- p_to_pd
Expand Down
Loading

0 comments on commit a134c85

Please sign in to comment.