# I am getting error in arima function of R forecast package for both methods, CSS and ML

Given below are the errors, dataset and code snippet. What do I need to do to run the model?

For CSS the error is

Error in solve.default(res\$hessian * n.used) : Lapack routine dgesv: system is exactly singular: U[4,4] = 0 In addition: Warning message: In arima(ts4, order = c(1, 1, 1), seasonal = c(1, 1, 1), method = "CSS") : possible convergence problem: optim gave code = 1

For ML the error is

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

The data and code snippets are as below

mydata <- c(150.0, 178.0, 163.0, 172.0, 178.0, 199.0, 199.0, 184.0, 162.0, 146.0, 166.0, 171.0, 180.0, 193.0, 181.0, 183.0, 218.0, 230.0, 242.0, 209.0, 191.0, 172.0, 194.0, 196.0, 196.0, 236.0, 235.0, 229.0, 243.0, 264.0, 272.0, 237.0, 211.0, 180.0)

 >ts4 <- ts(mydata,start=1,frequency=12)

>fitModel4 <- arima(ts4, order = c(1, 1, 1), seasonal = c(1, 1, 1),method = "CSS")

>fitModel4 <- arima(ts4, order = c(1, 1, 1), seasonal = c(1, 1, 1),method = "ML")


Thanks

• I have noticed, if I use fitModel4 <- arima(ts4, order = c(1, 1, 1), seasonal = c(1, 1, 1),optim.method = "Nelder-Mead") the program runs. But I am not sure if that destroys the integrity of the code. – Biswajit Jana Aug 16 '18 at 22:03
• My above comment with Nelder Mead is wrong. I am having the same problem as in ML – Biswajit Jana Aug 16 '18 at 22:15
• You do not have enough data to fit that model. Use a simpler model. – Rob Hyndman Aug 16 '18 at 22:55
• Thanks. I provided 36 months worth of data. Is there a rule to calculate training data size? (I read your formula p+q+P+Q+d+mD+1 for which this model needs 1 + 1 + 1 + 1 + 1 + 1*12 + 1 = 18 observations as minimum requirement. But you also mentioned in the same document that truth is more complicated. Wondering what should be the right size for this model for R forecast package ) – Biswajit Jana Aug 16 '18 at 23:48
• It makes more sense to think about what model is appropriate for your data, than to think about what data you need for your model. – Rob Hyndman Aug 17 '18 at 0:47