I get very poor replication of longitudinal parameters from my own program using the Box-Jenkins model. I had no such problem with my own program generating AR(1) Gaussian data. Is there some trick that I haven't discovered yet? I would like to use the validation framework of Martinez-Rivera & Ventosa-Santaularia (2012) to check a new time series regression method that is better than the usual on AR(1), but itself depends on ARMA random generation when applied to ARMA data.
|
|
As Michael said , there should be no problems. But I would add two caveats 1) discard the first couple simulations as your starting values can have an impact. I would discard the first 500 values. 2) Make sure that what you are simulating is an invertible model. Check the roots to insure they meet the invertibility requirements. Typical output from some very bad analytical engines deliver non-invertible solutions as their "automatically selected final model" and never report this to their unsuspecting users. Often errors of omission are worse than errors of comission ! |
|||||
|
|
To generate an ARMA(2,2) with specified coefficents just pcik two initial values for x say x$_)$ and x$_1$ and generate as many e(t) as you need from a N(0, σ$^2$) distribution. Then for each t, X(t) =r$_1$ X(t-1) +r$_2$ X(t-2) + e(t) + a$_1$ e(t-1) +a$_2$ e(t-2). You have X(1) specified as x$_1$ and X(0) specified as x$_0$ take e(2), e(1) and e(0) along with x$_1$ and x$_0$ and plug them into the equation for X(2) and then continue for X(3), X(4),... using the recursion and the new e(t) term. There should be no problems. |
|||
|
|
|
In addition to the useful answers given, here's some Python code that I wrote that generates an $\text{ARMA}(p,q)$ gaussian time series:
An example of the usage of the code: say you want to simulate $n=100$ datapoints of an $\text{ARMA}(p,q)$ model with AR coefficients $\phi=(0.4,0.3)$ and MA coefficients $\theta=(0.1,-0.3)$, with a zero-mean gaussian noise with $\sigma=2$. Also, say you want to simulate $\text{burnin}=500$ datapoints first in order to avoid dependencies on the initial values. You create it with the code above as follows:
And now let's plot and see! (You need to install the matplotlib library in order to do the following):
And...tada!
|
||||
|
|

