angleTest | R Documentation |
Test whether the direction of two vectors is similar
angleTest(x, y)
x |
vector |
y |
vector |
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.
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 |
S. Li , 2011. Concise Formulas for the Area and Volume of a Hyperspherical Cap. Asian Journal of Mathematics & Statistics, 4: 66-70.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.