8
$\begingroup$

I'm using the arima method of stats package of R with my time series of 17376 elements. My goal is to get the value of the AIC criterion, I 've observed in my first test this:

 ts <- arima(serie[,1], order = c(2,1,1), seasonal = list(order=c(2,0,1),period = 24), 
         method = "CSS", optim.method = "BFGS",)
> ts$coef
           ar1        ar2        ma1       sar1       sar2       sma1 
     0.8883730 -0.0906352 -0.9697230  1.2047580 -0.2154847 -0.7744656 
    > ts$aic
[1] NA

As you can see, AIC is not defined. About AIC, "Help" in R said that it could only be used with "ML". However, it happens:

> ts <- arima(serie[,1], order = c(2,1,1), seasonal = list(order=c(2,0,1),period = 24), 
          method = "ML", optim.method = "BFGS",)

Error en optim(init[mask], armafn, method = optim.method, hessian = TRUE,  : 
  non-finite finite-difference value [1]

Plus: warning messages lost
In log(s2) : There have been NaNs

I don't understand what is happening. Also I would like to know more about the parameter "fitting method".

$\endgroup$
3
  • 1
    $\begingroup$ Can you include the graphical representation of your data? $\endgroup$
    – mpiktas
    Feb 4 '14 at 6:50
  • 3
    $\begingroup$ Extracting the parameters from the CSS solution and passing them as starting values to the ML solver (via the optim.control argument) would stand a good chance of avoiding this problem. I haven't tested this because you do not supply a reproducible example of the difficulty. $\endgroup$
    – whuber
    Feb 4 '14 at 15:23
  • $\begingroup$ @whuber this is right direction. In some econometrics books it is said that take first from CSS solution parameter values as initial values for the full ML objective function. $\endgroup$
    – Analyst
    Feb 6 '14 at 6:31
3
$\begingroup$

Fitting the ARIMA model with Maximum Likelihood (method = "ML") requires optimising (minimising) the ARIMA model negative log-likelihood over the parameters. This turns out to be a constrained optimisation problem as the parameters must result in a stationary model. This nonlinear constraint is accounted for with the negative log-likelihood returning Inf (infinity) if the the constraint is not satisfied. If the MLE is near the boundary of the constraint evaluation of the negative log-likelihood near the MLE could return infinity. As the hessian is obtained with numerical differentiation by evaluating the negative log-likelihood near the MLE this can result in the non-finite finite difference error you obtained. So if the hessian is not required put hessian = FALSE. Otherwise, this error depends on the MLE solution so an alternative optimisation algorithm (Nelder-Mead) might return an MLE sufficiently far from the boundary of the constrain that the error is avoided.

$\endgroup$
2
$\begingroup$

Edited: if you down-vote this can you please explain why? I'm new here.

I'm had the same problem. I looked around online and found a solution suggested elsewhere on Cross Validated. I figured I'd share here in case anyone wanted it.

I just added a "method="CSS"" to my model and it worked. For example:

model = Arima(x, order=c(1,1,1), seasonal=list(order=c(1,1,1), period=12), xreg=xreg, 
              method="CSS") 

Here's the reference:
auto.arima and Arima (forecast package)

$\endgroup$
3
  • $\begingroup$ I see now your answer and maybe for your data It works , but for my data no,my main target was know Why the error of my question happened and why the method ML it does not work in my case or in other $\endgroup$ Jul 28 '15 at 13:52
  • 4
    $\begingroup$ I see this solves the problem but how you are going to use AIC values to compare different models e.g. ARIMA(1,1,2) unless you use ML or CSS-ML method? "The theory of AIC requires that the log-likelihood has been maximized: whereas AIC can be computed for models not fitted by maximum likelihood, their AIC values should not be compared". stat.ethz.ch/R-manual/R-devel/library/stats/html/AIC.html The OP require AIC value. $\endgroup$ Mar 4 '17 at 6:42
  • $\begingroup$ Thanks @Mumbo.Jumbo I hadn't thought of that. Good catch. $\endgroup$ Feb 13 at 16:39
0
$\begingroup$

You seem to have problem with algorithms convergence. This happens sometimes with numerical optimization.

Here is link to wikipedia article on this particular optimization method:

http://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%93Goldfarb%E2%80%93Shanno_algorithm

$\endgroup$
3
  • 3
    $\begingroup$ yes, I know this sometimes happens but why it works with fitting method with css and with ml no, and why css doesn't make AIC $\endgroup$ Feb 4 '14 at 14:29
  • 1
    $\begingroup$ @GuillermoAyranTorresLores CSS is based on conditional likelihood and does not produce same likelihood value which unconditional likelihood function produces when it is optimized for the same parameters. $\endgroup$
    – Analyst
    Feb 6 '14 at 6:29
  • 1
    $\begingroup$ @GuillermoAyranTorresLores try changing you optimization problem in a way that first take parameter values from the CSS solution as a initial values for the full ML objective function. $\endgroup$
    – Analyst
    Feb 6 '14 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.