Learn R Programming

Morpho (version 2.12)

angleTest: Test whether the direction of two vectors is similar

Description

Test whether the direction of two vectors is similar

Usage

angleTest(x, y)

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

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.

References

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

Examples

Run this code
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)

Run the code above in your browser using DataLab