cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Understanding cubic splines

A cubic spline is a smooth, continuous function that represents the relationship between two numeric variables. It consists of a series of third-order polynomials fit together in a piecewise fashion, under the condition that the function is continuous and differentiable at the knots, or connection points.

JMP offers spline fits in the Fit Y by X platform. For example, using the Fitness.jmp sample data table, I can fit a cubic spline for the Oxy column by the RunPulse column.

 

Spline Fit of Oxy by RunPulseSpline Fit of Oxy by RunPulse

You can get the coefficients of the polynomial functions by clicking the inverted red arrow hot-spot for “Smoothing Spline Fit” and selecting “Save Coefficients”. A new data table is generated containing an X column that gives the “RunPulse” values (in this case) that are taken as the knots where the individual cubic polynomial functions are connected. The remaining columns in the data table are the coefficients for each cubic spline: “A” is the intercept term, “B” is the coefficient for the linear term, “C” is the coefficient for the quadratic term, and “D” is the term for the cubic term for the variable (X-O) where O is the value of the knot at the beginning of the interval:

 

Equation2.JPG

 

To better understand the concept of the spline fit, I updated the coefficients table to include “Oxy” values using the "Tables->Update" option:

Updating the Coefficients tableUpdating the Coefficients tableThen I recreated the spline fit using the coefficients, extending the polynomials beyond the knot points:

 

All cubic polynomial functions used to fit the splineAll cubic polynomial functions used to fit the spline

The points and dashed vertical lines show the knot points, and the individual polynomial curves are represented by different colors. Finally, you can see the spline fit itself when the polynomials are truncated at the knots:

Truncated cubic polynomial functions defining the splineTruncated cubic polynomial functions defining the splineHere, you can see each segment of the final cubic spline, and how they are connected together. Hopefully, this explanation will take any mystery out of cubic splines and help to understand this smoothing fit.

Last Modified: May 23, 2017 3:23 PM
Comments
triunk
Level I

I see the option of cubic splines is available in JMP at graph builder when you test the moderating effect of a categorical variable on the effect of a categorical variable to the outcome which happens to be... you guessed it...also categorical variable. Does this make sense? Is that possible? 

PatrickGiuliano
Staff

@triunk  You can "trick" JMP by specifying your modeling type as numeric (even when it's character) and in some cases this would work for you depending on your analytic situation (generally not recommended).  You are right in that the option still shows up in the area underneath the "Smoother" in JMP in the situation you are describing, however, JMP will not evaluate the formula for the spline fit because the data for your variables are non-numeric. Here's an example I generated: 

PatrickGiuliano_1-1654135636802.png

 

PatrickGiuliano_0-1654135575914.png

 

 

PatrickGiuliano
Staff

I wanted to add a little bit of clarification to this post to help clear up any potential confusion for how to evaluate the formula for the spline fit in this case. From the blog post above, 

PatrickGiuliano_0-1654135714948.png

the value of "O" is the value of X at X = Xi-1 for every observation except for the first observation, where "O" is the value of X (causing the B, C and D terms to effectively zero out).  To illustrate this, the following shows how the formula can be evaluated in JMP using column formulas in the context of a simple example: 

PatrickGiuliano_3-1654136080947.png

 

PatrickGiuliano_4-1654136134085.png

 

Hope this helps!