Processing math: 100%
Skip to contents

Functions to compute univariate range–power transformation and its back-transform.

Usage

rangepowerTransform(x, lbound = -Inf, ubound = +Inf, lambda = 1)

rangepowerBackTransform(y, lbound = -Inf, ubound = +Inf, lambda = 1)

Arguments

x

A numeric vector of data values.

y

A numeric vector of transformed data values.

lbound

A numerical value of variable lower bound.

ubound

A numerical value of variable upper bound.

lambda

A numerical value for the power transformation.

Value

Returns a vector of transformed or back-transformed values.

Details

The range-power transformation can be applied to variables with bounded support.

Lower bound case

Suppose x is a univariate random variable with lower bounded support SX(l,), where l>. Consider a preliminary range transformation defined as x(xl), which maps SXR+. The range-power transformation is a continuous monotonic transformation defined as t(x;λ)={(xl)λ1λifλ0log(xl)ifλ=0 with back-transformation function t1(y;λ)={(λy+1)1/λ+lifλ0exp(y)+lifλ=0

Lower and upper bound case

Suppose x is a univariate random variable with bounded support SX(l,u), where <l<u<+. Consider a preliminary range transformation defined as x(xl)/(ux), which maps SXR+. In this case, the range-power transformation is a continuous monotonic transformation defined as t(x;λ)={(xlux)λ1λifλ0log(xlux)ifλ=0, with back-transformation function t1(y;λ)={l+u(λy+1)1/λ1+(λy+1)1/λifλ0l+uexp(y)1+exp(y)ifλ=0

Author

Luca Scrucca

References

Scrucca L. (2019) A transformation-based approach to Gaussian mixture density estimation for bounded data. Biometrical Journal, 61:4, 873–888. https://doi.org/10.1002/bimj.201800174

Examples

# Lower bound case
x = rchisq(1000, 5)
y = rangepowerTransform(x, lbound = 0, lambda = 1/3)
par(mfrow=c(2,2))
hist(x, main = NULL, breaks = 21); rug(x)
hist(y, xlab = "y = t(x)", main = NULL, breaks = 21); rug(y)
xx = rangepowerBackTransform(y, lbound = 0, lambda = 1/3)
hist(xx, xlab = "t^-1(y) = x", main = NULL, breaks = 21); rug(xx)
plot(x, xx, ylab = "t^-1(y)"); abline(0,1)


# Lower and upper bound case
x = rbeta(1000, 2, 1)
y = rangepowerTransform(x, lbound = 0, ubound = 1, lambda = 0)
par(mfrow=c(2,2))
hist(x, main = NULL, breaks = 21); rug(x)
hist(y, xlab = "y = t(x)", main = NULL, breaks = 21); rug(y)
xx = rangepowerBackTransform(y, lbound = 0, ubound = 1, lambda = 0)
hist(xx, xlab = "t^-1(y) = x", main = NULL, breaks = 21); rug(xx)
plot(x, xx, ylab = "t^-1(y)"); abline(0,1)