Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: ARIMA equation for MC simulation an time series operator reversion?


From   Roland Geier <[email protected]>
To   <[email protected]>
Subject   st: ARIMA equation for MC simulation an time series operator reversion?
Date   Fri, 1 Jun 2012 17:24:08 +0200 (CEST)

Dear all,

after fitting an ARIMA model to a time series, i usually perform monte carlo simulations to determine worst-case predictions on a 90% or 99% conficence level.

For example, the code for an ARIMA(12,1,2) looks like:

------------------- cut here -------------------
*
* x: ts values in levels,
* ln_x:  ts values in logs
* Now estimate an arima on first differences of ln_x
*
arima d.ln_x, vce(robust) ar(12) ma(2)
scalar mu =[ln_x]_cons

forval i=1/10000 {
  replace e = e(sigma)*invnorm(uniform())
  replace y = d.ln_x - `mu'

  *
  * Apply ARIMA equation
  *
  replace y = [ARMA]L12.ar * y[_n -12] + [ARMA]L1.ma * e[_n - 2] + e[_n]  if "beyond last observation"

  *
  * Integration part of arima -> reversion of time series operator d
  *
  replace x = ln_x
  replace x = x[_n -1] + (y[_n] + `mu')  if "beyond last observation"
}
------------------- cut here -------------------

This approach works fine in general. The problem is, i have to fit arima models to lots of time series. For each model, both the ARIMA equation and the differencing is likely to change (for example, using DS12 instead of D). Writing out the ARIMA equation and figuring out the correct reversion of the time series operator(s) can get a real pain.

My Questions:

a) Is there a better/more generic way to calculate x - that is, to apply the ARIMA equation?
b) Is there a better way to do the integration part of ARIMA, that is, reversion of the time series operator(s)?

Kind regards and thanks in advance for your suggestions/improvements!

Roland
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index