Distance {IALS}R Documentation

The distance between the spaces spanned by the column of two matrices.

Description

Calculate the distance between spaces spanned by the column of two matrices. The distance is between 0 and 1. If the two spaces are the same, the distance is 0. if the two spaces are orthogonal, the distance is 1.

Usage

Distance(Z1, Z2)

Arguments

Z1

Input a matrix with p \times q_1.

Z2

Input another matrix with p \times q_2

Details

Define

\mathcal{D}(\bold{Q}_1,\bold{Q}_2)=\left(1-\frac{1}{\max{(q_1,q_2)}}\text{Tr}\left(\bold{Q}_1\bold{Q}_1^\top\bold{Q}_2\bold{Q}_2^\top\right)\right)^{1/2}.

By the definition of \mathcal{D}(\bold{Q}_1,\bold{Q}_2), we can easily see that 0 \leq \mathcal{D}(\bold{Q}_1,\bold{Q}_2)\leq 1, which measures the distance between the column spaces spanned by two orthogonal matrices \bold{Q}_1 and \bold{Q}_2, i.e., \text{span}(\bold{Q}_1) and \text{span}(\bold{Q}_2). In particular, \text{span}(\bold{Q}_1) and \text{span}(\bold{Q}_2) are the same when \mathcal{D}(\bold{Q}_1,\bold{Q}_2)=0, while \text{span}(\bold{Q}_1) and \text{span}(\bold{Q}_2) are orthogonal when \mathcal{D}(\bold{Q}_1,\bold{Q}_2)=1. The Gram-Schmidt orthogonalization can be used to make \bold{Q}_1 and \bold{Q}_2 column-orthogonal matrices.

Value

Output a number between 0 and 1.

Author(s)

Yong He, Ran Zhao, Wen-Xin Zhou.

References

He, Y., Zhao, R., & Zhou, W. X. (2023). Iterative Least Squares Algorithm for Large-dimensional Matrix Factor Model by Random Projection. <arXiv:2301.00360>.

Examples

set.seed(1111)
A=matrix(rnorm(10),5,2)
B=matrix(rnorm(15),5,3)
Distance(A,B)

[Package IALS version 0.1.3 Index]