title: gls with ARMA terms: not working for one combination of terms
body: <p>I am using the gls function from nlme to fit models with various ARMA terms.
  I would like to compare multiple different models to see which of the ARMA terms provides the best model.</p>
  <p>My general model is as follows:</p>
  <p><code>fit &lt;- gls(y  ~ x, data = na.omit(data), method = &quot;ML&quot;, correlation = corARMA(p = 2, q = 3))</code></p>
  <p>My y and x variables are percentages.</p>
  <p>For every model with a combination of ARMA terms from p = 1 through p = 3 and q = 1 through q =3 work fine, however, when I fit the model specified above (ARMA(2,3)) I get the following error message.</p>
  <p><code>&quot;Error in `coef&lt;-.corARMA`(`*tmp*`, value = value[parMap[, i]]) :  NA/NaN/Inf in foreign function call (arg 1)&quot;</code></p>
  <p>If I rerun the model specifyig <code>method = &quot;REML&quot;</code> it works ok, but i want to compare models using log-likelihood raio tests so I will need to stick with <code>method = &quot;ML&quot;</code> .</p>
  <p>Any idea what could be causing this?</p>
  <p>Here is a <code>dput</code> output of a few lines of data:</p>
  <pre><code>structure(list(date2 = structure(c(12234, 12265, 12296, 12357, 
  12509), class = &quot;Date&quot;), min = c(12, 114, 480, 818, 42), fai = c(0.632, 
  0.707, 3.397, 7.107, 2.011), total_time = c(1237L, 3337L, 4776L, 
  9385L, 3665L), min_stand = c(0.00970088924818108, 0.0341624213365298, 
  0.100502512562814, 0.0871603622802344, 0.0114597544338336), total_feed = c(6234L, 
  7120L, 5592L, 6252L, 2020L), perc_feed = c(0.192492781520693, 
  1.60112359550562, 8.58369098712446, 13.0838131797825, 2.07920792079208
  ), kcal = c(99.688648314, 923.280754221, 4671.223064892, 6851.385488668, 
  408.732018202), kcal_tot = c(26428.225231694, 47032.415227701, 
  20824.864136682, 44505.409085806, 16408.141649702), kcal_perc = c(0.377205232057916, 
  1.96307323311181, 22.4309893895724, 15.3945006447612, 2.49103175074932
  ), month = c(1L, 2L, 3L, 5L, 10L)), row.names = c(1L, 2L, 3L, 
  5L, 10L), class = &quot;data.frame&quot;)
  </code></pre>
  <p>My &quot;y&quot; variable is &quot;perc_kcal&quot; and my &quot;x&quot; is &quot;fai&quot;.</p>
  <p>Thank you</p>
  <p>PS. If I do the same modeling procedure using a different response variable (&quot;min_stand&quot;) the model fails to converge only with the same p=2 and q=3 terms.</p>
  <pre><code>Error in gls(model = min_stand ~ fai, data = na.omit(df_cum_kam), method = &quot;ML&quot;,  : 
    function evaluation limit reached without convergence (9)
  </code></pre>