DescTools (version 0.99.18)

LogSt: Started Logarithmic Transformation and Its Inverse

Description

Transforms the data by a log10 transformation, modifying small and zero observations such that the transformation yields finite values.

Usage

LogSt(x, calib = x, threshold = NULL, mult = 1)
LogStInv(x, threshold = NULL)

Arguments

x
a vector or matrix of data, which is to be transformed

calib
a vector or matrix of data used to calibrate the transformation(s), i.e., to determine the constant c needed

threshold
constant c that determines the transformation. The inverse function will look for an attribute named "threshold" if the argument is set to NULL.

mult
a tuning constant affecting the transformation of small values, see Details

Value

attr(.,"threshold").

Details

Small values are determined by the threshold c. If not given by the argument threshold, then it is determined by the quartiles q1 and q3 of the non-zero data as those smaller than c = q1=(q3=q1)mult. The rationale is that for lognormal data, this constant identifies 2 percent of the data as small. Beyond this limit, the transformation continues linear with the derivative of the log curve at this point. See code for the formula. Another possible value for the threshold c was: median(x) / (median(x)/quantile(x, 0.25))^2.9) The function chooses log10 rather than natural logs because they can be backtransformed relatively easily in the mind.

See Also

LogLin

Examples

Run this code
dd <- c(seq(0,1,0.1), 5 * 10^rnorm(100, 0, 0.2))
dd <- sort(dd)
r.dl <- LogSt(dd)
plot(dd, r.dl, type="l")
abline(v=attr(r.dl, "threshold"), lty=2)

x <- rchisq(df=3, n=100)
# should give 0 (or at least something small):
LogStInv(LogSt(x)) - x

Run the code above in your browser using DataLab