Main Content

Box-Cox transformation

**Using a fints object for the
tsobj argument of boxcox is not recommended.
Use fts2timetable to convert a
fints object to a timetable object and then
use timetable2table and table2array.**

[transdat,lambda] = boxcox(data) [transfts,lambda] = boxcox(tsobj) transdat = boxcox(lambda,data) transfts = boxcox(lambda,tsobj)

| Data vector. Must be positive and specified as a column data vector. |

| Financial time series object. |

`boxcox`

transforms nonnormally distributed
data to a set of data that has approximately normal distribution.
The Box-Cox transformation is a family of power transformations.

If λ is not = `0`

, then

$$data(\lambda )=\frac{dat{a}^{\lambda}-1}{\lambda}$$

If λ is = `0`

, then

$$data(\lambda )=\mathrm{log}(data)$$

The logarithm is the natural logarithm (log base e). The algorithm
calls for finding the λ value that maximizes the Log-Likelihood
Function (LLF). The search is conducted using `fminsearch`

.

`[transdat,lambda] = boxcox(data)`

transforms
the data vector `data`

using the Box-Cox transformation
method into `transdat`

. It also estimates the transformation
parameter λ.

`[transfts,lambda] = boxcox(tsojb)`

transforms
the financial time series object `tsobj`

using the
Box-Cox transformation method into `transfts`

. It
also estimates the transformation parameter λ.

If the input data is a vector, `lambda`

is
a scalar. If the input is a financial time series object, `lambda`

is
a structure with fields similar to the components of the object; for
example, if the object contains series names `Open`

and `Close`

, `lambda`

has
fields `lambda.Open`

and `lambda.Close`

.

`transdat = boxcox(lambda, data)`

and ```
transfts
= boxcox(lambda, tsobj)
```

transform the data using a certain
specified λ for the Box-Cox transformation. This syntax does
not find the optimum λ that maximizes the LLF.