Learn R Programming

sphunif (version 1.4.3)

cir_gaps: Circular gaps

Description

Computation of the circular gaps of an angular sample \(\Theta_1,\ldots,\Theta_n\) on \([0, 2\pi)\), defined as $$\Theta_{(2)} - \Theta_{(1)},\ldots,\Theta_{(n)} - \Theta_{(n - 1)}, 2\pi - \Theta_{(n)} - \Theta_{(1)},$$ where $$0 \le \Theta_{(1)} \le \Theta_{(2)} \le \ldots \le \Theta_{(n)} \le 2\pi.$$

Usage

cir_gaps(Theta, sorted = FALSE)

Value

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

Arguments

Theta

a matrix of size c(n, M) with M samples of size n of circular data on \([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.

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\pi)\).

  • Theta is not sorted increasingly when data_sorted = TRUE.

Examples

Run this code
Theta <- cbind(c(pi, 0, 3 * pi / 2), c(0, 3 * pi / 2, pi), c(5, 3, 1))
cir_gaps(Theta)

Run the code above in your browser using DataLab