Learn R Programming

LDRTools (version 0.2)

Pdist: Function to Compute the Distances Between Orthogonal Projection Matrices

Description

The function computes distances between orthogonal projection matrices that might have different ranks. Different weight functions for the ranks are available.

Usage

Pdist(x, weights = "constant")

Arguments

x
List of othogonal projection matrices (can have different ranks).
weights
The weight function used for the individual ranks. Possible inputs are constant, inverse and sq.inverse (see details).

Value

an object of class dist having the attributes:
Size
number of orthogonal projection matrices.
Labels
names of orthogonal projection matrices if available.
Diag
FALSE.
Upper
FALSE.
methods
The name of the weights used.

Details

A weighted distance between subspaces $P_1$ and $P_2$ with ranks $k_1$ and $k_2$ is given by $D_{w}^2(P_1,P_2)=0.5||w(k_1)P_1-w(k_2)P_2||^2$, where $w$ denotes the weight function. The possible weights are defined as constant: $w(k)=1$, inverse: $w(k)=1/k$ and sq.inverse: $w(k)=1/sqrt(k)$. The constant weight corresponds to the so called Crone & Crosby distance. Orthogonal projection matrices of zero rank are also possible inputs for the function.

References

Crone, L. J., and Crosby, D. S. (1995), Statistical Applications of a Metric on Subspaces to Satellite Meteorology, Technometrics 37, 324-328.

Liski, E., Nordhausen, K., Oja, H. and Ruiz-Gazen, A. (201?), Combining Linear Dimension Reduction Subspaces, to appear in the proceedings of ICORS 2015.

See Also

AOP

Examples

Run this code
# Ex.1
X.1 <- tcrossprod(matrix(rnorm(16),ncol=4))
X.2 <- tcrossprod(matrix(rnorm(16),ncol=4))
X.3 <- tcrossprod(matrix(rnorm(16),ncol=4))
U1 <- eigen(X.1)$vectors
U2 <- eigen(X.2)$vectors
U3 <- eigen(X.3)$vectors

PRO <- list(P1=O2P(U1),P2=O2P(U2),P3=O2P(U3))

DIST.MAT<-Pdist(PRO)
str(DIST.MAT)
as.matrix(DIST.MAT)
print(DIST.MAT, diag=TRUE)
print(DIST.MAT, diag=TRUE, upper=TRUE)

PRO2 <- list(O2P(U1),O2P(U2),O2P(U3))
Pdist(PRO2, weights="inverse")

#############################
# Ex.2
a <- c(1,1,rep(0,8))
A <- diag(a)
b <- c(1,1,1,1,rep(0,6))
B <- diag(b)
P.A <- O2P(A[,1:2])
P.B <- O2P(B[,1:4])

proj.list <- list(P.A,P.B)
Pdist(proj.list, weights="constant")
Pdist(proj.list, weights="inverse")
Pdist(proj.list, weights="sq.inverse")

Run the code above in your browser using DataLab