Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
deveshchugh
Level II

Fit spline methodology/calculation?

Hi All,

 Currently i manually analyse the data and generate splines (all done manually). I am trying to write a python code which can eventually run on the company server.

python's cubicspline function does not match the spline i normally generate in jmp (Analyze --> Fit Y vs X--> Flexible --> Fit spline --> Other --> Specify smoothness =0.1 check Standardize x (red)

When i am generating in Python (cubicsplines from scipy), i am getting more close to the red curve shown in the diagram. 

 

I could not find the lambda (or equivalent) parameter in python's cubic spline function, and neither to standardize the data. i did try to standardize

(x_i-Mean(x))/Std dev (x)) the data by my own, but the curves were getting more weird. 

 

Can some help point to what is the exact methodology/calculation used to generate these splines when we standardize the data. I have seen some post that point this is cubic splines, but i have not explanation how data is treated and spline generate when we use the standardized option. 

 

A little far fetched, and not sure if this is the right forum, does someone know the another alternate python function that can generate matched splines?

 

Thank you!

3 REPLIES 3
Highlighted

Re: Fit spline methodology/calculation?

I don't see how understanding JMP smoothers will help you with your problem with the Python library function.

 

The Scipy.org on-line documentation indicates that the optional bc_type argument in the scipy.interpolate.CubicSpline(x, y, axis=0, bc_type='not-a-knot', extrapolate=None) call is used to control the construction of the spline model. There is no argument corresponding to the JMP lambda argument that you can use to control the fit.

Learn it once, use it forever!
Highlighted
deveshchugh
Level II

Re: Fit spline methodology/calculation?

I was hoping, i could write a code to plot it using own code, rather than using Python library function. Is additional documentation available somewhere?

Thank you!

Highlighted

Re: Fit spline methodology/calculation?

There are many kinds of splines and each kind usually has more than one method or implementation. I suggest that you search the vast literature about spline models if you are going to write your own code. For example, this chapter from a high level computer science course at Clemson University provides an overview of splines used in computer graphics. You might also examine the open source code such as available in Python or R for spline models that you like to learn about how to write such code.

 

Please see these references if you want to implement your own version of the cubic spline interpolating functions in the Bivariate platform:

 

  • Reinsch, C. H. (1967). “Smoothing by Spline Functions.” Numerische Mathematik 10:177–183.
  • Eubank, R. L. (1999). Nonparametric Regression and Spline Smoothing. 2nd ed. Boca Raton, Florida: CRC.
Learn it once, use it forever!
Article Labels

    There are no labels assigned to this post.