R/prior_summary.R

Defines functions prior_summary.default prior_summary

Documented in prior_summary prior_summary.default

#' Generic function for extracting information about prior distributions
#'
#' See [prior_summary.stanreg()](https://mc-stan.org/rstanarm/reference/prior_summary.stanreg.html)
#' in the \pkg{rstanarm} package for an example.
#'
#' @export
#' @template args-object
#' @template args-dots
#'
#' @return `prior_summary()` methods should return an object containing
#'   information about the prior distribution(s) used for the given model.
#'   The structure of this object will depend on the method.
#'
#'   The default method just returns `object$prior.info`, which is
#'   `NULL` if there is no `'prior.info'` element.
#'
#' @template seealso-rstanarm-pkg
#' @template seealso-vignettes
#'
#' @examples
#' # See help("prior_summary", package = "rstanarm")
#'
prior_summary <- function(object, ...) {
  UseMethod("prior_summary")
}

#' @rdname prior_summary
#' @export
prior_summary.default <- function(object, ...) {
  object$prior.info
}

Try the rstantools package in your browser

Any scripts or data that you put into this service are public.

rstantools documentation built on July 26, 2023, 5:35 p.m.