Subscribe Bookmark RSS Feed

Script for Save Residuals data from Standard Least Squares fit model

rickeychen

New Contributor

Joined:

Oct 4, 2017

Hi,

 

I am trying to write a scirpt to save residuals data from "Standard Least Squares" fit model. So I do not have to use the save column option everytime. Could anyone help? Thanks in advance!

 

image.png

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution

I generated the 'Fit Model' code below by saving the script that JMP makes for you, and then added 'Residuals(1)':

NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Fit Model(
				Y( :height ),
				Effects( :weight ),
				Personality( "Standard Least Squares" ),
				Emphasis( "Effect Leverage" ),
				Run(
					:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
					Parameter Estimates( 1 ), Plot Actual by Predicted( 1 ),
					Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
					Plot Effect Leverage( 1 ), Box Cox Y Transformation( 0 )},
					Residuals( 1 )
				)
			);

 

2 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution

I generated the 'Fit Model' code below by saving the script that JMP makes for you, and then added 'Residuals(1)':

NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Fit Model(
				Y( :height ),
				Effects( :weight ),
				Personality( "Standard Least Squares" ),
				Emphasis( "Effect Leverage" ),
				Run(
					:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
					Parameter Estimates( 1 ), Plot Actual by Predicted( 1 ),
					Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
					Plot Effect Leverage( 1 ), Box Cox Y Transformation( 0 )},
					Residuals( 1 )
				)
			);

 

billw_jmp

Staff

Joined:

Jul 2, 2014

One other non-scripting option would be to go to Preferences > Platforms> Fit Least Squares and check the Residuals box.  The residuals will then pop up in a new column for every model you fit in the Least Squares.