Description Usage Arguments Details Value Note Author(s) References See Also Examples
Implements Box-Cox analysis for "Arima" class objects, the output from arima
, a R built-in function.
Variance change in time series is an important topic.
In some cases using a Box-Cox transformation will provide a much simpler
analysis than the much more complex ARMA-GARCH approach.
See US Tobacco series example given below for an example.
1 2 |
object |
output from arima, a R built-in function |
interval |
interval to be searched for the optimal transformation |
type |
ignored unless, InitLambda!="none". Type of transformation, default is "BoxCox". Otherwise a simple power transformation. |
InitLambda |
default "none". Otherwise a numerical value giving the transformation parameter. |
... |
optional arguments passed to optimize |
If no transformation is used on the data, then the original data is used. But if a transformation has already been used, we need to inverse transform the data to recover the untransformed data.
For lambda!=0, the Box-Cox transformation is of x is (x^lambda-1)/lambda. If the minimum data value is <= 0, a small positive constant, equal to the negative of the minimum plus 0.25, is added to all the data values.
The log of the Jacobian is (lambda-1)*sum(log(z[(D+1):n]), where lambda is the transformation, n=length(z), z is the vector of data and D = d + ds*s, where d is the degree of regular differencing, ds is the degree of seasonal differencing and s is the seasonal period. The correct expression for the loglikelihood function was first given in Hipel and McLeod (1977, eqn. 10). Using the wrong expression for the Jacobian has a disasterous effect in many situations. For example with the international airline passenger time series, the MLE for lambda would be about 1.958 instead of close to zero.
If the minimum data value is <= 0, a small positive constant, equal to the negative of the minimum plus 0.25, is added to all the data values.
No value returned. Graphical output is produced as side-effect. The plot shows relative likelihood function as well as the MLE and a confidence interval.
The MASS package has a similar function boxcox
but this is implemented
only for regression and analysis of variance.
A.I. McLeod and Y. Zhang
Hipel, K.W. and McLeod, A.I. (1977). Advances in Box-Jenkins Modelling. Part 1, Model Construction. Water Resources Research 13, 567-575.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run: #not run to save time!
#Tobacco Production
plot(USTobacco)
USTobacco.arima<-arima(USTobacco,order=c(0,1,1))
BoxCox(USTobacco.arima)
#
air.arima<-arima(AirPassengers, c(0,1,1), seasonal=list(order=c(0,1,1), period=12))
BoxCox(air.arima)
#
#In this example, we fit a model to the square-root of the sunspots and
#back transform in BoxCox.
sqrtsun.arima<-arima(sqrt(sunspot.year),c(2,0,0))
BoxCox(sqrtsun.arima, InitLambda=0.5, type="power")
#
#Back transform with AirPassengers
Garima<-arima(log(AirPassengers), c(0,1,1), seasonal=list(order=c(0,1,1),period=12))
BoxCox(Garima, InitLambda=0)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.