cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
John_G
Level II

How to see equation used for spline?

So I'm using the XY fit to generate a spline to fit a curve. See simple example attached. How do I get to the equations JMP's used to generate the curve please?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: How to see equation used for spline?

8 REPLIES 8

Re: How to see equation used for spline?

I believe that Bivariate and Graph Builder will fit spline models but neither one will save the model where you can see or use it outside of the platform. The Fit Least Squares platform can fit, profile, and save spline models. They work differently. (There are different kinds of spline models.) Select Analyze > Fit Model and select your response and predictor that you used in Bivariate. Select the predictor in the Effects list, click the red triangle next to Attributes, and select Spline Effect. Click Run and the select Save Columns > Prediction Formula.

 

Note that Fit Model will ask you to specify the number of knots instead of specifying the stiffness parameter Lambda as in Bivariate.

John_G
Level II

Re: How to see equation used for spline?

Thanks for the quick reply Mark. Can't quite see how to generate the spline curve that I could in Fit XY. 

I can find the Fit Model dialogue you mention. I've put Y as a Role Variable, X as a Construct Model Effect. I can see an option to update the Degree (which default is '2'). I've left Personality as 'Standard Least Squares', Emphasis as 'Effect Leverage', and kept Weight, Freq, Validation, By all blank. 

When I select "Knotted Spline Effect" in Attributes, nothing happens to ask me about number of knots.

I've saved the scripts for the spline and the fit to the attached data table. 

The output seems to just fit a straight line. 

What am I missing?

Cheers

John

John_G
Level II

Re: How to see equation used for spline?

Ahhh! If you click on X so it's selected as a Construct Model Effect and THEN click on attributes and choose Knotted Spline Effect, then the option to choose number of knots appears. Will keep digging, but that need to selectd the effect first wasn't clear to this newbie...

Re: How to see equation used for spline?

Yes, that changes the modeling of the effect of your X. Let me know if you have any more questions.

shaira
Level IV

Re: How to see equation used for spline?

Hi Mark,

 

Nice explanation. Do you know if there's a way to replicate the Bivariate Fit Spline (lambda = 1000) to Fit Model platform? Can we get the number of knots from Bivariate plot and input it to the Fit Model platform?

 

Thanks!

 

Shaira

Re: How to see equation used for spline?

You unfortunately cannot specify lambda when using the Fit Least Squares platform. You can specify the number of knots, though. Please see the following script for an example.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

fls = dt << Fit Model(
	Y( :weight ),
	Effects( :height & Knotted( 5 ) ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
	Run(
		:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ),
		Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ),
		Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
	),
	SendToReport(
		Dispatch(
			{"Response weight"},
			"Parameter Estimates",
			OutlineBox,
			{Close( 0 )}
		)
	)
);

fls << Prediction Formula;

Re: How to see equation used for spline?

You can specify lambda when using the spline fit in Graph Builder and save the formula.

 

Curious: why do you want to the formula?

Craige_Hales
Super User

Re: How to see equation used for spline?

Also see @Duane_Hayes'  article Understanding cubic splines

 

Craige