How to fix degeneracy of the Nelder–Mead simplex in r [closed]

I have a huge dataset with over 4000 companies and I have estimated a liquidity measure for these each 4000 companies. But liquidity is highly persistent and exihibits auto-correlation. In order to mitigate this autocorrelation problem each of the liquidity measure estimated for the company has to be trasformed by AR(2) process i.e. residuals of autoregressive model are used instead of actual values. But when I estiamate the AR(2) with following code in r

AR<- data.frame(dfAR1, apply(dfAR1, 2, function(x) arima(x, order = c(2,0,0),optim.method="Nelder-Mead")\$res))


 arima(x, order = c(2, 0, 0), optim.method = "Nelder-Mead") :
possible convergence problem: optim gave code = 10


When I looked up in the manual it says: "10 indicates degeneracy of the Nelder–Mead simplex" I don't understand how bad this warning is for my estimations and how can I fix it. I would really appreciate your help in this regard.

• When this algorithm fails, could you try another algorithm? The optim function in R offers seven of them, and arima seems to be using optim. – Richard Hardy Mar 18 '16 at 10:07
• @RichardHardy thank you for your suggestion. The thing is I do get the residuals i.e. AR(2) does run. But I receive this warning. I will run it with other optim. – Aquarius Mar 18 '16 at 10:11