Functions to compute spatial signs, symmetrized signs, ranks and signed ranks.

1 2 3 4 5 6 |

`X` |
a matrix or a data frame |

`center` |
a vector or a logical, see details |

`shape` |
a matrix or a logical, see details |

`...` |
arguments that can be passed on to function used for the estimation of shape. |

`na.action` |
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

*||x_i-x_j||^{-1}(x_i-x_j)*

(there are `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:

*R(x_i)=ave_j{||x_i-x_j||^{-1}(x_i-x_j)}*

Spatial signed rank of an observation is defined as

*Q(x_i)=(R(x_i)+ave_j{||x_i+x_j||^{-1}(x_i+x_j)})/2*

If a numerical value is given for `shape`

and/or `center`

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, seija.sirkia@iki.fi

Visuri, S., Koivunen, V. and Oja, H. (2000). Sign and rank covariance matrices. *J. Statistical Planning and Inference*, 91, 557-575.

`spatial.sign`

for the signs, spatial sign and rank covariance matrices and `spatial.shape`

for the standardizing transformations

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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.