Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 2, 2023
1 parent 33f6dbd commit 6889946
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion 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.13.1.4
Version: 0.13.1.5
Authors@R:
c(person(given = "Dominique",
family = "Makowski",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ S3method(rope,stanreg)
S3method(rope_range,data.frame)
S3method(rope_range,default)
S3method(rope_range,mlm)
S3method(sensitivity_to_prior,default)
S3method(sensitivity_to_prior,stanreg)
S3method(sexit_thresholds,BFBayesFactor)
S3method(sexit_thresholds,MixMod)
Expand Down
27 changes: 11 additions & 16 deletions R/sensitivity_to_prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,26 @@
#' standard deviations from its original location.
#' @param ... Arguments passed to or from other methods.
#'
#' @examples
#' @examplesIf require("rstanarm")
#' \donttest{
#' library(bayestestR)
#'
#' # rstanarm models
#' # -----------------------------------------------
#' if (require("rstanarm")) {
#' model <- rstanarm::stan_glm(mpg ~ wt, data = mtcars)
#' sensitivity_to_prior(model)
#' model <- rstanarm::stan_glm(mpg ~ wt, data = mtcars)
#' sensitivity_to_prior(model)
#'
#' model <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars)
#' sensitivity_to_prior(model, index = c("Median", "MAP"))
#' }
#'
#' # brms models
#' # -----------------------------------------------
#' if (require("brms")) {
#' model <- brms::brm(mpg ~ wt + cyl, data = mtcars)
#' # sensitivity_to_prior(model)
#' }
#' model <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars)
#' sensitivity_to_prior(model, index = c("Median", "MAP"))
#' }
#' @seealso DescTools
#' @export
sensitivity_to_prior <- function(model, index = "Median", magnitude = 10, ...) {
sensitivity_to_prior <- function(model, ...) {
UseMethod("sensitivity_to_prior")
}


#' @rdname sensitivity_to_prior
#' @export
sensitivity_to_prior.stanreg <- function(model, index = "Median", magnitude = 10, ...) {
# Original
Expand All @@ -68,7 +60,10 @@ sensitivity_to_prior.stanreg <- function(model, index = "Median", magnitude = 10
}



#' @export
sensitivity_to_prior.default <- function(model, ...) {
insight::format_error(sprintf("Models of class '%s' are not yet supported.", class(model)[1]))
}


#' @keywords internal
Expand Down
9 changes: 6 additions & 3 deletions man/sensitivity_to_prior.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6889946

Please sign in to comment.