Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[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 <mail@roland-geier.de>
To   <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index