conv {DirStats}R Documentation

Convenience functions

Description

Normalization of data in R^{q + 1} to S^q. Transformations between S^1 and [0, 2\pi), and between S^2 and [0, 2\pi) \times [0, \pi].

Usage

norm2(x)

normalize(x)

to_cir(th)

to_rad(x)

to_sph(th, ph)

Arguments

x

matrix or vector, in S^1 for to_cir.

th

vector of angles in [0, 2\pi).

ph

vector of angles in [0, \pi].

Value

Euclidean norm (norm) and normalized data (normalize). Position in S^1 (to_cir) or in [0, 2\pi) (to_rad). Position in S^2 (to_sph) or in [0, 2\pi) \times [0, \pi] (to_rad).

Examples

# Normalization
x <- 1:3
norm2(x)
normalize(x)
x <- rbind(1:3, 3:1)
norm2(x)
normalize(x)

# Circular transformations
th <- 1
x <- c(0, 1)
to_rad(to_cir(th))
to_rad(to_cir(c(th, th + 1)))
to_cir(to_rad(x))
to_cir(to_rad(rbind(x, -x)))

# Spherical transformations
th <- 2
ph <- 1
x <- c(0, 1, 0)
to_rad(to_sph(th, ph))
to_rad(to_sph(c(th, th + 1),
              c(ph, ph + 1)))
to_sph(to_rad(x)[, 1], to_rad(x)[, 2])
to_sph(to_rad(rbind(x, -x))[, 1], to_rad(rbind(x, -x))[, 2])

[Package DirStats version 0.1.9 Index]