cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
Jakob
Level II

JSL Code for Replace with Transform

Hi All

 

I looking for the JSL code to get the "Fit Model" platform to Box Cox transform data automatically by using the "Replace with Transform" or "Refit with Transform" 

 

Jakob_0-1757489275324.png

 

Thanks for all your help 

 

Regards

Jakob

3 REPLIES 3

Re: JSL Code for Replace with Transform

Hi @Jakob 

 

Had to slightly alter the example from the Scripting Index, but this should work (just need the 'Refit' line in to prompt it to run):

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Tiretread.jmp" );
obj = dt << Fit Model(
	Y( :ABRASION ),
	Effects( :SILICA, :SILANE, :SULFUR ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
	Run
);
Wait( 1 );
obj << Box Cox Y Transformation(
	1,
	Refit with Transform( 1 )
);

Thanks,
Ben

 

“All models are wrong, but some are useful”
Jakob
Level II

Re: JSL Code for Replace with Transform

Hi Ben

Thanks for your help,

I have tried to use the solution, but I get a different results in my exported columns when using manual approach and the scripted version:

Can the reason be that I call the first fit model window ?
Regards

Jakob

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Tiretread.jmp" );
obj = dt << Fit Model(
	Y( :ABRASION ),
	Effects(  :MODULUS, :ELONG, :HARDNESS, :SILICA, :SILANE, :SULFUR ),
	Personality( "Standard Least Squares" ),
					Emphasis( "Effect Screening" ),
					Run(
						<<{Summary of Fit( 0 ), Analysis of Variance( 0 ), Parameter Estimates( 0 ), Effect Tests( 0 ), Effect Details( 0 ),
						Lack of Fit( 0 ), Expanded  Estimates( 0 ), Sorted Estimates( 0 ), Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
						Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 1 ), Plot Effect Leverage( 0 ),
						Plot Residual by Normal Quantiles( 0 ), Show All Confidence Intervals( 0 ), Show Sqrt Variance Component( 1 ),
						Box Cox Y Transformation( 1 ), Scaled Estimates( 0 ), Profiler( 0 )},
						FDR( 0 ),
						),
						SendToReport(
		Dispatch( {}, "Box-Cox Transformations", OutlineBox, {Close( 0 )} )
	)
);
		obj << Predicted Values;
		obj << Std Error of Individual;
		

Wait( 1 );
obj << Box Cox Y Transformation(1,Refit with Transform(1));
Wait( 3 );
		obj << Predicted Values;
		obj << Std Error of Individual;
	

 

Re: JSL Code for Replace with Transform

Hi @Jakob, what lambda value do you use when running manually? that might be where the difference is. Change the value on 'Refit with Transform (1)' to whatever lambda value is used. i.e., 

obj << Box Cox Y Transformation(1,Refit with Transform(0.95));
“All models are wrong, but some are useful”

Recommended Articles