Simple nonlinear least squares curve fitting in JMP
In his Walking Randomly blog, Mike Croucher shows how to fit a simple nonlinear curve using five different statistical programming libraries: R, MATLAB, Maple, Julia and Python/numpy. The idea is to provide concrete examples for a commonly asked modeling question that is simple to state but not so simple to solve.
For a the given data set of 10 x and y values, the problem is to find the best values for parameters p1 and p2 so that the following curve best fits the y values:
p1 cos( p2 x ) + p2 sin( p1 x )
Since nonlinear fitting involves an iterative search of the solution space, we need starting parameter values, which Croucher gives as
Normally, you would start with a data table and use the Nonlinear platform under the Analyze menu to interactively launch the fit. For a model like this, which isn't built-in to JMP, you could add it in a formula column and use that in the Nonlinear dialog. But like most everything in JMP, it can be completely driven by a JSL script if you want.