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?