R/cfX_InverseGamma.R

Defines functions cfX_InverseGamma

Documented in cfX_InverseGamma

#' @title Characteristic function of the INVERSE GAMMA distribution
#'
#' @description
#' \code{cfX_InverseGamma(t, alpha, beta, coef, niid)} evaluates the characteristic function \eqn{cf(t)}
#' of the INVERSE GAMMA distribution with the shape parameter \code{alpha > 0} and the rate parameter \code{beta > 0}.
#'
#' \code{cfX_InverseGamma} is an ALIAS NAME of the more general function \code{cf_InverseGamma},
#' used to evaluate the characteristic function of a linear combination
#' of independent INVERSE GAMMA distributed random variables.
#'
#' The characteristic function of the GAMMA distribution is defined
#' by \deqn{cf(t) =  2 / gamma(\alpha) * (-1i*\beta*t).^(\alpha/2) * besselk(\alpha,sqrt(-4i*\beta*t)).}
#'
#' @family Continuous Probability Distribution
#'
#' @references
#' WITKOVSKY, V.: Computing the distribution of a linear combination
#' of inverted gamma variables, Kybernetika 37 (2001), 79-90.
#'
#' @seealso For more details see WIKIPEDIA:
#' \url{https://en.wikipedia.org/wiki/Inverse-gamma_distribution}.
#'
#' @param t vector or array of real values, where the CF is evaluated.
#' @param alpha the shape parameter \code{alpha > 0}. If empty, default value is \code{alpha = 1}.
#' @param beta the rate (1/scale) parameter \code{beta > 0}. If empty, default value is \code{beta = 1}.
#' @param coef vector of coefficients of the linear combination of Inverse Gamma distributed random variables.
#' If coef is scalar, it is assumed that all coefficients are equal. If empty, default value is \code{coef = 1}.
#' @param niid scalar convolution coeficient.
#'
#' @return Characteristic function \eqn{cf(t)} of the INVERSE GAMMA distribution.
#'
#' @note Ver.: 16-Sep-2018 19:25:22 (consistent with Matlab CharFunTool v1.3.0, 15-Nov-2016 13:36:26).
#'
#' @example R/Examples/example_cfX_InverseGamma.R
#'
#' @export
#'
cfX_InverseGamma <- function(t, alpha, beta, coef, niid) {
  if (missing(alpha)) {
    alpha <- vector()
  }
  if (missing(beta)) {
    beta <- vector()
  }
  if (missing(coef)) {
    coef <- vector()
  }
  if (missing(niid)) {
    niid <- numeric()
  }

  cf <- cf_InverseGamma(t, alpha, beta, coef, niid)

  return(cf)
}
gajdosandrej/CharFunToolR documentation built on June 3, 2024, 7:46 p.m.