Skip to content
Prev 43546 / 398506 Next

Robust nonlinear regression - sin(x)/x?

You didn't tell us what the error message nls gave, but it should 
be obvious:  You can estimate either a or b in this model (or their 
ratio), but you can't estimate both.  See any good book on nonlinear 
regression, e.g., Bates and Watts (1988) Nonlinear Regression and Its 
Applications (Wiley). 

      With that simplification, the equation is linear. 

      However, I see another problem:  If x is 0, sin(x)/x is "NaN".  
For a situation like this, I typically write a function to first compute 
"sin(x)/x", then test for x being 0 or very small, and replace the value 
in such cases with a more accurate Taylor series or asymptotic expansion. 

      hope this helps. 
      spencer graves
cstrato wrote: