Learn R Programming

ridgetorus (version 1.0.3)

ridge_distr: Connected component of the toroidal density ridge of a bivariate sine von Mises, bivariate wrapped Cauchy, and bivariate wrapped normal

Description

Computation of the connected component of the density ridge of in a given set of points or, if not specified, in a regular grid on \([-\pi, \pi)\).

Usage

ridge_bvm(mu, kappa, eval_points, subint_1, subint_2)

ridge_bwc(mu, xi, eval_points, subint_1, subint_2)

ridge_bwn(mu, Sigma, kmax = 2, eval_points, subint_1, subint_2)

Value

A matrix of size c(subint_1, 2) containing the points of the connected component of the ridge.

Arguments

mu

circular means of the density, a vector of length 2.

kappa

vector of length 3 with the concentrations \((\kappa_1, \kappa_2)\) and the dependence parameter \(\lambda\) of the density.

eval_points

evaluation points for the ridge.

subint_1

number of points for \(\theta_1\).

subint_2

number of points for \(\theta_2\) at each \(\theta_1\).

xi

a vector of length 3 with the marginal concentrations \((\xi_1, \xi_2)\), and the dependence parameter \(\rho\).

Sigma

covariance matrix of size c(2, 2).

kmax

integer number up to truncate the wrapped normal series in -kmax:kmax. Defaults to 2.

References

Ozertem, U. and Erdogmus, D. (2011). Locally defined principal curves and surfaces. Journal of Machine Learning Research, 12(34):1249--1286. tools:::Rd_expr_doi("10.6083/M4ZG6Q60")

Examples

Run this code
# \donttest{
# Bivariate von Mises
mu <- c(0, 0)
kappa <- c(0.3, 0.5, 0.4)
nth <- 100
th <- seq(-pi, pi, l = nth)
x <- as.matrix(expand.grid(th, th))
d <- d_bvm(x = x, mu = mu, kappa = kappa)
image(th, th, matrix(d, nth, nth), col = viridisLite::viridis(20))
ridge <- ridge_bvm(mu = mu, kappa = kappa, subint_1 = 5e2,
                   subint_2 = 5e2)
points(ridge)

# Bivariate wrapped Cauchy
mu <- c(0, 0)
xi <- c(0.3, 0.6, 0.25)
nth <- 100
th <- seq(-pi, pi, l = nth)
x <- as.matrix(expand.grid(th, th))
d <- d_bwc(x = x, mu = mu, xi = xi)
image(th, th, matrix(d, nth, nth), col = viridisLite::viridis(20))
ridge <- ridge_bwc(mu = mu, xi = xi, subint_1 = 5e2, subint_2 = 5e2)
points(ridge)

# Bivariate wrapped normal
mu <- c(0, 0)
Sigma <- matrix(c(10, 3, 3, 5), nrow = 2)
nth <- 100
th <- seq(-pi, pi, l = nth)
x <- as.matrix(expand.grid(th, th))
d <- d_bwn(x = x, mu = mu, Sigma = Sigma)
image(th, th, matrix(d, nth, nth), col = viridisLite::viridis(20))
ridge <- ridge_bwn(mu = mu, Sigma = Sigma, subint_1 = 5e2,
                   subint_2 = 5e2)
points(ridge)# }

Run the code above in your browser using DataLab