The Topp-Leone Distribution
toppleUC.RdDensity, distribution function, quantile function and random generation for the Topp-Leone distribution.
Usage
dtopple(x, shape, log = FALSE)
ptopple(q, shape, lower.tail = TRUE, log.p = FALSE)
qtopple(p, shape)
rtopple(n, shape)Value
dtopple gives the density,
ptopple gives the distribution function,
qtopple gives the quantile function, and
rtopple generates random deviates.
References
Topp, C. W. and F. C. Leone (1955). A family of J-shaped frequency functions. Journal of the American Statistical Association, 50, 209–219.
Details
See topple, the VGAM
family function for
estimating the (shape) parameter \(s\) by
maximum likelihood
estimation, for the formula of the
probability density function.
Examples
if (FALSE) shape <- 0.7; x <- seq(0.02, 0.999, length = 300)
plot(x, dtopple(x, shape = shape), type = "l", col = "blue",
main = "Blue is density, orange is CDF", ylab = "", las = 1,
sub = "Purple lines are the 10,20,...,90 percentiles")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'y' in selecting a method for function 'plot': object 'shape' not found
abline(h = 0, col = "blue", lty = 2)
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
lines(x, ptopple(x, shape = shape), type = "l", col = "orange")
#> Error: object 'shape' not found
probs <- seq(0.1, 0.9, by = 0.1)
Q <- qtopple(probs, shape = shape)
#> Error: object 'shape' not found
lines(Q, dtopple(Q, shape), col = "purple", lty = 3, type = "h")
#> Error: object 'Q' not found
lines(Q, ptopple(Q, shape), col = "purple", lty = 3, type = "h")
#> Error: object 'Q' not found
abline(h = probs, col = "purple", lty = 3)
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
max(abs(ptopple(Q, shape) - probs)) # Should be zero
#> Error: object 'Q' not found
# \dontrun{}