Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

angleTest

Test whether the direction of two vectors is similar


Description

Test whether the direction of two vectors is similar

Usage

angleTest(x, y)

Arguments

x

vector

y

vector

Details

Under the assumption of all (normalized) n-vectors being represented by an n-dimensional hypersphere, the probability of the angle between two vectors is <= the measured values can be estimated as the area of a cap defined by that angle and divided by the hypersphere's complete surface area.

Value

a list with

angle

angle between vectors

p.value

p-value for the probability that the angle between two random vectors is smaller or equal to the one calculatted from x and y

References

S. Li , 2011. Concise Formulas for the Area and Volume of a Hyperspherical Cap. Asian Journal of Mathematics & Statistics, 4: 66-70.

Examples

x <- c(1,0); y <- c(1,1) # for a circle this should give us p = 0.25 as the angle between vectors
##  is pi/4 and for any vector the segment +-pi/4 covers a quarter of the circle 
angleTest(x,y)

Morpho

Calculations and Visualisations Related to Geometric Morphometrics

v2.8
GPL-2
Authors
Stefan Schlager [aut, cre, cph], Gregory Jefferis [ctb], Dryden Ian [cph]
Initial release
2020-02-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.