Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/kde2dQuantile.R
Produces sample quantiles from a two-dimensional kernel density estimation corresponding to the given probabilities.
1 | kde2dQuantile(d, X, Y, probs = .05, ...)
|
d |
an object returnd by |
X |
numeric vector of |
Y |
numeric vector of |
probs |
numeric vector of probabilities. |
... |
additional arguments passed to |
Useful for contour plots of 2-dimensional KDE quantiles.
A vector of quantiles corresponding to the given probabilities.
Antoine Filipovic Pierucc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | a <- rnorm(10)
b <- rnorm(10)
# an ugly imitation of a kde2d estimate
# since we don't want to load MASS just for an exemple
f1 <- structure(list(x = c(-3.1, -1.575, -0.05, 1.475, 3),
y = c(-3.213, -1.591, 0.032, 1.654, 3.276),
z = structure(c(0, 0, 0.003, 0, 0, 0,
0.009, 0.05, 0.015,
0, 0.001, 0.05, 0.152,
0.052, 0.003, 0, 0.01,
0.039, 0.028, 0.001, 0,
0, 0.001, 0, 0),
.Dim = c(5L, 5L))),
.Names = c("x", "y", "z"))
quant <- kde2dQuantile(f1, a, b, c(.05, .5))
contour(f1, levels = quant, labels = names(quant))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.