title: Modifying a curve to prevent singular gradient matrix at initial parameter estimates
body: <p>I want to use <code>y=a^(b^x)</code> to fit the data below,</p>
  
  <pre><code>y &lt;- c(1.0385, 1.0195, 1.0176, 1.0100, 1.0090, 1.0079, 1.0068, 1.0099, 1.0038)
  x &lt;- c(3,4,5,6,7,8,9,10,11)
  data &lt;- data.frame(x,y)
  </code></pre>
  
  <p>When I use the non-linear least squares procedure,</p>
  
  <pre><code>f &lt;- function(x,a,b) {a^(b^x)}
  (m &lt;- nls(y ~ f(x,a,b), data = data, start = c(a=1, b=0.5)))
  </code></pre>
  
  <p>it produces an error: <em>singular gradient matrix at initial parameter estimates.</em> The result is roughly a = 1.1466, b = 0.6415, so there shouldn't be a problem with intial parameter estimates as I have defined them as a=1, b=0.5. </p>
  
  <p>I have read in other topics that it is convenient to modify the curve. I was thinking about something like <code>log y=log a *(b^x)</code>, but I don't know how to deal with function specification. Any idea?</p>