R/varAL.R

#' Variance of Asymmetric Laplace random variables
#'
#' Compute the variance for the asymmetric Laplace Distribution.
#'
#' @param sigma scale parameter
#' @param qtl skewness parameter
#'
#' @return Return the variance of Asymmetric Laplace random variables for given scale (\code{sigma}) and skewness (\code{qtl}) parameters.
#'
#' @references{
#'   \insertRef{ref:dal1}{lqmix}
#' }
#' @references{
#'   \insertRef{ref:dal2}{lqmix}
#' }
#'
#' @references{
#'   \insertRef{ref:dal3}{lqmix}
#' }
#' @export


varAL = function (sigma, qtl){
  eps <- .Machine$double.eps^(2/3)
  if (qtl > 1 | qtl < 0) stop("Parameter 'qtl' must be in [0,1]")
  if (qtl == 0) qtl = eps
  if (qtl == 1) qtl = 1 - eps
  if (sigma < 0)     warning("Scale parameter 'sigma' is negative")

  sigma^2 * (1 - 2 * qtl + 2 * qtl^2)/((1 - qtl)^2 * qtl^2)
}

Try the lqmix package in your browser

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

lqmix documentation built on Nov. 5, 2025, 7:15 p.m.