Moving-average model error terms This is a basic question on Box-Jenkins MA models. As I understand, an MA model is basically a linear regression of time-series values $Y$ against previous error terms $e_t,..., e_{t-n}$. That is, the observation $Y$ is first regressed against its previous values $Y_{t-1}, ..., Y_{t-n}$ and then one or more $Y - \hat{Y}$ values are used as the error terms for the MA model.
But how are the error terms calculated in an ARIMA(0, 0, 2) model? If the MA model is used without an autoregressive part and thus no estimated value, how can I possibly have an error term?
 A: A Gaussian MA(q) model is defined (not only by Box and Jenkins!) as
$$
Y_t = -\sum_{i=1}^q \vartheta_i e_{t-i} + \sigma e_t,\quad e_t\stackrel{\text{iid}}{\sim} \mathcal{N}(0,1)
$$
so the MA(q) model is a "pure" error model, the degree $q$ defining how far the correlation goes back.
A: See my post here for an explanation of how to understand the disturbance terms in a MA series. 
You need different estimation techniques to estimate them. This is because you cannot first get the residuals of a linear regression and then include the lagged residual values as explanatory variables because the MA process uses the residuals of the current regression. In your example you are making two regression equations and using residuals from one into the other. This is not what an MA process is. It cannot be estimated with OLS.
A: MA Model Estimation:
Let us assume a series with 100 time points, and say this is characterized by MA(1) model with no intercept. Then the model is given by
$$y_t=\varepsilon_t-\theta\varepsilon_{t-1},\quad t=1,2,\cdots,100\quad (1)$$
The error term here is not observed. So to obtain this, Box et al. Time Series Analysis: Forecasting and Control (3rd Edition), page 228, suggest that the error term is computed recursively by,
$$\varepsilon_t=y_t+\theta\varepsilon_{t-1}$$
So the error term for $t=1$ is,
$$\varepsilon_{1}=y_{1}+\theta\varepsilon_{0}$$
Now we cannot compute this without knowing the value of $\theta$. So to obtain this, we need to compute the Initial or Preliminary estimate of the model, refer to Box et al. of the said book, Section 6.3.2 page 202 state that,

It has been shown that the first $q$ autocorrelations of MA($q$) process
  are nonzero and can be written in terms of the parameters of the model
  as
  $$\rho_k=\displaystyle\frac{-\theta_{k}+\theta_1\theta_{k+1}+\theta_2\theta_{k+2}+\cdots+\theta_{q-k}\theta_q}{1+\theta_1^2+\theta_2^2+\cdots+\theta_q^2}\quad k=1,2,\cdots, q$$ The expression above for$\rho_1,\rho_2\cdots,\rho_q$
  in terms $\theta_1,\theta_2,\cdots,\theta_q$, supplies $q$ equations
  in $q$ unknowns. Preliminary estimates of the $\theta$s can be
  obtained by substituting estimates $r_k$ for $\rho_k$ in above
  equation

Note that $r_k$ is the estimated autocorrelation. There are more discussion in Section 6.3 - Initial Estimates for the Parameters, please read on that. Now, assuming we obtain the initial estimate $\theta=0.5$. Then,
$$\varepsilon_{1}=y_{1}+0.5\varepsilon_{0}$$
Now, another problem is we don't have value for $\varepsilon_0$ because $t$ starts at 1, and so we cannot compute $\varepsilon_1$. Luckily, there are two methods two obtain this,


*

*Conditional Likelihood

*Unconditional Likelihood


According to Box et al. Section 7.1.3 page 227, the values of $\varepsilon_0$ can be substituted to zero as an approximation if $n$ is moderate or large, this method is Conditional Likelihood. Otherwise, Unconditional Likelihood is used, wherein the value of $\varepsilon_0$ is obtain by back-forecasting, Box et al. recommend this method. Read more about back-forecasting at Section 7.1.4 page 231. 
After obtaining the initial estimates and value of $\varepsilon_0$, then finally we can proceed with the recursive calculation of the error term. Then the final stage is to estimate the parameter of the model $(1)$, remember this is not the preliminary estimate anymore.
In estimating the parameter $\theta$, I use Nonlinear Estimation procedure, particularly the Levenberg-Marquardt algorithm, since MA models are nonlinear on its parameter.
Overall, I would highly recommend you to read Box et al. Time Series Analysis: Forecasting and Control (3rd Edition).
A: You say "the observation $Y$ is first regressed against its previous values $Y_{t−1},...,Y_{t−n}$ and then one or more $Y−\hat{Y}$ values are used as the error terms for the MA model." What I say is that $Y$ is regressed against two predictor series $e_{t-1}$ and $e_{t−2}$ yielding an error process $e_t$ which will be uncorrelated for all i=3,4,,,,t .We then have two regression coefficients: $\theta_1$ representing the impact of $e_{t-1}$ and $\theta_2$ representing the impact of $e_{t-2}$. Thus $e_t$ is a white noise random series containing n-2 values. Since we have n-2 estimable relationships we start with the assumption that e1 and e2 are equal to 0.0 . Now for any pair of $\theta_1$ and $\theta_2$ we can estimate the t-2 residual values. The combination that yields the smallest error sum of squares would then be the best estimates of $\theta_1$ and $\theta_2$.
A: With Hannan–Rissanen (1982) algorithm to fit parameters for an ARIMA model you actually always do an AR regression as first step, even for an pure MA model:

*

*AR(m) model (with $m > max(p, q)$) is fitted to the data

*Compute error terms for all $t$: $\epsilon_t$ = $y_t - \hat{y}_t$

*Regress $y_t$ on $y^{(d)}_{t-1},..,y^{(d)}_{t-p},\epsilon_{t-1},...,\epsilon_{t-q}$ (For a pure MA model the regression would be done only against the error terms $\epsilon_{t-1},...,\epsilon_{t-q}$)

*To improve accurancy optionally regress again with updated model parameters $\phi,\theta$ from step 3

So your suspicion that one needs some kind of model first, before one can compute the error part can be converted into an iterative algorithm for fitting the parameters of an ARIMA model.
See also

*

*Brockwell, Davis (2016) Introduction to Time Series and Forecasting, chapter 5.1.4
