Subscribe Bookmark RSS Feed

Automate saving of prediction formula using JMP script?

dozyme

Community Trekker

Joined:

Jul 8, 2011

Greetings all,

Hoping that someone with more JMP script-writing experience can offer some suggestions here.  What I'd like to do is fit a simple linear regression using the "Fit Model" option, then save the prediction formula for the subsequent model to my current data table automatically through the script.  I've been able to do the first part (fit the model), but the second part is proving difficult to figure out. 

Any advice would be much appreciated. I'm more familiar with programming in R or STATA, so it's been a process getting used to JSL.  Actually, if there are any recommendations for good JSL references (other than the JMP scripting guide, which I find incredibly lacking), that would also be fantastic.

Dan

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Dan

Does this solve your problem? It saves the predicted values in a column with a formula attached.

linfit=Fit Model(

      Y( :Yvar ),

      Effects( :Xvar ),

      Personality( Standard Least Squares ),

      Run model

);

linfit<<prediction formula;

BR, Marianne

7 REPLIES
Solution

Hi Dan

Does this solve your problem? It saves the predicted values in a column with a formula attached.

linfit=Fit Model(

      Y( :Yvar ),

      Effects( :Xvar ),

      Personality( Standard Least Squares ),

      Run model

);

linfit<<prediction formula;

BR, Marianne

dozyme

Community Trekker

Joined:

Jul 8, 2011

Fantastic - thanks much!

D

pmroz

Super User

Joined:

Jun 23, 2011

Any advice would be much appreciated. I'm more familiar with programming in R or STATA, so it's been a process getting used to JSL.  Actually, if there are any recommendations for good JSL references (other than the JMP scripting guide, which I find incredibly lacking), that would also be fantastic.

This forum is a great place to learn about JSL.  It's not an easy language but it's pretty addicting once you get the hang of it.

The JMPer Cable newsletters have some good JSL examples.  JMP | JMP Newsletters

The scripting index in JMP 10 has been beefed up considerably with a ton of example code (Help > Scripting Index).

Also I would recommend going to the JMP conference held in September - great value for the money.

mredford

Occasional Contributor

Joined:

Jan 23, 2017

How would this be modified if a flexible spline fit was to be used

txnelson

Super User

Joined:

Jun 22, 2012

It is the same method as the previous response

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );
FM=Fit Model(
	Y( :NPN1 ),
	Effects( :PNP1 & Knotted( 5 ) ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
	Run(
		:NPN1 << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Lack of Fit( 0 ), Plot Actual by Predicted( 0 ),
		Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )}
	),
	SendToReport(
		Dispatch( {"Response NPN1"}, "Effect Details", OutlineBox, {Close( 0 )} )
	)
);
fm << prediction formula;
Jim
astep_

Community Trekker

Joined:

Jun 10, 2013

Hi everybody,

I am looking for to save predicted values of a fit model(Stepwise). Do you can help myself ?

txnelson

Super User

Joined:

Jun 22, 2012

Here is a sample script for automation of a Stepwise regression

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );
fm = Fit Model(
	Y( :NPN1 ),
	Effects(
		:PNP1,
		:PNP2,
		:NPN2,
		:PNP3,
		:IVP1,
		:PNP4,
		:NPN3,
		:IVP2,
		:NPN4,
		:SIT1,
		:INM1,
		:INM2,
		:VPM1,
		:VPM2,
		:VPM3,
		:PMS1,
		:SNM1,
		:SPM1,
		:NPN5,
		:EP2,
		:ZD6,
		:PBA,
		:PLG,
		:CAP
	),
	Personality( "Stepwise" ),
	Run
);
fm << Finish;
nfm = fm << run model;
nfm << prediction formula;
Jim