# auto.arima warns NaNs produced on std error

My data is a time series of employed population, L, and the time span, year.

n.auto=auto.arima(log(L),xreg=year)
summary(n.auto)
Series: log(L)
ARIMA(2,0,2) with non-zero mean

Coefficients:
ar1      ar2      ma1     ma2  intercept    year
1.9122  -0.9567  -0.3082  0.0254    -3.5904  0.0074
s.e.     NaN      NaN      NaN     NaN     1.6058  0.0008

sigma^2 estimated as 1.503e-06:  log likelihood=107.55
AIC=-201.1   AICc=-192.49   BIC=-193.79

In-sample error measures:
ME          RMSE           MAE           MPE          MAPE
-7.285102e-06  1.225907e-03  9.234378e-04 -6.836173e-05  8.277295e-03
MASE
1.142899e-01
Warning message:
In sqrt(diag(x$var.coef)) : NaNs produced  why does this happen? Why would auto.arima selects the best model with std error of these ar* ma* coefficients Not a Number? Is this selected model valid after all? My goal is to estimate the parameter n in the model L=L_0*exp(n*year). Any suggestion of a better approach? TIA. data: L <- structure(c(64749, 65491, 66152, 66808, 67455, 68065, 68950, 69820, 70637, 71394, 72085, 72797, 73280, 73736, 74264, 74647, 74978, 75321, 75564, 75828, 76105), .Tsp = c(1990, 2010, 1), class = "ts") year <- structure(1990:2010, .Tsp = c(1990, 2010, 1), class = "ts") L Time Series: Start = 1990 End = 2010 Frequency = 1 [1] 64749 65491 66152 66808 67455 68065 68950 69820 70637 71394 72085 72797 [13] 73280 73736 74264 74647 74978 75321 75564 75828 76105  • Can you post some data so we can replicate the problem? – Rob Hyndman Apr 24 '12 at 6:56 • @RobHyndman updated data – Ivy Lee Apr 24 '12 at 9:14 • Please type dput(L) and paste the output. This makes replication very easy. – Zach Apr 24 '12 at 23:20 ## 3 Answers The sum of the AR coefficients is close to 1 which shows that the parameters are near the edge of the stationarity region. That will cause difficulties in trying to compute the standard errors. However, there is nothing wrong with the estimates, so if all you need is the value of$L_0\$, you've got it.

auto.arima() takes a few short-cuts to try to speed up the computation, and when it gives a model that looks suspect, it is a good idea to turn those short-cuts off and see what you get. In this case:

> n.auto <- auto.arima(log(L),xreg=year,stepwise=FALSE,approx=FALSE)
>
> n.auto
Series: log(L)
ARIMA(2,0,0) with non-zero mean

Coefficients:
ar1      ar2  intercept    year
1.8544  -0.9061    11.0776  0.0081
s.e.  0.0721   0.0714     0.0102  0.0008

sigma^2 estimated as 1.594e-06:  log likelihood=107.19
AIC=-204.38   AICc=-200.38   BIC=-199.15


This model is a little better (a smaller AIC for example).

• what if standard errors cannot be computed and the model needs to be used for forecasting? Will that cause invalid, unrealistically small confidence intervals in a forecast? In my case (a time-series of length 35), using approximation=FALSE and stepwise=FALSE still produces NaNs for SEs of coefficiets. – Mihael Jan 12 '17 at 9:12

Your problem arises from an over-specification . A simple first difference model with an AR(1) is quite sufficient. No MA structure or power transform is required. You could also simply model this as a second difference model since the ar(1) coefficient is close to 1.0. A plot of the Actual/fit/forecast is and a residual plot with equation ! enter image description here .In summary Estimation is subject to Model Specification which in this case is found wanting ["mene mene tekel upharsin"]. Seriously, I suggest that you familiarize yourself with model identification strategies and not try to kitchen-sink your models with unwarranted structure. Sometimes less is more ! Parsimony is an objective !. Hope this helps ! To further answer your questions "Why would auto.arima selects the best model with std error of these ar* ma* coefficients Not a Number? The probable answer is that the state-space solution isn't all that it might be because of the assumptive models that it tries. But that's just my guess . The true cause of the failure might be your assumption of a log xform. Transformations are like drugs ..... some are good for you and some are not good for you. Power transformations shuld ONLY be use to decouple the expected value from the standard deviation of the residuals. If there is linkage then a Box-Cox transform ( which includes logs ) might then be appropriate. Pulling a transform from behind your ears may not be a good idea.

Is this selected model valid after all? Definitely not !

I've faced with similar issues. Please, try to play with optim.control and optim.method. These NaNs are sqrt of negative values of diagonal elements of Hesse matrix. Fitting of ARIMA(2,0,2) is nonlinear problem and optim seemed to converged to a saddle point (where gradient is zero, but Hesse matrix is not positive-defined) instead of likelihood maximum.