drayleigh {bayesmeta}R Documentation

The Rayleigh distribution.

Description

Rayleigh density, distribution, quantile function, random number generation, and expectation and variance.

Usage

  drayleigh(x, scale=1, log=FALSE)
  prayleigh(q, scale=1)
  qrayleigh(p, scale=1)
  rrayleigh(n, scale=1)
  erayleigh(scale=1)
  vrayleigh(scale=1)

Arguments

x, q

quantile.

p

probability.

n

number of observations.

scale

scale parameter (>0).

log

logical; if TRUE, logarithmic density will be returned.

Details

The Rayleigh distribution arises as the distribution of the square root of an exponentially distributed (or χ^2_2-distributed) random variable. If X follows an exponential distribution with rate λ and expectation 1/λ, then Y=sqrt(X) follows a Rayleigh distribution with scale sigma=1/sqrt(2*lambda) and expectation sqrt(pi/(4*lambda)).

Note that the exponential distribution is the maximum entropy distribution among distributions supported on the positive real numbers and with a pre-specified expectation; so the Rayleigh distribution gives the corresponding distribution of its square root.

Value

drayleigh()’ gives the density function, ‘prayleigh()’ gives the cumulative distribution function (CDF), ‘qrayleigh()’ gives the quantile function (inverse CDF), and ‘rrayleigh()’ generates random deviates. The ‘erayleigh()’ and ‘vrayleigh()’ functions return the corresponding Rayleigh distribution's expectation and variance, respectively.

Author(s)

Christian Roever christian.roever@med.uni-goettingen.de

References

C. Roever, R. Bender, S. Dias, C.H. Schmid, H. Schmidli, S. Sturtz, S. Weber, T. Friede. On weakly informative prior distributions for the heterogeneity parameter in Bayesian random-effects meta-analysis. Research Synthesis Methods, 12(4):448-474, 2021. doi: 10.1002/jrsm.1475.

N.L. Johnson, S. Kotz, N. Balakrishnan. Continuous univariate distributions, volume 1. Wiley, New York, 2nd edition, 1994.

See Also

dexp, dlomax, dhalfnormal, dhalft, dhalfcauchy, TurnerEtAlPrior, RhodesEtAlPrior, bayesmeta.

Examples

########################
# illustrate densities:
x <- seq(0,6,le=200)
plot(x, drayleigh(x, scale=0.5), type="l", col="green",
     xlab=expression(tau), ylab=expression("probability density "*f(tau)))
lines(x, drayleigh(x, scale=1/sqrt(2)), col="red")
lines(x, drayleigh(x, scale=1), col="blue")
abline(h=0, v=0, col="grey")

###############################################
# illustrate exponential / Rayleigh connection
# via a quantile-quantile plot (Q-Q-plot):
N <- 10000
exprate <- 5
plot(sort(sqrt(rexp(N, rate=exprate))),
     qrayleigh(ppoints(N), scale=1/sqrt(2*exprate)))
abline(0, 1, col="red")

###############################################
# illustrate Maximum Entropy distributions
# under similar but different constraints:
mu <- 0.5
tau <- seq(0, 4*mu, le=100)
plot(tau, dexp(tau, rate=1/mu), type="l", col="red", ylim=c(0,1/mu),
     xlab=expression(tau), ylab="probability density")
lines(tau, drayleigh(tau, scale=1/sqrt(2*1/mu^2)), col="blue")
abline(h=0, v=0, col="grey")
abline(v=mu, col="darkgrey"); axis(3, at=mu, label=expression(mu))
# explicate constraints:
legend("topright", pch=15, col=c("red","blue"),
       c(expression("Exponential:  E["*tau*"]"==mu),
         expression("Rayleigh:  E["*tau^2*"]"==mu^2)))

[Package bayesmeta version 2.7 Index]