I want to create random time series that follow a given auto-correlation function. For this I am using an AR(n) model approach: $$X_t = \sum_{i=1}^n\alpha_i X_{t-i} + \epsilon_t$$ where $\epsilon$ is a random white noise of mean 0 and $\alpha$ are my model coefficients computed from a known covariance matrix. See for example: https://stats.stackexchange.com/a/29240/365730
But when I do that, I end up with random time series that do not have the desired auto-correlation. Compare the dark green curve (which represents the model) with the black curve (the targeted auto-correlation) on this figure, in which I fitted an AR(8) model:
The auto-correlation is underestimated for lags lower than 8 (cf. left of the vertical dashed gray line) and for long lags it does not tend to 0 but to some negative value. The shorter my time series are, the more negative this correlation value is.
One possibility is that the sample correlation is biased, as reported for example here: Systematic negative bias in auto-correlations of random time-series and documented by Marriott and Pope (1954). In fact, only considering $\epsilon$, its auto-correlations for lag different than 0 is equal on average to $-1/(T-1)$, where $T$ is the length of the time series.
However, if I remove to $\epsilon$ its lag dependencies that I estimate from its auto-correlation function (i.e. $r=-1/(T-1)$), and compute the auto-correlation of the residual, I find a correlation values for lag different than 0 that are closer to 0. And using this residual for building the auto-correlated time series instead of the original $\epsilon$, I end up with an auto-correlation function closer to the desired one. By repeating the correction step on $\epsilon$ several times, I am even satisfied by the results:
I am really confused by all this and I wonder whether it is appropriate to correct $\epsilon$ as I do. And if not, what would be your advises in order to create auto-correlated random time series that match correctly the targeted auto-correlation function?
Thank you!