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