IMSL Statistics Reference Guide > Time Series and Forecasting > BOXCOXTRANS Function (PV-WAVE Advantage)
  

BOXCOXTRANS Function (PV-WAVE Advantage)
Performs a forward or an inverse Box-Cox (power) transformation.
Usage
result = BOXCOXTRANS(z, power)
Input Parameters
z—One-dimensional array containing the observations.
power—Exponent parameter in the Box-Cox (power) transformation.
Returned Value
result—One-dimensional array containing the transformed data.
Input Keywords
Double—If present and nonzero, double precision is used.
S—Shift parameter in the Box-Cox (power) transformation. Parameter shift must satisfy the relation min (z(i)) + S > 0. Default: S = 0.0.
Inverse—If present and nonzero, the inverse transform is performed.
Discussion
Function BOXCOXTRANS performs a forward or an inverse Box-Cox (power) transformation of n = N_ELEMENTS(z) observations {Zt} for t = 0, 1, ..., n–1.
The forward transformation is useful in the analysis of linear models or models with nonnormal errors or nonconstant variance (Draper and Smith 1981, p. 222). In the time series setting, application of the appropriate transformation and subsequent differencing of a series can enable model identification and parameter estimation in the class of homogeneous stationary autoregressive-moving average models. The inverse transformation can later be applied to certain results of the analysis, such as forecasts and prediction limits of forecasts, in order to express the results in the scale of the original data. A brief note concerning the choice of transformations in the time series models is given in Box and Jenkins (1976, p. 328).
The class of power transformations discussed by Box and Cox (1964) is defined by:
where Zt + ξ > 0 for all t. Since:
the family of power transformations is continuous.
Let λ = power and ξ = S; then, the computational formula used by BOXCOXTRANS is given by:
where Zt + ξ > 0 for all t. The computational and Box-Cox formulas differ only in the scale and origin of the transformed data. Consequently, the general analysis of the data is unaffected (Draper and Smith 1981, p. 225).
The inverse transformation is computed by:
where {Zt} now represents the result computed by BOXCOXTRANS for a forward transformation of the original data using parameters λ and ξ.
Example 1
The following example performs a Box-Cox transformation with power = 2.0 on 10 data points.
power  =  2.0
z  =  [1.0, 2.0, 3.0, 4.0, 5.0, 5.5, 6.5, 7.5, 8.0, 10.0]
; Transform Data using Box Cox Transform
x  =  BOXCOXTRANS(z, power)
PM, x, Title = 'Transformed Data'
 
; This results in the following output:
 
;     Transformed Data
;        1.00000
;        4.00000
;        9.00000
;        16.0000
;        25.0000
;        30.2500
;        42.2500
;        56.2500
;        64.0000
;        100.000
Example 2
This example extends the first example—an inverse transformation is applied to the transformed data to return to the orignal data values.
power = 2.0
z  =  [1.0, 2.0, 3.0, 4.0, 5.0, 5.5, 6.5, 7.5, 8.0, 10.0]
x  =  BOXCOXTRANS(z, power)
PM,  x, Title = 'Transformed Data'
; PV-WAVE prints the following:
; Transformed Data
; 1.00000
; 4.00000
; 9.00000
; 16.0000
; 25.0000
; 30.2500
; 42.2500
; 56.2500
; 64.0000
; 100.000
; Perform an Inverse Transform on the Transformed Data
y = BOXCOXTRANS(x, power, /inverse)
PM, y, Title = 'Inverse Transformed Data'
; PV-WAVE prints the following:
; Inverse Transformed Data
; 1.00000
; 2.00000
; 3.00000
; 4.00000
; 5.00000
; 5.50000
; 6.50000
; 7.50000
; 8.00000
; 10.0000
Fatal Errors
STAT_ILLEGAL_SHIFTS = # and the smallest element of z is z(#) = #. S plus z(#) = #. S + z(I) must be greater than 0 for i = 1, ..., N_ELEMENTS(z). N_ELEMENTS(z) = #.
STAT_BCTR_CONTAINS_NANOne or more elements of z is equal to NaN (Not a number). No missing values are allowed. The smallest index of an element of z that is equal to NaN is #.
STAT_BCTR_F_UNDERFLOWForward transform. power = #. S = #. The minimum element of z is z(#) = #. (z(#)+ S) ^ power will underflow.
STAT_BCTR_F_OVERFLOWForward transformation. power = #. S = #. The maximum element of z is z(#) = #. (z(#) + S) ^ power will overflow.
STAT_BCTR_I_UNDERFLOWInverse transformation. power = #. The minimum element of z is z(#) = #. exp(z(#)) will underflow.
STAT_BCTR_I_OVERFLOWInverse transformation. power = #. The maximum element of z(#) = #. exp(z(#)) will overflow.
STAT_BCTR_I_ABS_UNDERFLOWInverse transformation. power = #. The element of z with the smallest absolute value is z(#) = #. z(#) ^ (1/power) will underflow.
STAT_BCTR_I_ABS_OVERFLOWInverse transformation. power = #. The element of z with the largest absolute value is z(#) = #. z(#) ^ (1/ power) will overflow.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.