# How do I calculate the fitted values of an Arma model

I am studying the ARMA models, and I am breaking my head on something probably straightforward but that I can't see.

I generated in R a simple AR(1) model, and used the function ARIMA to estimate its coefficients. I get two coefficients, an AR(1) coefficient and an intercept.

Now I am trying to calculate myself the fitted values. On another post on StackExchange I found that I can find the fitted value Y(i) by doing

Y(i-1)*model$coef[1] + ((1-model$coef[1])*model\$coef[2])

Can somebody please explain why one has to multiply the intercept with 1 minus the AR(1) coefficient?