cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
gianpaolo
Level IV

JSL FIT MODEL Two-Factor Response Surface

Good morning

i would like implement for my JSL a FIT MODEL with "Two-Factor Response Surface Model",

but i havent found ny specific JSL command to do that.

 

someone can help me

 

here the code i implemented.. but is incomplete for the FIT MODEL section....

 

 

Clear Globals();
Clear Log();
Names Default To Here( 1 );
 
// code to choose among all opened tables which one will be selected for the analysis
OpenDT = List();
For( i = 1, i <= N Table(), i++,
	Insert Into( OpenDT, Data Table( i ) )
);
 
dlgDT = Dialog(
	"Please select Data Table for analysis",
	VList( selectDT = List Box( OpenDT ) ),
	HList( Button( "OK" ), Button( "Cancel" ) )
);

Show( dlgDT );

If( dlgDT["button"] == 1,
	Remove From( dlgDT, N Items( dlgDT ) );
	Eval List( dlgDT );
 
);
 
Current Data Table( selectDT[1] );

cd = Column Dialog(

	Var = collist( " select Response >>", MinCol( 1 ), MaxCol( 1 ) ),
	Hlist( "" ), 
 
	Ref = Collist( " Select Predictors >>", MinCol( 1 ) ),
	Hlist( "" ), 
 
	Hlist( "" ),
	mypareto = Check Box( " Show results's Pareto ", 1 ),
	Hlist( "Number of recursive trees -> ", forest = EditNumber( 10 ) ), 
 
	Vlist(
		mypareto = Check Box( " Show results's Pareto ", 1 ),
		Hlist( "" ),
		Hlist( "" ),
		Hlist( "select top predictors ", myrank = EditNumber( 5 ) ), 
 
	), 
 
);
//);

//declaration of global variables
Response = cd["Var"]; //(Response Variable) ok
Predictor = cd["Ref"]; //(Predictor Variable) ok
Fsize = cd["forest"]; // number of tree to run
pareto = cd["mypareto"];
rank = cd["myrank"];

risultato = New Table( "Tree Table",
	Add Rows( 0 ),
	New Column( "Y", Character, "Nominal" ),
	New Column( "Term", Character, "Nominal", Set Property( "ID Column", 1 ) ),
	New Column( "Number of Splits", Numeric, "Continuous" ),
	New Column( "SS", Numeric, "Continuous" ),
	New Column( "SS 2", Character, "Nominal" ),
	New Column( "Portion", Numeric, "Continuous" ),

);

tree = Expr(
	partitioning = Partition(
		Y( Response( 1 ) ),
		X( Eval( Predictor ) ),
		Split History( 1 ),
		Informative Missing( 1 ),
		Validation Portion( 0.33 ),
		Minimun Size Split( 5 ),
		Column Contributions( 1 ), 
 
		Go
	);
 
	part = Report( partitioning )["Column Contributions"][Table Box( 1 )] <<
	Make Combined Data Table;
	part << select where( :Number of Splits == 0 );
	part << delete rows;
	partitioning << close window();
	part << set name( "Parts" );
 
	risultato = Data Table( risultato ) << Concatenate(
		Data Table( part ),
		Append to first table
	);
	Close( part, "no save" );
 
);
 
For( i = 1, i <= Fsize, i++,
	Current Data Table( selectDT[1] );
 
	tree;
);
 
If( Pareto == 1,
	Current Data Table( risultato );
	Pareto Plot(
 
		Cause( :Term ), 

	);
);
 
//create Ranking Table
 
Summary_Rank = Data Table( risultato ) << Summary(
 
	Group( :Term ),
	output table name( "Bootstrap Ranking" ), 
 
);
 
Data Table( Summary_Rank ) << Sort(
 
	By( :N Rows ),
	Order( Descending ),
	replace Table, 

);
 
x = N Rows( Summary_Rank );
 
Data Table( Summary_Rank ) << New Column( "Rank", numeric, , formula( Sequence( 1, x, 1 ) ) );
 
Data Table( Summary_Rank ) << select where( :Rank <= rank );
Column( 1 ) << set selected( 1 );
 
tempDt = Summary_Rank << Subset( columns( :Term ) );
Column( 1 ) << set selected( 1 );
 
