<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extracting outputs after maximizing desirability functions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/762588#M94219</link>
    <description>&lt;P&gt;Here is an example of doing what you want.&amp;nbsp; The example creates a sample table. Then runs the Fit Model.&amp;nbsp; You will have to Maximize Desirability and then run the remainder of the code to get the new output table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1717592975085.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64900i1664E0B42218A337/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1717592975085.png" alt="txnelson_0-1717592975085.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = 
// Open Data Table: Tiretread.jmp
// → Data Table( "Tiretread" )
Open( "$SAMPLE_DATA/Tiretread.jmp" );
dtSub = dt &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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" )
);

// 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 Each( {profile}, fm,
	dtMax &amp;lt;&amp;lt; add rows( 1 );
	:By Group[N Rows( dtMax )] = Report( profile )[Outline Box( 1 )] &amp;lt;&amp;lt; get title;
	:Silica[N Rows( dtMax )] = Report( profile )["Prediction Profiler"][Number Edit Box( 1 )]
	 &amp;lt;&amp;lt; get;
	:Silane[N Rows( dtMax )] = Report( profile )["Prediction Profiler"][Number Edit Box( 2 )]
	 &amp;lt;&amp;lt; get;
	:Sulfer[N Rows( dtMax )] = Report( profile )["Prediction Profiler"][Number Edit Box( 3 )]
	 &amp;lt;&amp;lt; get;
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 05 Jun 2024 13:10:36 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2024-06-05T13:10:36Z</dc:date>
    <item>
      <title>Extracting outputs after maximizing desirability functions</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/762518#M94199</link>
      <description>&lt;P&gt;I am running regression models (JMP15) on a dataset "by-group" - i.e. generating 100+ regression models from the same data table. Then I maximize desirability for all these groups. I would like to extract the variable values corresponding to the "maximized desirability" for each of the 100+ models (the circled values in picture below). Any suggestions on how to do that (either JSL or using the GUI are okay)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WipulJ_0-1717196082378.png" style="width: 402px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64707iB15A7AB76A424954/image-size/large?v=v2&amp;amp;px=999" role="button" title="WipulJ_0-1717196082378.png" alt="WipulJ_0-1717196082378.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can do it in a tedious way (Ctrl-Prediction Profiler -&amp;gt; Factor Settings -&amp;gt; Remember Settings saves the settings for each case as "Remembered Settings", which I can then extract with Ctrl-Make Combined Data Table. However this requires me to hit "enter" 100+ times corresponding to each by-group!).&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 23:36:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/762518#M94199</guid>
      <dc:creator>WipulJ</dc:creator>
      <dc:date>2024-06-04T23:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting outputs after maximizing desirability functions</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/762588#M94219</link>
      <description>&lt;P&gt;Here is an example of doing what you want.&amp;nbsp; The example creates a sample table. Then runs the Fit Model.&amp;nbsp; You will have to Maximize Desirability and then run the remainder of the code to get the new output table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1717592975085.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64900i1664E0B42218A337/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1717592975085.png" alt="txnelson_0-1717592975085.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = 
// Open Data Table: Tiretread.jmp
// → Data Table( "Tiretread" )
Open( "$SAMPLE_DATA/Tiretread.jmp" );
dtSub = dt &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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" )
);

// 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 Each( {profile}, fm,
	dtMax &amp;lt;&amp;lt; add rows( 1 );
	:By Group[N Rows( dtMax )] = Report( profile )[Outline Box( 1 )] &amp;lt;&amp;lt; get title;
	:Silica[N Rows( dtMax )] = Report( profile )["Prediction Profiler"][Number Edit Box( 1 )]
	 &amp;lt;&amp;lt; get;
	:Silane[N Rows( dtMax )] = Report( profile )["Prediction Profiler"][Number Edit Box( 2 )]
	 &amp;lt;&amp;lt; get;
	:Sulfer[N Rows( dtMax )] = Report( profile )["Prediction Profiler"][Number Edit Box( 3 )]
	 &amp;lt;&amp;lt; get;
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Jun 2024 13:10:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/762588#M94219</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-06-05T13:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting outputs after maximizing desirability functions</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/764503#M94418</link>
      <description>&lt;P&gt;Hello Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the code. However it gives an error in the very last section (after the Fit Least Squares is done and after it creates the empty table "Desirability") as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WipulJ_0-1718148274099.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65096i66DACEBE0F3C344D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WipulJ_0-1718148274099.png" alt="WipulJ_0-1718148274099.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm running JMP15.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 23:26:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/764503#M94418</guid>
      <dc:creator>WipulJ</dc:creator>
      <dc:date>2024-06-11T23:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting outputs after maximizing desirability functions</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/764505#M94419</link>
      <description>&lt;P&gt;Also, how would I save the optimized responses (i.e. Abrasion, Modulus, Elong, Hardness) corresponding to the maximized desirabilities to the same table?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 23:30:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/764505#M94419</guid>
      <dc:creator>WipulJ</dc:creator>
      <dc:date>2024-06-11T23:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting outputs after maximizing desirability functions</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/764703#M94424</link>
      <description>&lt;P&gt;For Each() function was not introduced until JMP 16.&amp;nbsp; Hence the code needs to be changed to a For() loop methodology.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i=1,i&amp;lt;=nitems(fm), i++,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the JSL modified to use the For() function, and to also read in the optimized values for the response variables.&amp;nbsp; I tested the code in JMP 15&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = 
// Open Data Table: Tiretread.jmp
// → Data Table( "Tiretread" )
Open( "$SAMPLE_DATA/Tiretread.jmp" );
dtSub = dt &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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 &amp;lt;&amp;lt; {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&amp;lt;=nitems(fm), i++,
	dtMax &amp;lt;&amp;lt; add rows( 1 );
	:By Group[N Rows( dtMax )] = Report( fm[i] )[Outline Box( 1 )] &amp;lt;&amp;lt; get title;
	:Silica[N Rows( dtMax )] = Report( fm[i] )["Prediction Profiler"][Number Edit Box( 1 )]
	 &amp;lt;&amp;lt; get;
	:Silane[N Rows( dtMax )] = Report( fm[i] )["Prediction Profiler"][Number Edit Box( 2 )]
	 &amp;lt;&amp;lt; get;
	:Sulfer[N Rows( dtMax )] = Report( fm[i] )["Prediction Profiler"][Number Edit Box( 3 )]
	 &amp;lt;&amp;lt; get;
	:Optimized Abrasion[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(2)]
	&amp;lt;&amp;lt;get text);
	:Optimized Modulus[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(6)]
	&amp;lt;&amp;lt;get text);
	:Optimized Elong[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(10)]
	&amp;lt;&amp;lt;get text);
	:Optimized Hardness[N Rows( dtMax )] = Num(Report( fm[i] )["Prediction Profiler",TextBox(14)]
	&amp;lt;&amp;lt;get text);
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now comes your work.&amp;nbsp; You need to study the provided JSL and learn what it is doing.&amp;nbsp; Cutting and pasting code without understanding what it is doing is not a good practice.&amp;nbsp; 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.&amp;nbsp; When you run into understanding issues, please come back to the Discussion Community for help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 03:56:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-outputs-after-maximizing-desirability-functions/m-p/764703#M94424</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-06-12T03:56:23Z</dc:date>
    </item>
  </channel>
</rss>

