Home · Command reference

RainbowStats™ · Command reference

TANH — Hyperbolic tangent transformation

Apply hyperbolic tangent to a number or to standardized time-series observations.

Syntax

TANH(number)
TANH(series)
TANH(seriesList)

Inputs and results

A NumberOperator returns Math.tanh(number), using the numeric input directly without standardization or angle conversion. A SeriesOperator applies Math.tanh(z) to every observation, where z = (value - mean) / standardDeviation. A DataListOperator applies the series transformation separately to each member, using that member's own mean and standard deviation.

Series results preserve observation dates and frequency, use the label Index, and range from -1 to 1.

Examples

TANH(1)
x = DIFF(SERIES_SINCE(UNRATE,20010101))
LINE_CHART(TANH(x))
LINE_CHART(TANH(LIST(x,DIFF(SERIES_SINCE(U6RATE,20010101)))))

Notes and interpretation

Series inputs are standardized automatically; number inputs are used directly. For series, the mean maps to 0; one standard deviation above or below it maps to approximately +0.762 or -0.762. TANH is monotonic and nonperiodic: it preserves the ordering of standardized values and their signs relative to the mean. Extreme inputs approach -1 or +1; floating-point results can reach those limits. Useful for bounded nonlinear regression features and indexes of standardized deviations. Compression reduces the influence of extreme magnitudes but loses information about their size. TANH does not guarantee constant variance, establish stationarity, or detect seasonality. Use the original data for volatility measurement and heteroskedasticity diagnostics.

Standardization requires a finite, positive standard deviation. Constant series cannot be standardized. Sample mean and standard deviation are calculated over the supplied input series; restrict the input period first when needed. For forecasting or backtesting, computing these statistics over the full sample can introduce future information.