Simulate AR(1) process in R with specified nonzero mean and AR coefficient

I need to simulate an AR(1) process with the following equation in R:

$$X_{t} = 5 + 0.5X_{t-1}+Z_t$$

Where $Z_t$ ~ White Noise(0,1) and $T=500$.

I know I should be using the arima.sim function from the forecast package with parameters n = 500 and ar = c(0.5) but I do not know how to account for the $\delta = 5$ or the fact that $Z_t$ is white noise with mean 0 and sd 1. I have been unable to find clear documentation on how to do this.

• what is $\delta$? Sep 27 '17 at 16:11
• I vote to leave this question open, as the solution isn't totally programming-related. Sep 27 '17 at 16:34
• It would help if you explained what $T$ is and where the $\delta$ comes from as otherwise it is unclear, at least to me, what you are asking. Sep 27 '17 at 17:32
• $T$ is essentially the number of samples, $\delta$ is another component of the AR(1) process as specified in the equation as 5. Sep 27 '17 at 17:34

Notice that this is the same model as $$X_t - 10 = .5(X_{t-1} - 10) + Z_t .$$ $$10$$ is the mean, while $$5$$ was the intercept. This means we can add ten to the mean zero series.
In other words, if you define $$Y_t = X_t - 10$$, then $$Y_t = .5 Y_{t-1} + Z_t$$ and use arima.sim to simulate that. After you have $$\{Y_t\}$$, then add $$10$$ to each value.