hyperbolic: Hyperbolic transform

View source: R/hyperbolic.R

hyperbolicR Documentation

Hyperbolic transform

Description

Functions for transforming and back-transforming data using a hyperbolic function.

Usage

hyperbolic(x, factor = 0, scale = mean(x, na.rm = TRUE))

Ihyperbolic(x, factor = 0, scale)

Arguments

x

a numeric vector to be transformed by hyperbolic or back-trasnformed by Ihyperbolic. Must be strictly positive. Missing values are allowed. See Details.

factor

the hyperbolic adjustment term in the hyperbolic equation.

scale

the scaling factor for the data.

Details

If x contains missing values, then scale is computed after omitting the missing values and the output vector has a missing value wherever x has a missing value.

The basic equation for the hyberbolic transform is 1/(1 + (10^factor * x)/ scale). The basic equation is adjusted to produce fairly consistent values for small changes in factor and increase for increasing values in x.

The function hyperbolic computes the forward transform and the function Ihyperbolic computes the inverse [hyperbolic] transform, or back-transform.

Value

A numeric vector of the transformed or back-transformed values in x with an attribute "scale" of the values used for scale. The range of the values returned from hyperbolic is between 0 and 2 times scale.

Note

The original hyperbolic transform used a linear factor. The version in these functions uses the common log of the factor to make the factors easier to use.

When used with the default value for scale, factor values outside the range of +/- 3 have very little effect on the transform.

References

The use of a variable hyperbolic transform to help model the relations between stream water chemistry and flow was first described in:

Johnson, N.M., Likens, G.E., Borman, F.H., Fisher, D.W., and Pierce, R.S., 1969, A working model for the variation in stream water chemistry at the Hubbard Brook Experimental Forest, New Hampshire: Water Resources Research, v. 5, no. 6, p. 1353–1363.

See Also

boxCox

Examples

X.test <- c(1,4,9,16,25,36,49)
hyperbolic(X.test) # accept the defaults
hyperbolic(X.test, factor=1)
hyperbolic(X.test, factor=-1)

USGS-R/smwrBase documentation built on Oct. 18, 2022, 9:55 a.m.