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

Slash

Slash distribution


Description

Probability mass function, distribution function and random generation for slash distribution.

Usage

dslash(x, mu = 0, sigma = 1, log = FALSE)

pslash(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)

rslash(n, mu = 0, sigma = 1)

Arguments

x, q

vector of quantiles.

mu

vector of locations

sigma

vector of positive valued scale parameters.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[X ≤ x] otherwise, P[X > x].

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Details

If Z ~ Normal(0, 1) and U ~ Uniform(0, 1), then Z/U follows slash distribution.

Probability density function

f(x) = [if x != 0:] (φ(0)-φ(x))/x^2 [else:] 1/(2*sqrt(2*π))

Cumulative distribution function

F(x) = [if x != 0:] Φ(x) - [φ(0)-φ(x)]/x [else:] 1/2

Examples

x <- rslash(1e5, 5, 3)
hist(x, 1e5, freq = FALSE, xlim = c(-100, 100))
curve(dslash(x, 5, 3), -100, 100, col = "red", n = 500, add = TRUE)
hist(pslash(x, 5, 3))
plot(ecdf(x), xlim = c(-100, 100))
curve(pslash(x, 5, 3), -100, 100, col = "red", lwd = 2, n = 500, add = TRUE)

extraDistr

Additional Univariate and Multivariate Distributions

v1.9.1
GPL-2
Authors
Tymoteusz Wolodzko
Initial release
2020-08-20

We don't support your browser anymore

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