angleTest: Test whether the direction of two vectors is similar

View source: R/angleTest.r

angleTestR Documentation

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 documentation built on June 22, 2024, 7:19 p.m.