Suppose I have the following $AR(p)$ model.
$$X_t = \sum_{i=1}^{p} \phi_i X_{t-i} + \epsilon_t\,, $$
where $\epsilon_t$ has mean 0 variance $\sigma^2$. I am in the situation where the $\phi$s are known and my goal is to obtain the true auto-covariance $$ \gamma(k) = \text{Cov}(X_1, X_{1+k})\,. $$ (I am not interested in estimating $\gamma(k)$). The spectral density at $0$ for AR$(p)$ model is $$ f(0) = \sum_{k=-\infty}^{\infty} \gamma(k) = \dfrac{\sigma^2}{(1 - \sum_{i=1}^{p} \phi_i)^2}\, $$ which is available in closed-form to me, since all of $\sigma^2$ and $\phi_i$ are known to me. Now, by the Yule-Walker equations, for $k = 1, \dots, p$ $$ \gamma(k) = \sum_{i=1}^{p} \phi_i \gamma(k-i) $$ and $\gamma(0) = \sum_{i=1}^{p} \phi_i \gamma(k-i) + \sigma^2$.
Thus obtaining the true $\gamma(k)$ for $k = 0, \dots, p$ will require solving the above system of equations. I have two questions:
- Is there an off-the-shelf R/Python/Matlab function available that outputs $\gamma(k)$ if I give it $\phi_i$ and $\sigma^2$?
- What are the higher lag covariances: $\gamma(k)$ for $k > p$?