Bookmark and Share

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

[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 <>
To   <>
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] * y[_n -12] + [ARMA] * 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!

*   For searches and help try:

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