predictor = Column( 1 ) << get values();
Close( tempDt, "no save" );
 
// declaration VarExpr variable
varExpr = {};
 
//------------------------------------------------FIT MODEL Two Factore Response Surface -------------------//
// parse word '& RS' into predictors variablee
For( i = 1, i <= N Items( predictor ), i++,
	Insert Into( varExpr, Parse( ":Name(\!"" || predictor[i] || "\!")" || Char( "& RS" ) ) )
);
 
Current Data Table( selectDT[1] );

FIT_MODEL = Fit Model(
	Y( Response( 1 ) ),
	Effects(
		(Eval( varExpr )), 
 
	),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ), 
 
	Run( Profiler( 1, Confidence Intervals( 1 ), Arrange in Rows( 6 ), ), Show VIF( 1 ) )
);
 
FIT_MODEL;

 

 

 

Gianpaolo Polsinelli
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL FIT MODEL Two-Factor Response Surface

I think what you are asking for is resolved using this example below:

predictor = {"X1","X2","X3","X4"};
varExpr = {};
// parse word '& RS' into predictors variablee
For( i = 1, i <= N Items( predictor ), i++,
	Insert Into( varExpr, Parse( ":Name(\!"" || predictor[i] || "\!")" || Char( "& RS" ) ) )
);


For( i = 1, i <= N Items( predictor ), i++,
	For( k = i, k <= N Items( predictor ), k++,
 		Insert Into( varExpr, Parse( ":Name(\!"" || predictor[i] || "\!")" || Char( " * " ) || ":Name(\!"" || predictor[k] || "\!")" ) )
))
Jim

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: JSL FIT MODEL Two-Factor Response Surface

You can find a good example of a two factor response surface model in the "Fitting Linear Models" book:

     Help==>Books==>Fitting Linear Models

Once you have generated your model interactively, from the red triangle in the output display, you can request to "Save Script".  It will provide you with the JSL you need to run your analysis.

Jim
gianpaolo
Level IV

Re: JSL FIT MODEL Two-Factor Response Surface

Thank yu Jim for your answer,

it seems there is not a quick method to have the on  Effects the Response Surface conditions: (like below example) 

 

X1 RS
X2 RS
X3 RS
X4 RS
X1*X1
X1*X2
X1*X3
X1*X4
X2*X2
X2*X3
X2*X4
X3*X3
X3*X4
X4*X4

 

by my script i was able to create X1 RS,X2 RS, X3 RS, X4 RS,

but now i need to create by separate script  the multiplication factors ......

Gianpaolo Polsinelli

Re: JSL FIT MODEL Two-Factor Response Surface

The best scripter writer for JMP is JMP itself. As Jim stated, build your model interactively and then use the red triangle to save the script. It shows you how it needs to appear in your JSL script:

Fit Model(
Y( :Y ),
Effects(
:X1 & RS,
:X2 & RS,
:X3 & RS,
:X4 & RS,
:X1 * :X1,
:X1 * :X2,
:X2 * :X2,
:X1 * :X3,
:X2 * :X3,
:X3 * :X3,
:X1 * :X4,
:X2 * :X4,
:X3 * :X4,
:X4 * :X4
),
Personality( "Standard Least Squares" )
);

Dan Obermiller
txnelson
Super User

Re: JSL FIT MODEL Two-Factor Response Surface

I think what you are asking for is resolved using this example below:

predictor = {"X1","X2","X3","X4"};
varExpr = {};
// parse word '& RS' into predictors variablee
For( i = 1, i <= N Items( predictor ), i++,
	Insert Into( varExpr, Parse( ":Name(\!"" || predictor[i] || "\!")" || Char( "& RS" ) ) )
);


For( i = 1, i <= N Items( predictor ), i++,
	For( k = i, k <= N Items( predictor ), k++,
 		Insert Into( varExpr, Parse( ":Name(\!"" || predictor[i] || "\!")" || Char( " * " ) || ":Name(\!"" || predictor[k] || "\!")" ) )
))
Jim
gianpaolo
Level IV

Re: JSL FIT MODEL Two-Factor Response Surface

just GREAT!!!, thanks Jim
Gianpaolo Polsinelli