cir_gaps function

Circular gaps

Circular gaps

Computation of the circular gaps of an angular sample Θ1,,Θn\Theta_1,\ldots,\Theta_n on [0,2π)[0, 2\pi), defined as [REMOVE_ME]Θ(2)Θ(1),,Θ(n)Θ(n1),2πΘ(n)Θ(1),[REMOVEME2] \Theta_{(2)} - \Theta_{(1)},\ldots,\Theta_{(n)} - \Theta_{(n - 1)},2\pi - \Theta_{(n)} - \Theta_{(1)}, [REMOVE_ME_2]

where [REMOVE_ME]0Θ(1)Θ(2)Θ(n)2π.[REMOVEME2] 0 \le \Theta_{(1)} \le \Theta_{(2)} \le \ldots \le\Theta_{(n)} \le 2\pi. [REMOVE_ME_2]

cir_gaps(Theta, sorted = FALSE)

Arguments

  • Theta: a matrix of size c(n, M) with M samples of size n of circular data on [0,2π)[0, 2\pi). Must not contain NA's.
  • sorted: are the columns of Theta sorted increasingly? If TRUE, performance is improved. If FALSE (default), each column of Theta is sorted internally.

Returns

A matrix of size c(n, M) containing the n circular gaps for each of the M circular samples.

Description

Computation of the circular gaps of an angular sample Θ1,,Θn\Theta_1,\ldots,\Theta_n on [0,2π)[0, 2\pi), defined as

Θ(2)Θ(1),,Θ(n)Θ(n1),2πΘ(n)Θ(1), \Theta_{(2)} - \Theta_{(1)},\ldots,\Theta_{(n)} - \Theta_{(n - 1)},2\pi - \Theta_{(n)} - \Theta_{(1)},

where

0Θ(1)Θ(2)Θ(n)2π. 0 \le \Theta_{(1)} \le \Theta_{(2)} \le \ldots \le\Theta_{(n)} \le 2\pi.

Warning

Be careful on avoiding the next bad usages of cir_gaps, which will produce spurious results:

  • The entries of Theta are not in [0,2π)[0, 2\pi).
  • Theta is not sorted increasingly when data_sorted = TRUE.

Examples

Theta <- cbind(c(pi, 0, 3 * pi / 2), c(0, 3 * pi / 2, pi), c(5, 3, 1)) cir_gaps(Theta)
  • Maintainer: Eduardo García-Portugués
  • License: GPL-3
  • Last published: 2024-05-24