Pdist | R Documentation |
The function computes distances between orthogonal projection matrices that might have different ranks. Different weight functions for the ranks are available.
Pdist(x, weights = "constant")
x |
List of othogonal projection matrices (can have different ranks). |
weights |
The weight function used for the individual ranks. Possible inputs are |
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)=\frac{1}{2} ||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.
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. |
Eero Liski and Klaus Nordhausen
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. (2016), Combining Linear Dimension Reduction Subspaces. In: Agostinelli C., Basu A., Filzmoser P., Mukherjee D. (eds) Recent Advances in Robust Statistics: Theory and Applications. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-81-322-3643-6_7")}.
AOP
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.