Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

slashUC

Slash Distribution


Description

Density function, distribution function, and random generation for the slash distribution.

Usage

dslash(x, mu = 0, sigma = 1, log = FALSE, smallno = .Machine$double.eps*1000)
pslash(q, mu = 0, sigma = 1, very.negative = -10000,
       lower.tail = TRUE, log.p = FALSE)
rslash(n, mu = 0, sigma = 1)

Arguments

x, q

vector of quantiles.

n

Same as runif.

mu, sigma

the mean and standard deviation of the univariate normal distribution.

log

Logical. If TRUE then the logarithm of the density is returned.

very.negative

Numeric, of length 1. A large negative value. For (q-mu)/sigma values less than this, the value 0 is returned because integrate tends to fail. A warning is issued. Similarly, if (q-mu)/sigma is greater than abs(very.negative) then 1 is returned with a warning.

smallno

See slash.

lower.tail, log.p

Same meaning as in pnorm or qnorm.

Details

See slash, the VGAM family function for estimating the two parameters by maximum likelihood estimation, for the formula of the probability density function and other details.

Function pslash uses a for () loop and integrate, meaning it's very slow. It may also be inaccurate for extreme values of q, and returns with 1 or 0 values when too extreme compared to very.negative.

Value

dslash gives the density, and pslash gives the distribution function, rslash generates random deviates.

Note

pslash is very slow.

Author(s)

Thomas W. Yee and C. S. Chee

See Also

Examples

## Not run: 
curve(dslash, col = "blue", ylab = "f(x)", -5, 5, ylim = c(0, 0.4), las = 1,
     main = "Standard slash, normal and Cauchy densities", lwd = 2)
curve(dnorm, col = "black", lty = 2, lwd = 2, add = TRUE)
curve(dcauchy, col = "orange", lty = 3, lwd = 2, add = TRUE)
legend("topleft", c("slash", "normal", "Cauchy"), lty = 1:3,
       col = c("blue","black","orange"), lwd = 2)

curve(pslash, col = "blue", -5, 5, ylim = 0:1)
pslash(c(-Inf, -20000, 20000, Inf))  # Gives a warning

## End(Not run)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.