# About the difference between residuals and disturbance error for AR and MA

I'm confused with the error term and residuals for AR and MA models.

I thought residual Q is defined as $$x_t-\hat{x_{t}}$$, while error term is $$\epsilon_t$$, and residuals are estimated values for error terms?

For AR(1)

$$x_t=\phi x_{t-1}+\epsilon_t$$

Hence, $$Q=x_t-\hat{x_{t}}=x_t- \hat{\phi} x_{t-1}$$

From the model, we have $$\epsilon_t = x_t- \phi x_{t-1}$$, so with estimated $$\hat{\phi}$$, we have $$\hat{\epsilon_t} = x_t- \hat{\phi} x_{t-1}$$

In this case , $$Q=\hat{\epsilon_t}$$.

For MA (1) $$x_t=\epsilon_t- \theta \epsilon_{t-1}$$

Similarly, $$Q=x_t-\hat{x_{t}}=x_t- \epsilon_t+\hat{\theta} \epsilon_{t-1}$$

From the model, we have $$\epsilon_t = x_t+\theta \epsilon_{t-1}$$, so with estimated $$\hat{\theta}$$, we have $$\hat{\epsilon_t} = x_t+ \hat{\theta} \epsilon_{t-1}$$.

In this case, $$Q\neq\hat{\epsilon_t}$$.

What is the reason for this? residual calculation for MA part is wrong?

Let Q stand for the 1 period ahead prediction error; $$I_t$$ refers to the information set at time t (all that is known/knowable at time t). I think the tricky part here is in the case of the MA process to realize that E($$\theta \epsilon_t|I_t)=\theta \epsilon_t$$ and not $$0$$.
$$Q=x_{t+1}-E(X_{t+1}|I_t)=(\phi x_{t}+\epsilon_{t+1})-(E(\phi X_t+\epsilon_{t+1}|I_t))=(\phi x_{t}+\epsilon_{t+1})-(\phi x_t)=\epsilon_{t+1}$$
$$Q=x_{t+1}-E(X_{t+1}|I_t)=(\epsilon_{t+1}-\theta \epsilon_t)-(E(\epsilon_{t+1}-\theta \epsilon_t|I_t))=(\epsilon_{t+1}-\theta \epsilon_t)-(0-\theta \epsilon_t)=\epsilon_{t+1}$$