ojaSignedRank | R Documentation |
The function computes the Oja signed rank of a point x
w.r.t.
a data set X
or, if no
point x
is given, the Oja signed ranks of all points in X
.
ojaSignedRank(X, x = NULL, p = NULL, silent = FALSE,
na.action = na.fail)
X |
numeric data.frame or matrix containing the data points as rows. |
x |
|
p |
|
silent |
logical, if subsampling is done or the expected
computation time is too long, a warning message will be printed
unless |
na.action |
a function which indicates what should happen when the data contain 'NA's. Default is to fail. |
The function computes the Oja signed rank of the point x
w.r.t.
the data set X
or, if no x
is specified, the Oja signed
ranks of all data points in X
w.r.t. X
. For a definition
of Oja signed rank see Hettmansperger et al. (1997) formula (9).
The matrix X
needs to have at least as many rows as columns in
order to give sensible results. The vector x
has to be of length
ncol(X)
. If x
is specified, a vector of length
ncol(X)
is returned. Otherwise the return value is a matrix of
the same dimensions as X
where the i
-th row contains the
Oja rank of the i
-th row of X
.
The function will also work for matrices X
with only one column
and also vectors. Then (univariate) signed ranks are returned.
For n = nrow(X)
data points in R^k
, where k = ncol(X)
,
the computation of the Oja signed rank necessitates the evaluation of
N = 2^k*choose(n,k)
hyperplanes in R^k
. Thus for large data sets the function offers a
subsampling option in order to deliver (approximate) results within
reasonable time. The subsampling fraction is controlled by the parameter p
:
If p < 1
is passed to the function, the computation is
based on a random sample of only p N
of all possible N
hyperplanes. If p
is not specified (which defaults to p = NULL
),
it is automatically determined based on n
and k
to yield a
sensible trade-off between accuracy and computing time.
If N k^3 < 6 \cdot 10^6
, the
sample fraction p
is set to 1 (no subsampling). If all Oja signed ranks of X
are requested, a hyperplane sample is
drawn once and all Oja signed ranks are then computed based on this sample.
Finally, subsampling is feasible. Even for very small p
useable
results can be expected, see e.g. the examples for the function ojaRCM
.
Either a numeric vector, the Oja signed rank of x
, or
a matrix of the same dimensions as X
containing the Oja signed ranks of X
as rows.
Jyrki Möttönen
Fischer D, Mosler K, Möttönen J, Nordhausen K, Pokotylo O and Vogel D (2020). “Computing the Oja Median in R: The Package OjaNP.” Journal of Statistical Software, 92(8), pp. 1-36. doi: 10.18637/jss.v092.i08 (URL: http://doi.org/10.18637/jss.v092.i08).
Hettmansperger, T. P.,\ Möttönen, J. and Oja, H. (1997), Affine invariant multivariate one-sample signed-rank tests, J.\ Amer. Statist. Assoc., 92, 1591–1600.
Oja, H. (1999), Affine invariant multivariate sign and rank tests and corresponding estimates: A review, Scand. J. Statist., 26, 319–343.
ojaSign
,
ojaRank
,
ojaRCM
,
hyperplane
set.seed(123)
X <- rmvnorm(n = 30,mean = c(0,0)) # from package 'mvtnorm'
ojaSignedRank(X)
ojaSignedRank(X, x = c(0,0)) # zero
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.