R/median.Bolstad.R

#' @title Median generic
#' 
#' Compute the posterior median of the posterior distribution
#' 
#' @param x an object.
#' @param na.rm Ideally if \code{TRUE} then missing values will be removed, but not currently used.
#' @param ... [>=R3.4.0 only] Not currently used.
#' @details If \code{x} is an object of class \code{Bolstad} then the posterior 
#'   median of the parameter of interest will be calculated.
#' @author James Curran
#' @method median Bolstad
if(is.na(match("...", names(formals(median))))) {
  median.Bolstad = function(x, na.rm = FALSE) {
    return(quantile(x, probs = 0.5))
  }
}else{
  median.Bolstad = function(x, na.rm = FALSE, ...) {
    return(quantile(x, probs = 0.5))
  }
}

Try the Bolstad package in your browser

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

Bolstad documentation built on Jan. 8, 2021, 2:03 a.m.