tran {analogue} | R Documentation |
Provides common data transformations and standardizations useful for
palaeoecological data. The function acts as a wrapper to function
decostand
in package vegan for several of the
available options.
tran(x, method, a = 1, b = 0, base = exp(1), na.rm = FALSE, na.value = 0, ...)
x |
A matrix-like object. |
method |
transformation or standardization method to apply. See Details for available options. |
a |
Constant to multiply x by. method = "log"
only. Can be a vector, in which case the vector of values to
multiply each column of x by. |
b |
Constant to add to x before taking logs. method
= "log" only. Can be a vector, in which case the vector of values
to add to each column of x . |
base |
the base with respect to which logarithms are
computed. See log for further details. The default is
to compute natural logarithms. |
na.rm |
Should missing values be removed before some computations? |
na.value |
The value with which to replace missing values
(NA ). |
... |
Arguments passed to decostand . |
The function offers following standardization methods for community data:
sqrt
: take the square roots of the observed values.
cubert
: take the cube root of the observed values.
log
: take the logarithms of the observed values. The
tansformation applied can be modified by constants a
and
b
and the base
of the logarithms. The transformation
applied is x^* =
log[base](ax + b).
reciprocal
: returns the multiplicative inverse or
reciprocal, 1/x, of the observed values.
freq
: divide by column (variable, species) maximum and
multiply by the number of non-zero items, so that the average of
non-zero entries is 1 (Oksanen 1983).
center
: centre all variables to zero mean.
range
: standardize values into range 0 ... 1. If all
values are constant, they will be transformed to 0.
percent
: convert observed count values to percentages.
proportion
: convert observed count values to proportions.
standardize
: scale x
to zero mean and unit
variance.
pa
: scale x
to presence/absence scale (0/1).
missing
: replace missing values with na.value
.
chi.square
: divide by row sums and square root of
column sums, and adjust for square root of matrix total
(Legendre & Gallagher 2001). When used with the Euclidean
distance, the distances should be similar to the the
Chi-square distance used in correspondence analysis. However, the
results from cmdscale
would still differ, since
CA is a weighted ordination method.
hellinger
: square root of observed values that have
first been divided by row (site) sums (Legendre & Gallagher 2001).
wisconsin
: applies the Wisconsin double
standardization, where columns (species, variables) are first
standardized by maxima and then sites (rows) by site totals.
pcent2prop
: convert percentages to proportions.
prop2pcent
: convert proportions to percentages.
Returns the suitably transformed or standardized x
. If x
is a data frame, the returned value is like-wise a data frame. The
returned object also has an attribute "tran"
giving the name of
applied transformation or standardization "method"
.
Gavin L. Simpson. Much of the functionality of tran
is
provided by decostand
, written by Jari Oksanen.
Legendre, P. & Gallagher, E.D. (2001) Ecologically meaningful transformations for ordination of species data. Oecologia 129; 271-280.
Oksanen, J. (1983) Ordination of boreal heath-like vegetation with principal component analysis, correspondence analysis and multidimensional scaling. Vegetatio 52; 181-189.
data(swapdiat) ## convert percentages to proportions sptrans <- tran(swapdiat, "pcent2prop") ## apply Hellinger transformation spHell <- tran(swapdiat, "hellinger")