angle: Angle between two subspaces

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Measures angle between two subspaces. Smallest value is 0, largest is 90 from http://www4.stat.ncsu.edu/~li/software/GroupDR.R http://lexinli.biostat.berkeley.edu/softwares/dr/GroupDR.R

Usage

1
angle(B1, B2)

Arguments

B1

first matrix

B2

second matrix

Value

scalar value of the angle between B1 and B2

Examples

1
2
3
4
5
6
7
8
9
## case where any relation between b1 and b2 is random
b1 <- matrix(rnorm(10 * 2), ncol = 2)
b2 <- matrix(rnorm(10 * 2), ncol = 2)
angle(b1, b2)

## angle here should be small
b1 <- matrix(rnorm(10 * 2), ncol = 2)
b2 <- b1 + matrix(rnorm(10 * 2, sd = 0.2), ncol = 2)
angle(b1, b2)

hierSDR documentation built on Sept. 24, 2021, 1:06 a.m.