| Card | R Documentation |
Density, distribution function, quantile function and random generation for the cardioid distribution.
dcard(x, mu, rho, log = FALSE)
pcard(q, mu, rho, lower.tail = TRUE, log.p = FALSE)
qcard(p, mu, rho, lower.tail = TRUE, log.p = FALSE, tol0 = 1e-6)
rcard(n, mu, rho)
dcard2(x, mu, rho2 = 0, log = FALSE)
pcard2(q, mu, rho2 = 0, lower.tail = TRUE, log.p = FALSE)
qcard2(p, mu, rho2 = 0, lower.tail = TRUE, log.p = FALSE,
tol0 = 1e-6)
rcard2(n, mu, rho2, tol0 = 1e-4)
x, q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations.
Same as in |
mu, rho, rho2 |
See |
tol0 |
Numeric, positive and small.
Used under different contexts, any value
within a certain tolerance is treated as being
equivalent to 0.
For example, if |
log |
Logical.
If |
lower.tail, log.p |
Same meaning as in |
See cardioid and cardioid2,
the VGAM
family functions
for estimating the two parameters by
maximum likelihood
estimation, for the formula of the
probability density
function and other details.
dcard/dcard2 give the density,
pcard/pcard2 give the distribution function,
qcard/qcard2 give the quantile function, and
rcard/rcard2 generates random deviates.
Convergence problems might occur with rcard.
Thomas W. Yee
Pewsey, A. (2025). On Jeffreys's cardioid distribution. Computational Statistics and Data Analysis, 82, in press.
cardioid,
cardioid2.
## Not run:
mu <- 4; rho2 <- 0.4 * 2; x <- seq(-0.5, 2*pi+0.5, len = 1001)
plot(x, dcard2(x, mu, rho2), type = "l", las = 1, ylim = 0:1,
ylab = paste0("[dp]card2(mu=", mu, ", rho2=", rho2, ")"),
main = "Blue is density, orange the CDF", col = "blue",
sub = "Purple lines are the 10,20,...,90 percentiles")
lines(x, pcard2(x, mu, rho2), col = "orange")
probs <- seq(0, 1, by = 0.1)
Q <- qcard2(probs, mu, rho2)
lines(Q, dcard2(Q, mu, rho2), col = 3, lty = 3, type = "h")
lines(Q, pcard2(Q, mu, rho2), col = 3, lty = 3, type = "h")
abline(h = probs, v = c(0, 2*pi), col = 3, lty = 3)
max(abs(pcard2(Q, mu, rho2) - probs)) # Should be 0
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.