U-utils {LambertW}R Documentation

Zero-mean, unit-variance version of standard distributions

Description

Density, distribution function, quantile function and random number generation for the shifted and scaled U of the (location-)scale family input X \sim F_X(x \mid \boldsymbol \beta) - see References.

Since the normalized random variable U is one of the main building blocks of Lambert W \times F distributions, these functions are wrappers used by other functions such as dLambertW or rLambertW.

Usage

dU(u, beta, distname, use.mean.variance = TRUE)

pU(u, beta, distname, use.mean.variance = TRUE)

qU(p, beta, distname, use.mean.variance = TRUE)

rU(n, beta, distname, use.mean.variance = TRUE)

Arguments

u

vector of quantiles.

beta

numeric vector (deprecated); parameter \boldsymbol \beta of the input distribution. See check_beta on how to specify beta for each distribution.

distname

character; name of input distribution; see get_distnames.

use.mean.variance

logical; if TRUE it uses mean and variance implied by \boldsymbol \beta to do the transformation (Goerg 2011). If FALSE, it uses the alternative definition from Goerg (2016) with location and scale parameter.

p

vector of probability levels

n

number of samples

Value

dU evaluates the pdf at y, pU evaluates the cdf, qU is the quantile function, and rU generates random samples from U.

Examples


# a zero-mean, unit variance version of the t_3 distribution.
curve(dU(x, beta = c(1, 1, 3), distname = "t"), -4, 4,
      ylab = "pdf", xlab = "u",
      main = "student-t \n zero-mean, unit variance")
# cdf of unit-variance version of an exp(3) -> just an exp(1)
curve(pU(x, beta = 3, distname = "exp"), 0, 4, ylab = "cdf", xlab = "u",
      main = "Exponential \n unit variance", col = 2, lwd = 2) 
curve(pexp(x, rate = 1), 0, 4, add = TRUE, lty = 2)
# all have (empirical) variance 1
var(rU(n = 1000, distname = "chisq", beta = 2))
var(rU(n = 1000, distname = "normal", beta = c(3, 3)))
var(rU(n = 1000, distname = "exp", beta = 1))
var(rU(n = 1000, distname = "unif", beta = c(0, 10)))


[Package LambertW version 0.6.9-1 Index]