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)

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.

  • 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] 10.69516
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] 10.66086
circular_mean(san_andreas$azi, 1 / san_andreas$unc)
#> [1] 9.971235
circular_median(san_andreas$azi)
#> [1] 36
circular_median(san_andreas$azi, 1 / san_andreas$unc)
#> [1] 36
circular_quantiles(san_andreas$azi)
#>   25%   50%   75% 
#>  15.0  36.0 161.5 
circular_quantiles(san_andreas$azi, 1 / san_andreas$unc)
#>      25%      50%      75% 
#>  15.0000  36.0000 161.8929 
circular_var(san_andreas$azi)
#> [1] 0.3134367
circular_var(san_andreas$azi, 1 / san_andreas$unc)
#> [1] 0.2015211

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] 138.8937
circular_median(sa.por$azi.PoR, 1 / san_andreas$unc)
#> [1] 137.0094
circular_var(sa.por$azi.PoR, 1 / san_andreas$unc)
#> [1] 0.1893274
circular_quantiles(sa.por$azi.PoR, 1 / san_andreas$unc)
#>      25%      50%      75% 
#> 124.9081 137.0094 150.2300