Learn R Programming

tectonicr (version 0.4.4)

dispersion: Circular Distance and Dispersion

Description

Circular distance between two angles and circular dispersion of angles about a specified angle.

Usage

circular_distance(x, y, axial = TRUE, na.rm = TRUE)

circular_dispersion( x, y = NULL, w = NULL, w.y = NULL, norm = FALSE, axial = TRUE, na.rm = TRUE )

circular_distance_alt(x, y, axial = TRUE, na.rm = TRUE)

circular_dispersion_alt( x, y = NULL, w = NULL, w.y = NULL, norm = FALSE, axial = TRUE, na.rm = TRUE )

Value

circular_distancereturns a numeric vector of positive numbers, circular_dispersionreturns a positive number.

Arguments

x, y

vectors of numeric values in degrees. length(y) is either 1 or length(x)

axial

logical. Whether the data are axial, i.e. pi-periodical (TRUE, the default) or directional, i.e. \(2 \pi\)-periodical (FALSE).

na.rm

logical. Whether NA values in x should be stripped before the computation proceeds.

w, w.y

(optional) Weights. A vector of positive numbers and of the same length as x. w.y is the (optional) weight of y.

norm

logical. Whether the dispersion should be normalized by the maximum possible angular difference.

Details

circular_distance_alt() and circular_dispersion_alt() are the alternative versions in Mardia and Jupp (2000), pp. 19-20. The alternative dispersion has a minimum at the sample median.

References

Mardia, K.V. (1972). Statistics of Directional Data: Probability and Mathematical Statistics. London: Academic Press.

Mardia, K.V., and Jupp, P.E (1999). Directional Statistics, Wiley Series in Probability and Statistics. John Wiley & Sons, Inc., Hoboken, NJ, USA. tools:::Rd_expr_doi("10.1002/9780470316979")

See Also

circular_mean(), circular_var().

Examples

Run this code
a <- c(0, 2, 359, 6, 354)
circular_distance(a, 10) # distance to single value

b <- a + 90
circular_distance(a, b) # distance to multiple values

data("nuvel1")
PoR <- subset(nuvel1, nuvel1$plate.rot == "na")
sa.por <- PoR_shmax(san_andreas, PoR, "right")
circular_dispersion(sa.por$azi.PoR, y = 135)
circular_dispersion(sa.por$azi.PoR, y = 135, w = 1 / san_andreas$unc)

Run the code above in your browser using DataLab