Skip to contents

Calculate the (weighted median) and standard deviation of orientation data.

Usage

circular_mean(x, w = NULL, axial = TRUE, na.rm = TRUE)

circular_var(x, w = NULL, axial = TRUE, na.rm = TRUE)

circular_sd(x, w = NULL, axial = TRUE, na.rm = TRUE)

circular_median(x, w = NULL, axial = TRUE, na.rm = TRUE)

circular_quantiles(x, w = NULL, axial = TRUE, na.rm = TRUE)

circular_IQR(x, w = NULL, axial = TRUE, na.rm = TRUE)

sample_circular_dispersion(x, w = NULL, axial = TRUE, na.rm = TRUE)

Arguments

x

numeric vector. Values in degrees.

w

(optional) Weights. A vector of positive numbers and of the same length as 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 value indicating whether NA values in x should be stripped before the computation proceeds.

Value

numeric vector

Note

Weighting may be the reciprocal of the data uncertainties.

Weightings have no effect on quasi-median and quasi-quantiles if length(x) %% 2 != 1 and length(x) %% 4 == 0, respectively.

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. doi:10.1002/9780470316979

Ziegler, M. O.; Heidbach O. (2019). Manual of the Matlab Script Stress2Grid v1.1. WSM Technical Report 19-02, GFZ German Research Centre for Geosciences. doi:10.2312/wsm.2019.002

Heidbach, O., Tingay, M., Barth, A., Reinecker, J., Kurfess, D., & Mueller, B. (2010). Global crustal stress pattern based on the World Stress Map database release 2008. Tectonophysics 482, 3<U+2013>15, doi:10.1016/j.tecto.2009.07.023

Examples

x <- rvm(10, 0, 100) %% 180
unc <- stats::runif(100, 0, 10)
circular_mean(x, 1 / unc)
#> [1] 0.6221128
circular_var(x, 1 / unc)
#> [1] 0.01727118
circular_sd(x, 1 / unc)
#> [1] 5.347582
circular_median(x, 1 / unc)
#> [1] 172.0181
circular_quantiles(x, 1 / unc)
#>        25%        50%        75% 
#>   5.704103 172.018116 178.181497 
circular_IQR(x, 1 / unc)
#> [1] 7.522606

data("san_andreas")
circular_mean(san_andreas$azi)
#> [1] 5.900587
circular_mean(san_andreas$azi, 1 / san_andreas$unc)
#> [1] 9.961752
circular_median(san_andreas$azi)
#> [1] 54
circular_median(san_andreas$azi, 1 / san_andreas$unc)
#> [1] 54
circular_quantiles(san_andreas$azi)
#> 25% 50% 75% 
#>  18  54 171 
circular_quantiles(san_andreas$azi, 1 / san_andreas$unc)
#> 25% 50% 75% 
#>  18  54 171 
circular_var(san_andreas$azi)
#> [1] 0.2676557
circular_var(san_andreas$azi, 1 / san_andreas$unc)
#> [1] 0.2863575

data("nuvel1")
PoR <- subset(nuvel1, nuvel1$plate.rot == "na")
sa.por <- PoR_shmax(san_andreas, PoR, "right")
circular_mean(sa.por$azi.PoR, 1 / san_andreas$unc)
#> [1] 142.403
circular_median(sa.por$azi.PoR, 1 / san_andreas$unc)
#> [1] 136.119
circular_var(sa.por$azi.PoR, 1 / san_andreas$unc)
#> [1] 0.2220562
circular_quantiles(sa.por$azi.PoR, 1 / san_andreas$unc)
#>      25%      50%      75% 
#> 126.5036 136.1190 147.8526