In the Forecasting: principles and practice book they claim that:
R ensures the fitted model is both stationary and invertible
I checked and indeed - for example the following model fits, even though the data are not stationary and I should have differenced:
library(fpp2)
fit2 <- arima(taylor, order=c(1,0,1),
include.mean = TRUE, transform.pars=FALSE)
1/forecast:::arroots(fit2)$roots
autoplot(fit2)
and the AR inverse root is 0.9813966+0i, which is a bad sign according to the text.
but HOW do they do it? When I try fitting the same model with python's statsmodels it fails. What's the technique used for ensuring stationarity and invertibility?
Note that transform.pars=FALSE so it's not that.
using the reciprocals of the roots inside the unit circle and rescaling the polynomial to have a constant term of 1? can you be more specific about what to do and why will it always work – ihadanny Nov 02 '19 at 21:18coeff <- Re(p[-1] / p[1]). This multiplies the polynomial $p_0+p_1t + \cdots + p_kt^k$ by $1/p_0$ and drops the constant term (which, since it's $1$ by construction, doesn't need to be carried around). The reason for taking the real part viaReis only to coerce the data type of the coefficients to double-precision numbers; they will already be real numbers. – whuber Nov 02 '19 at 22:07