Functions to compute spatial signs, symmetrized signs, ranks and signed ranks.
1 2 3 4 5 6
a matrix or a data frame
a vector or a logical, see details
a matrix or a logical, see details
arguments that can be passed on to function used for the estimation of shape.
a function which indicates what should happen when the data contain 'NA's. Default is to fail.
The spatial signs of an observed vector is simply the
vector, possibly affinely transformed first, multiplied by its
Euclidian length. See
spatial.sign for a precise
definition. Symmetrized spatial signs are the spatial signs of the pairwise
differences of the data
n over 2 of these). Spatial
rank of an observation is the average of the signs of the differences
of that observation and the others:
Spatial signed rank of an observation is defined as
If a numerical value is given for
these are used to transform the data before the computation of signs
or ranks. A logical
TRUE indicates that the shape or center should be
estimated. In this case an affine transformation that makes the
resulting signs or ranks have a covariance matrix equal or
proportional to the identity matrix and centerd on the origin is
found. A logical
FALSE indicates that the null value, that is, the
identity matrix or the origin, should be used. Note that only signed
ranks depend on a center.
The value of shape and/or location used are returned as attributes.
Seija Sirkia, firstname.lastname@example.org
Visuri, S., Koivunen, V. and Oja, H. (2000). Sign and rank covariance matrices. J. Statistical Planning and Inference, 91, 557-575.
1 2 3 4 5 6 7 8 9 10 11 12 13
A<-matrix(c(1,2,-3,4),ncol=2) X<-matrix(rnorm(100),ncol=2)%*%t(A) def.par<-par(no.readonly=TRUE) # for resetting layout(matrix(1:4,ncol=2,nrow=2,byrow=TRUE)) plot(X,col=c(2,rep(1,19))) plot(spatial.symmsign(X),col=c(2,rep(1,19)),xlim=c(-1,1),ylim=c(-1,1)) theta<-seq(0,2*pi,length=1000) lines(sin(theta),cos(theta)) plot(spatial.rank(X),col=c(2,rep(1,19)),xlim=c(-1,1),ylim=c(-1,1)) lines(sin(theta),cos(theta)) plot(spatial.signrank(X),col=c(2,rep(1,19)),xlim=c(-1,1),ylim=c(-1,1)) lines(sin(theta),cos(theta)) par(def.par)