1
$\begingroup$

I seeking help in understanding specific values underlying the formula's for the MA(p) model & the AR(q) model. I am attempting to implement the models (building up to the combined ARIMA model) in the programming language Java.

I do not come from an overly mathematical (I'm fairly new to statistics at least) background so be gentle.

Here is the formula I am using for the AR(p) model:

$$X_t - μ = β_1(X_{t-1} - μ) + ... + β_p(X_{t-p} - μ) + Z_t$$

Where $X$ is the time series, $μ$ is the mean of the time series, $β$ is the auto-correlation coefficient at a specific lag, $p$ is the order of the model and $Z$ is white noise of mean $0$ and variance $σ^2$.

I'm fairly certain I have the above figured out, however the term "$Z_t$" confuses me. How would I implement this in code? I understand it is "random" however what are its ranges? Surely there must be a maximum and minimum of the term $Z_t$. Is it somehow based on the variance of the overall dataset? How is the "$Z$" value calculated on implementation exactly?

Here is the formula I am using for the MA(q) model:

$$X_t - μ = Z_t - θ_1(Z_{t-1}) - ... - θ_q(Z_{t-q})$$

Where $X$ is again the time series dataset, $μ$ is the mean of the dataset, $Z$ is white noise with mean 0 and variance $σ^2$, $θ$ is the correlation coefficient at a specific lag and $q$ is the order of the model.

Again I the same issue as the above model in regards to the "$Z$" term. Also $θ$ is also the correlation coefficient of the dataset at various different lags, correct?

Any help on this matter would be extremely welcomed and if you have any questions I would more than happy to answer them.

Any use of examples alongside a full dataset i.e., X = (1,2,3,4,5,6,7) would be also extremely welcomed as it helps me understand the concept much more easily. Also please try to keep the explaination as idiot proof and contained as possible.

$\endgroup$
1
$\begingroup$

The $z_t$ is the error term, and is obtain by

$$z_t = x_t-\hat{x}_t$$

Or the difference between the observed series ($x_t$) and the predicted ($\hat{x}_t$). To code this, you need to obtain the $\hat{x}_t$, which is just the expected value of $x_t$ or $E[x_t]$. So for example, AR($1$) $$x_t=\beta x_{t-1}+z_t$$ where $\beta$ is the parameter, then $$E[x_t]=\hat{x_t}=\beta x_{t-1},\quad \mathrm{since}\; E[z_t]=0$$ Thus, $$z_t=x_t-\beta x_{t-1}.$$ For MA case, however, is quite complicated. Assuming we have MA(1), $$x_t=z_t-\theta z_{t-1}$$ where $\theta$ is the parameter, the error term ($z_t$) is not observed, so to compute this we need to recursively calculate this using the formula,

$$z_t=x_t-\theta z_{t-1}$$

Here is my answer on the steps of calculating the error term.

$\endgroup$
  • $\begingroup$ Hi Al-Ahmadgaid thanks for your responce. I have looked at the answer you provided previously, I just wish to confirm the following: I have read that back-forecasting is only used in large cases of t, other wise the error term is considered zero? Is this the case? $\endgroup$ – JConway Nov 7 '13 at 14:59
  • $\begingroup$ Yap, but I cant give you how large is large. Box et al., however, recommends the back-forecasting technique rather than approximating this with 0. Unless, maybe if you have at least 200 time points, we can consider that as large already. $\endgroup$ – Al-Ahmadgaid Asaad Nov 8 '13 at 7:06
  • $\begingroup$ So the MA model would be: 0[Zt] - co-eficient[θ]*(0[Zt-1])? That doesn't make much sense. $\endgroup$ – JConway Nov 12 '13 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.