BCTR

Performs a forward or an inverse Box‑Cox (power) transformation.

Required Arguments

Z — Vector of length NOBS containing the data. (Input)

POWER — Exponent parameter in the power transformation. (Input)

SHIFT — Shift parameter in the power transformation. (Input)
SHIFT must satisfy the relation min(Z(i)) + SHIFT > 0.

X — Vector of length NOBS containing the transformed data. (Output)
If Z is not needed, then X and Z can occupy the same storage locations. In this case, IPRINT = 1 will print two identical vectors.

Optional Arguments

NOBS — Number of observations in Z. (Input)
NOBS must be greater than or equal to one.
Default: NOBS = size (Z,1).

IPRINT — Printing option. (Input)
Default: IPRINT = 0.

 

IPRINT

Action

0

No printing is performed.

1

Prints Z and the transformed data, X.

IDIR — Direction of transformation option. (Input)
Default: IDIR = 0.

 

IDIR

Action

0

Forward transformation.

1

Inverse transformation.

FORTRAN 90 Interface

Generic: CALL BCTR (Z, POWER, SHIFT, X [])

Specific: The specific interface names are S_BCTR and D_BCTR.

FORTRAN 77 Interface

Single: CALL BCTR (NOBS, Z, IPRINT, IDIR, POWER, SHIFT, X)

Double: The double precision name is DBCTR.

Description

Routine BCTR performs a forward or inverse Box‑Cox transformation of the n = NOBS observations {Zt} for t = 1, 2, …, n.

The forward transformation is useful in the analysis of linear models or models with nonnormal errors or nonconstant variance (Draper and Smith 1981, page 222). In the time series setting, application of the appropriate transformation and subsequent differencing of a series may enable model identification and parameter estimation in the class of homogeneous stationary autoregressive‑moving average models. The inverse transformation may later be applied to certain results of the analysis, such as forecasts and probability 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 ARIMA models is given in Box and Jenkins (1976, page 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 ξ = SHIFT; then, the computational formula utilized by routine BCTR is given by

 

where Zt+ ξ > 0 for all t. The computational and Box‑Cox formulas differ only in the scale and the origin of the transformed data. Consequently, the general analysis of the data is unaffected (Draper and Smith 1981, page 225).

The inverse transformation is computed by

 

where {Zt} now represents the result computed by BCTR for a forward transformation of the original data using parameters λ and ξ.

Comments

1. Informational errors

 

Type

Code

Description

4

1

For the specified forward transformation, the minimum element of X will underflow.

4

2

For the specified forward transformation, the maximum element of X will overflow.

4

3

For the specified inverse transformation, the maximum element of X will overflow.

4

4

For the specified inverse transformation, the minimum element of X will underflow.

2. The forward transformation is performed prior to fitting a model. Differencing of the data is done after the data are transformed.

3. The inverse transformation is performed on results such as forecasts and their corresponding probability limits.

Examples

Example 1

Consider the Airline Data (Box and Jenkins 1976, page 531) consisting of the monthly total number of international airline passengers from January 1949 through December 1960. Routine BCTR is used to compute a forward Box‑Cox transformation of the first 12 observations. In the transformation SHIFT and POWER are each set to zero, which corresponds to taking natural logarithms of the data.

 

USE GDATA_INT

USE BCTR_INT

 

IMPLICIT NONE

INTEGER IPRINT, NOBS

PARAMETER (IPRINT=1, NOBS=12)

!

INTEGER NCOL, NROW

REAL POWER, SHIFT, X(NOBS), Z(144, 1)

! Airline Data

CALL GDATA (4, Z, NROW, NCOL)

! Forward direction

! Transformation parameters

POWER = 0.0

SHIFT = 0.0

! Compute natural logarithms of

! first 12 observations in Z

CALL BCTR (Z(:,1), POWER, SHIFT, X, NOBS=NOBS, IPRINT=IPRINT)

!

END

Output

 

Output from BCTR

 

I Z X

1 112.00 4.7185

2 118.00 4.7707

3 132.00 4.8828

4 129.00 4.8598

5 121.00 4.7958

6 135.00 4.9053

7 148.00 4.9972

8 148.00 4.9972

9 136.00 4.9127

10 119.00 4.7791

11 104.00 4.6444

12 118.00 4.7707

Example 2

The estimated standard errors of forecasts (lead times 1 through 12 at origin July 1957) using the transformed Airline Data (Box and Jenkins 1976, page 311) may be converted back to their original scale using routine BCTR. The backward Box‑Cox transformation with SHIFT and POWER each set to zero corresponds to using the exponential function.

 

USE BCTR_INT

 

IMPLICIT NONE

INTEGER NOBS

PARAMETER (NOBS=12)

!

INTEGER IDIR, IPRINT

REAL POWER, SD(NOBS), SHIFT, X(NOBS)

! Standard errors of forecasts

DATA SD/3.7, 4.3, 4.8, 5.3, 5.8, 6.2, 6.6, 6.9, 7.2, 7.6, 8.0, &

8.2/

!

SD=SD * 1.0E-2

! Backward direction

IDIR = 1

! Transformation parameters

POWER = 0.0

SHIFT = 0.0

! Transform standard errors from

! log scale to original scale

IPRINT = 1

CALL BCTR (SD, POWER, SHIFT, X, IPRINT=IPRINT, IDIR=IDIR)

!

END

Output

 

Output from BCTR

 

I Z X

1 0.037000 1.0377

2 0.043000 1.0439

3 0.048000 1.0492

4 0.053000 1.0544

5 0.058000 1.0597

6 0.062000 1.0640

7 0.066000 1.0682

8 0.069000 1.0714

9 0.072000 1.0747

10 0.076000 1.0790

11 0.080000 1.0833

12 0.082000 1.0855