Learn R Programming

VGAM (version 0.8-2)

genray: The Generalized Rayleigh Distribution

Description

Density, distribution function, quantile function and random generation for the generalized Rayleigh distribution.

Usage

dgenray(x, shape, scale = 1, log = FALSE)
pgenray(q, shape, scale = 1)
qgenray(p, shape, scale = 1) 
rgenray(n, shape, scale = 1)

Arguments

x, q
vector of quantiles.
p
vector of probabilities.
n
number of observations. If length(n) > 1 then the length is taken to be the number required.
shape, scale
positive shape and scale parameters.
log
Logical. If log=TRUE then the logarithm of the density is returned.

Value

  • dgenray gives the density, pgenray gives the distribution function, qgenray gives the quantile function, and rgenray generates random deviates.

Details

See genrayleigh, the VGAM family function for estimating the parameters, for the formula of the probability density function and other details.

See Also

genrayleigh. rayleigh.

Examples

Run this code
shape = 0.5; scale = 1; nn = 501
#x = seq(0.0 , 1.00, len=nn)
x = seq(-0.1, 3.0, len=nn)
plot(x, dgenray(x, shape, scale), type="l", las=1, ylim=c(0,1.0),
     ylab=paste("fgenray(shape=", shape, ", scale=", scale, ")"),
     col="blue", cex.main=0.8,
     main="Blue is density, red is cumulative distribution function",
     sub="Purple lines are the 10,20,...,90 percentiles")
lines(x, pgenray(x, shape, scale), col="red")
probs = seq(0.1, 0.9, by=0.1)
Q = qgenray(probs, shape, scale)
lines(Q, dgenray(Q, shape, scale), col="purple", lty=3, type="h")
lines(Q, pgenray(Q, shape, scale), col="purple", lty=3, type="h")
abline(h=probs, col="purple", lty=3)
max(abs(pgenray(Q, shape, scale) - probs)) # Should be 0

Run the code above in your browser using DataLab