Description Usage Arguments Value Examples
A transformation is created which could be used to shift all
elements of a data vector into the positive range. This is a utility
function which can be applied before log-scaling or 1/x
scaling of
data. The transformation will be a linear shift and not involve scaling
or squaring.
1 | Transformation.makePositive(data, zeroAllowed = TRUE)
|
data |
the data vector |
zeroAllowed |
is it ok if the transformation of the data vector would produce 0 values? |
a Transformation
which would transform the data vector
into the positive domain, or NULL
if no such transformation can be
provided
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | data <- c(-1, 0, 0.1, 2)
trafo <- Transformation.makePositive(data, zeroAllowed=TRUE)
trafo@forward(data)
# [1] 0.0 1.0 1.1 3.0
trafo@backward(trafo@forward(data))
# [1] -1.0 0.0 0.1 2.0
trafo@forward
# function (x)
# x + 1
# <environment: 0x4bee3c0>
trafo@complexity
# [1] 1
trafo <- Transformation.makePositive(data, zeroAllowed=FALSE)
trafo@forward(data)
# [1] 0.0625 1.0625 1.1625 3.0625
trafo@backward(trafo@forward(data))
# [1] -1.0 0.0 0.1 2.0
trafo@complexity
# [1] 2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.