Skip to content

Commit

Permalink
Prepare CRAN submission (#691)
Browse files Browse the repository at this point in the history
* Prepare CRAN submission

* fix vignette?

* styler

* fix

* docs
  • Loading branch information
strengejacke authored Jan 17, 2025
1 parent 55f598a commit fb746e3
Show file tree
Hide file tree
Showing 47 changed files with 51 additions and 191 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: bayestestR
Title: Understand and Describe Bayesian Models and Posterior Distributions
Version: 0.15.0.4
Version: 0.15.1
Authors@R:
c(person(given = "Dominique",
family = "Makowski",
Expand Down Expand Up @@ -67,7 +67,7 @@ Depends:
R (>= 3.6)
Imports:
insight (>= 1.0.0),
datawizard (>= 0.13.0),
datawizard (>= 1.0.0),
graphics,
methods,
stats,
Expand Down Expand Up @@ -95,7 +95,7 @@ Suggests:
lavaan,
lme4,
logspline (>= 2.1.21),
marginaleffects (>= 0.24.0.6),
marginaleffects (>= 0.24.0),
MASS,
mclust,
mediation,
Expand Down Expand Up @@ -128,4 +128,3 @@ Config/testthat/parallel: true
Config/rcmdcheck/ignore-inconsequential-notes: true
Config/Needs/website: easystats/easystatstemplate
Config/Needs/check: stan-dev/cmdstanr
Remotes: easystats/datawizard, vincentarelbundock/marginaleffects
7 changes: 5 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# bayestestR 0.15.0.4
# 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
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
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
1 change: 0 additions & 1 deletion R/convert_pd_to_p.R
Original file line number Diff line number Diff line change
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
22 changes: 5 additions & 17 deletions R/describe_posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#' `"SPI"` (see [`spi()`]), or `"SI"` (see [`si()`]).
#' @param test The indices of effect existence to compute. Character (vector) or
#' list with one or more of these options: `"p_direction"` (or `"pd"`),
#' `"rope"`, `"p_map"`, `"equivalence_test"` (or `"equitest"`),
#' `"bayesfactor"` (or `"bf"`) or `"all"` to compute all tests. For each
#' "test", the corresponding \pkg{bayestestR} function is called (e.g.
#' [`rope()`] or [`p_direction()`]) and its results included in the summary
#' output.
#' `"rope"`, `"p_map"`, `"p_significance"` (or `"ps"`), `"p_rope"`,
#' `"equivalence_test"` (or `"equitest"`), `"bayesfactor"` (or `"bf"`) or
#' `"all"` to compute all tests. For each "test", the corresponding
#' \pkg{bayestestR} function is called (e.g. [`rope()`] or [`p_direction()`])
#' and its results included in the summary output.
#' @param rope_range ROPE's lower and higher bounds. Should be a vector of two
#' values (e.g., `c(-0.1, 0.1)`), `"default"` or a list of numeric vectors of
#' the same length as numbers of parameters. If `"default"`, the bounds are
Expand Down Expand Up @@ -528,8 +528,6 @@ describe_posterior.default <- function(posterior, ...) {
}




# Models based on simple data frame of posterior ---------------------


Expand Down Expand Up @@ -728,7 +726,6 @@ describe_posterior.draws <- function(posterior,
describe_posterior.rvar <- describe_posterior.draws



# easystats methods ------------------------


Expand Down Expand Up @@ -825,8 +822,6 @@ describe_posterior.get_predicted <- function(posterior,
}




# emmeans ---------------------------


Expand Down Expand Up @@ -1221,8 +1216,6 @@ describe_posterior.brmsfit <- function(posterior,
describe_posterior.blavaan <- describe_posterior.stanfit




# other models --------------------------------


Expand Down Expand Up @@ -1345,8 +1338,6 @@ describe_posterior.bamlss <- function(posterior,
}




# BayesFactor --------------------


Expand Down Expand Up @@ -1431,9 +1422,6 @@ describe_posterior.BFBayesFactor <- function(posterior,
}





# Helpers -----------------------------------------------------------------


Expand Down
1 change: 0 additions & 1 deletion R/describe_prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ describe_prior.brmsfit <- function(model,
# Internal ----------------------------------------------------------------



#' @keywords internal
.describe_prior <- function(model, parameters = NULL, ...) {
priors <- insight::get_priors(model, ...)
Expand Down
7 changes: 0 additions & 7 deletions R/distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ distribution_custom <- function(n, type = "norm", ..., random = FALSE) {
}






#' @rdname distribution
#' @inheritParams stats::rbeta
#' @export
Expand Down Expand Up @@ -99,7 +95,6 @@ distribution_binomial <- function(n, size = 1, prob = 0.5, random = FALSE, ...)
distribution_binom <- distribution_binomial



#' @rdname distribution
#' @inheritParams stats::rcauchy
#' @export
Expand Down Expand Up @@ -127,7 +122,6 @@ distribution_chisquared <- function(n, df, ncp = 0, random = FALSE, ...) {
distribution_chisq <- distribution_chisquared



#' @rdname distribution
#' @inheritParams stats::rgamma
#' @param shape Shape parameter.
Expand Down Expand Up @@ -267,7 +261,6 @@ distribution_uniform <- function(n, min = 0, max = 1, random = FALSE, ...) {
}



#' @rdname distribution
#' @inheritParams stats::rnorm
#' @export
Expand Down
5 changes: 0 additions & 5 deletions R/equivalence_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ equivalence_test.numeric <- function(x, range = "default", ci = 0.95, verbose =
}



#' @rdname equivalence_test
#' @inheritParams p_direction
#' @export
Expand Down Expand Up @@ -256,8 +255,6 @@ equivalence_test.BFBayesFactor <- function(x, range = "default", ci = 0.95, verb
}




#' @keywords internal
.equivalence_test_models <- function(x,
range = "default",
Expand Down Expand Up @@ -354,7 +351,6 @@ equivalence_test.brmsfit <- function(x,
}



#' @export
equivalence_test.sim.merMod <- function(x,
range = "default",
Expand Down Expand Up @@ -433,7 +429,6 @@ equivalence_test.mcmc.list <- equivalence_test.bcplm
equivalence_test.bayesQR <- equivalence_test.bcplm



#' @export
equivalence_test.bamlss <- function(x,
range = "default",
Expand Down
4 changes: 0 additions & 4 deletions R/estimate_density.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ estimate_density.default <- function(x, ...) {
}



# Methods -----------------------------------------------------------------

#' @export
Expand Down Expand Up @@ -589,7 +588,6 @@ estimate_density.bamlss <- function(x,
}



#' Coerce to a Data Frame
#'
#' @inheritParams base::as.data.frame
Expand Down Expand Up @@ -644,8 +642,6 @@ as.data.frame.density <- function(x, ...) {
}




#' Density Probability at a Given Value
#'
#' Compute the density value at a given point of a distribution (i.e.,
Expand Down
7 changes: 0 additions & 7 deletions R/eti.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ eti.numeric <- function(x, ci = 0.95, verbose = TRUE, ...) {
}



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



#' @export
eti.draws <- function(x, ci = 0.95, verbose = TRUE, ...) {
dat <- .compute_interval_dataframe(x = .posterior_draws_to_df(x), ci = ci, verbose = verbose, fun = "eti")
Expand All @@ -103,7 +101,6 @@ eti.draws <- function(x, ci = 0.95, verbose = TRUE, ...) {
eti.rvar <- eti.draws



#' @export
eti.MCMCglmm <- function(x, ci = 0.95, verbose = TRUE, ...) {
nF <- x$Fixed$nfl
Expand All @@ -114,7 +111,6 @@ eti.MCMCglmm <- function(x, ci = 0.95, verbose = TRUE, ...) {
}



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



#' @export
eti.bamlss <- function(x, ci = 0.95, component = c("all", "conditional", "location"), verbose = TRUE, ...) {
component <- match.arg(component)
Expand All @@ -135,7 +130,6 @@ eti.bamlss <- function(x, ci = 0.95, component = c("all", "conditional", "locati
}



#' @export
eti.bcplm <- function(x, ci = 0.95, verbose = TRUE, ...) {
d <- insight::get_parameters(x)
Expand Down Expand Up @@ -248,7 +242,6 @@ eti.stanfit <- eti.stanreg
eti.blavaan <- eti.stanreg



#' @rdname eti
#' @export
eti.brmsfit <- function(x, ci = 0.95, effects = c("fixed", "random", "all"),
Expand Down
Loading

0 comments on commit fb746e3

Please sign in to comment.