torus_pairs {ridgetorus} | R Documentation |
Toroidal pairs plot
Description
Pairs plots for data on [-\pi, \pi)^d
, d\geq 2
.
The diagonal panels contain kernel density estimates tailored to
circular data.
Usage
torus_pairs(
x,
max_dim = 10,
columns = NULL,
col_data = 1,
ylim_dens = c(0, 1.5),
bwd = "ROT",
scales = rep(pi, ncol(x))
)
Arguments
x |
a matrix of size |
max_dim |
the maximum number of scores to produce the scores plot.
Defaults to |
columns |
if specified, the variables to be plotted. If |
col_data |
color(s) for the data points. Defaults to |
ylim_dens |
common |
bwd |
type of bandwidth selector used in the kernel density plots.
Either |
scales |
scales of the torus. Defaults to |
Details
The default bandwidth selector is the Rule-Of-Thumb (ROT) selector in García-Portugués (2013). It is fast, yet it may oversmooth non-unimodal densities. The EMI selector gives more flexible fits.
Value
A ggplot
. The density plots show the
Fréchet means (red bars) and the Fréchet standard
deviations (gray text).
References
García-Portugués, E. (2013). Exact risk improvement of bandwidth selectors for kernel density estimation with directional data. Electronic Journal of Statistics, 7:1655–1685. doi:10.1214/13-ejs821
Examples
# Generate data
n <- 50
set.seed(123456)
x <- sdetorus::toPiInt(rbind(
mvtnorm::rmvnorm(n = n, mean = c(-pi, -pi) / 2,
sigma = diag(0.1, nrow = 2)),
mvtnorm::rmvnorm(n = n, mean = c(-3 * pi / 2, 0) / 2,
sigma = diag(0.1, nrow = 2)),
mvtnorm::rmvnorm(n = n, mean = c(0, pi / 2),
sigma = diag(0.1, nrow = 2))
))
col <- rainbow(3)[rep(1:3, each = n)]
# Torus pairs
torus_pairs(x, col_data = col)
fit <- ridge_pca(x = x)
torus_pairs(fit$scores, col_data = col)