Card {VGAM} | R Documentation |
Cardioid Distribution
Description
Density, distribution function, quantile function and random generation for the cardioid distribution.
Usage
dcard(x, mu, rho, log = FALSE)
pcard(q, mu, rho, lower.tail = TRUE, log.p = FALSE)
qcard(p, mu, rho, tolerance = 1e-07, maxits = 500,
lower.tail = TRUE, log.p = FALSE)
rcard(n, mu, rho, ...)
Arguments
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations.
Same as in |
mu , rho |
See |
tolerance , maxits , ... |
The first two are control parameters for the algorithm used
to solve for the roots of a nonlinear system of equations;
|
log |
Logical.
If |
lower.tail , log.p |
Details
See cardioid
, the VGAM family function
for estimating the two parameters by maximum likelihood
estimation, for the formula of the probability density
function and other details.
Value
dcard
gives the density,
pcard
gives the distribution function,
qcard
gives the quantile function, and
rcard
generates random deviates.
Note
Convergence problems might occur with rcard
.
Author(s)
Thomas W. Yee and Kai Huang
See Also
Examples
## Not run:
mu <- 4; rho <- 0.4; x <- seq(0, 2*pi, len = 501)
plot(x, dcard(x, mu, rho), type = "l", las = 1, ylim = c(0, 1),
ylab = paste("[dp]card(mu=", mu, ", rho=", rho, ")"),
main = "Blue is density, orange is the CDF", col = "blue",
sub = "Purple lines are the 10,20,...,90 percentiles")
lines(x, pcard(x, mu, rho), col = "orange")
probs <- seq(0.1, 0.9, by = 0.1)
Q <- qcard(probs, mu, rho)
lines(Q, dcard(Q, mu, rho), col = "purple", lty = 3, type = "h")
lines(Q, pcard(Q, mu, rho), col = "purple", lty = 3, type = "h")
abline(h = c(0,probs, 1), v = c(0, 2*pi), col = "purple", lty = 3)
max(abs(pcard(Q, mu, rho) - probs)) # Should be 0
## End(Not run)