title: Approximating a curve with arctan
body: <p>I have a set of data points which look a lot like some version of arctan(x).</p>
  
  <pre><code>xs &lt;- seq(1000,50000,by=1000)
  
  data &lt;- c(0.101, 0.169, 0.209, 0.256, 0.289, 0.373, 0.391, 0.418, 0.477, 0.528, 0.579, 0.570, 0.602, 0.657, 0.690, 0.720, 0.747, 0.764, 0.781, 0.811, 0.842, 0.847, 0.864, 0.889, 0.871, 0.894, 0.897, 0.915, 0.926, 0.931, 0.932, 0.940, 0.950, 0.963, 0.956, 0.967, 0.967, 0.963, 0.971, 0.980, 0.986, 0.988, 0.986, 0.985, 0.993, 0.992, 0.994, 0.991, 0.995, 0.993)
  
  plot(xs,data)
  </code></pre>
  
  <p>After fiddling around a little in sage I came up with the curve <code>y = 2*atan(xs/1000)/pi</code></p>
  
  <p>However the 1000 here is only a guess.</p>
  
  <p>The approximation turns out to be reasonable</p>
  
  <pre><code>model &lt;- lm(data ~ I(2*atan(xs/10000)/pi))
  
  points(xs,model$fitted.values, pch=20)
  </code></pre>
  
  <p>My question is, how can I get R to "guess" the value a in the curve <code>y = 2*atan(x/a)/pi</code> ?</p>
  
  <p>Thanks!</p>