For Each() function was not introduced until JMP 16. Hence the code needs to be changed to a For() loop methodology.
For( i=1,i<=nitems(fm), i++,
Here is the JSL modified to use the For() function, and to also read in the optimized values for the response variables. I tested the code in JMP 15
Names Default To Here( 1 );
dt =
// Open Data Table: Tiretread.jmp
// → Data Table( "Tiretread" )
Open( "$SAMPLE_DATA/Tiretread.jmp" );
dtSub = dt << subset( selected columns( 0 ), selected rows( 0 ), output table( "Subset" ) );
For Each Row(
:Abrasion = :Abrasion + :Abrasion*random normal(0,1);
:MODULUS = :MODULUS + :MODULUS*random normal(0,1);
:ELONG = :ELONG + :ELONG * random normal(0,1);
:HARDNESS = :HARDNESS + :HARDNESS* random normal(0,1);
);
dt << Concatenate(
dtSub,
Output Table( "Concat of Tiretread, Subset" ),
Append to first table,
Create source column
);
Close( dtSub, nosave );
// Run the Model
fm = Fit Model(
Y( :ABRASION, :MODULUS, :ELONG, :HARDNESS ),
By( :Source Table ),
Effects( :SILICA, :SILANE, :SULFUR ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:ABRASION << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )},
:MODULUS << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )},
:ELONG << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )},
:HARDNESS << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ),
Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )},
Profiler(
1,
Confidence Intervals( 1 ),
Desirability Functions( 1 )
)
)
);
// Stop the JSL
stop();
// Set the Maximize Desirability and the run the code below
// Create an output table
dtMax = New Table( "Desirability",
New Column( "By Group", character ),
New Column( "Silica" ),
New Column( "Silane" ),
New Column( "Sulfer" ),
New Column( "Optimized Abrasion"),
New Column( "Optimized Modulus"),
New Column( "Optimized Elong"),
New Column( "Optimized Hardness")
);
// Populate the table getting the Desirability values from the chart
// In this example, the 2 by groups are actually just a replicate of the same
// data, so the output values will be the same.
For( i=1,i<=nitems(fm), i++,
dtMax << add rows( 1 );
:By Group[N Rows( dtMax )] = Report( fm[i] )[Outline Box( 1 )] << get title;
:Silica[N Rows( dtMax )] = Report( fm[i] )["Prediction Profiler"][Number Edit Box( 1 )]
<< get;
:Silane[N Rows( dtMax )] = Report( fm[i] )["Prediction Profiler"][Number Edit Box( 2 )]
<< get;
:Sulfer[N Rows( dtMax )] = Report( fm[i] )["Prediction Profiler"][Number Edit Box( 3 )]
<< get;
:Optimized Abrasion[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(2)]
<<get text);
:Optimized Modulus[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(6)]
<<get text);
:Optimized Elong[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(10)]
<<get text);
:Optimized Hardness[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(14)]
<<get text);
);
Now comes your work. You need to study the provided JSL and learn what it is doing. Cutting and pasting code without understanding what it is doing is not a good practice. Please take the time to learn about the functions used, and also about Display Tree output and how to interpret and use the values from the output displays. When you run into understanding issues, please come back to the Discussion Community for help.
Jim