Returns the Box-Cox transformation of the input data point(s).
Syntax
BOXCOX(X, Alpha, Lambda, Return_type)
X the real number for which we compute the transformation.
Alpha is the input shift parameter for X. If omitted, the default value is 0.
Lambda is the input power parameter of the transformation, on a scale from 1 to 0. If omitted, the default value of 0 is assumed.
Return_type is a number that determines the type of return value: 1 (or missing)= Box-Cox , 2= Inverse Box-Cox, 3= LLF of Box-Cox.
RETURN_TYPE | NUMBER RETURNED |
---|---|
1 or omitted | Box-Cox Transform |
2 | Inverse of Box-Cox transform |
3 | LLF of Box-Cox transform |
Remarks
- Box-Cox transform is perceived as a useful data (pre)processing technique used to stabilize variance and make the data more normally distributed.
- The Box-Cox transformation is defined as follows:
$$ T\left ( x_{t}; \lambda, \alpha \right ) = \begin{cases} \dfrac{\left ( x_{t} + \alpha \right )^{\lambda}-1}{\lambda} & \text{ if } \lambda \neq 0 \\ \log \left ( x_t + \alpha \right ) & \text{ if } \lambda= 0 \end{cases} $$
Where:
- $x_{t}$ is the value of the input time series at time $t$
- $\lambda$ is the input scalar value of the Box-Cox transformation
- $\alpha$ is the shift parameter
- $\left(x_t +\alpha \right) \gt 0$ for all t values.
- The BOXCOX function accepts a single value or an array of values for X.
- The shift parameter must be large enough to make all the values of X positive.
- To compute the log-likelihood function (LLF), the BoxCox function assumes a Gaussian distribution which parameters ($\mu,\sigma^2$) are calculated using the maximum-likelihood estimate (MLE) method.
$$LLF_{\textrm{BoxCox}} = \frac{-N}{2}\times\left( \ln\left( 2\pi\hat{\sigma}^2\right)+1\right) $$
$$\hat{\sigma}^2=\frac{\sum_{t=1}^N{\left(y_t-\mu\right )^2}}{N}$$
Where:
- $\hat{\sigma}^2$ is the biased estimate of the variance.
- $N$ is the number of non-missing values in the sample data.
- $y_t$ is the t-th transformed observation.
Examples
Example 1:
|
|
Formula | Description (Result) | |
---|---|---|
=BOXCOX($B$2:$B$30,3,0.5,3) | LLF Boxcoc (-33.35) |
Files Examples
References
- James Douglas Hamilton; Time Series Analysis; Princeton University Press; 1st edition(Jan 11, 1994), ISBN: 691042896
- Tsay, Ruey S.; Analysis of Financial Time Series; John Wiley & SONS; 2nd edition(Aug 30, 2005), ISBN: 0-471-690740
- D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
0 Comments