R/cfS_Triangular.R

Defines functions cfS_Triangular

Documented in cfS_Triangular

#' @title Characteristic function of the zero-mean symmetric TRIANGULAR distribution
#'
#' @description
#' \code{cfS_Triangular(t, coef, niid)} evaluates the characteristic function \eqn{cf(t)}
#' of the zero-mean symmetric TRIANGULAR distribution defined on the interval \eqn{(-1,1)}.
#'
#' \code{cfS_Triangular} is an ALIAS of the more general function \code{cf_TriangularSymmetric},
#' used to evaluate the characteristic function of a linear combination
#' of independent TRIANGULAR distributed random variables.
#'
#' The characteristic function of \eqn{X ~ TriangularSymmetric} is defined by
#' \deqn{cf(t) = (2-2*cos(t))/t^2.}
#'
#' @family Continuous Probability Distribution
#' @family Symmetric Probability Distribution
#'
#' WITKOVSKY V. (2016). Numerical inversion of a characteristic function:
#' An alternative tool to form the probability distribution
#' of output quantity in linear measurement models. Acta IMEKO, 5(3), 32-44.
#'
#' @seealso For more details see WIKIPEDIA:
#' \url{https://en.wikipedia.org/wiki/Triangular_distribution}.
#'
#' @param t vector or array of real values, where the CF is evaluated.
#' @param coef vector of coefficients of the linear combination of Triangular 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 zero-mean symmetric TRIANGULAR distribution.
#'
#' @note Ver.: 16-Sep-2018 19:11:08 (consistent with Matlab CharFunTool v1.3.0, 02-Jun-2017 12:08:24).
#'
#' @example R/Examples/example_cfS_Triangular.R
#'
#' @export
#'
cfS_Triangular <- function(t, coef, niid) {
  if (missing(coef)) {
    coef <- vector()
  }
  if (missing(niid)) {
    niid <- numeric()
  }

  cf <- cf_TriangularSymmetric(t, coef, niid)

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