| Transformations {coin} | R Documentation |
Rank-transformations for numerical data or dummy codings of factors.
trafo(data, numeric_trafo = id_trafo, factor_trafo = f_trafo,
ordered_trafo = of_trafo, surv_trafo = logrank_trafo,
var_trafo = NULL, block = NULL)
id_trafo(x)
ansari_trafo(x, ties.method = c("mid-ranks", "average-scores"))
fligner_trafo(x, ties.method = c("mid-ranks", "average-scores"))
normal_trafo(x, ties.method = c("mid-ranks", "average-scores"))
median_trafo(x)
consal_trafo(x, ties.method = c("mid-ranks", "average-scores"))
maxstat_trafo(x, minprob = 0.1, maxprob = 1 - minprob)
logrank_trafo(x, ties.method = c("logrank", "HL"))
f_trafo(x)
of_trafo(x)
data |
an object of class data.frame. |
numeric_trafo |
a function to by applied to numeric
elements of data returning a matrix with nrow(data)
rows and an arbitrary number of columns. |
factor_trafo |
a function to by applied to factor
elements of data returning a matrix with nrow(data)
rows and an arbitrary number of columns (usually a dummy or contrast
matrix). |
ordered_trafo |
a function to by applied to ordered
elements of data returning a matrix with nrow(data)
rows and an arbitrary number of columns (usually some scores). |
surv_trafo |
a function to by applied to
elements of class Surv of data returning a
matrix with nrow(data) rows and an arbitrary number of columns. |
var_trafo |
an optional named list of functions to be applied to the
corresponding variables in data. |
block |
an optional factor those levels are interpreted as blocks.
trafo is applied to each level of block separately. |
x |
an object of classes numeric, ordered, factor or
Surv. |
ties.method |
two methods are available to adjust scores for ties.
Either the score generating function is applied to mid-ranks
or scores, based on random ranks, are averaged average-scores.
For ties handling in case of censored data, see surv_test. |
minprob |
a fraction between 0 and 0.5. |
maxprob |
a fraction between 0.5 and 1. |
The utility functions documented here are used to define special independence tests.
trafo applies its arguments to the elements of data
according to the classes of the elements.
id_trafo is the identity transformation and f_trafo
computes dummy matrices for factors.
ansari_trafo and fligner_trafo compute Ansari-Bradley
or Fligner scores for scale problems.
normal_trafo, median_trafo and consal_trafo
implement normal scores, median scores or Conover-Salburg scores
(see neuropathy) for location problems,
logrank_trafo returns logrank scores for censored data.
A trafo function with modified default arguments is usually
feeded into independence_test via the xtrafo
or ytrafo arguments.
Fine tuning (different transformations for different variables) is
possible by supplying a named list of functions to the var_trafo
argument.
A named matrix with nrow(data) rows and
arbitrary number of columns. User-supplied transformations must
return a numeric vector or matrix.
### dummy matrices, 2-sample problem (only one column) f_trafo(y <- gl(2, 5)) ### score matrices of_trafo(y <- ordered(gl(3, 5))) ### K-sample problem (K columns) f_trafo(y <- gl(5, 2)) ### normal scores normal_trafo(x <- rnorm(10)) ### and now together trafo(data.frame(x = x, y = y), numeric_trafo = normal_trafo) ### the same, more flexible when multiple variables are in play trafo(data.frame(x = x, y = y), var_trafo = list(x = normal_trafo)) ### maximally selected statistics maxstat_trafo(rnorm(10)) ### apply transformation blockwise (e.g. for Friedman test) trafo(data.frame(y = 1:20), numeric_trafo = rank, block = gl(4, 5))