<?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 Use model script in DOE table but change responses in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435668#M68488</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 10 different DOE tables and each has the DOE&amp;nbsp; model script. I want to script to use the existing model script in each table and run it with different response column (or replacing the :Y in the model script).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;say one of the DOE table is dt and there are added 2 columns into the same table which will be the new responses (Y) for study: col1 and col2. These responses are not in the model script.&lt;/P&gt;&lt;P&gt;How can I modify the below section in script so it will take the input column and run the existing model script to it? is it possible? or I will have to manually go into each DOE table and modify the "Model" script with the 2 responses from col1 and col2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;model = dt &amp;lt;&amp;lt; Get Property("Model");&lt;/P&gt;&lt;P&gt;Insert Into(model,Expr(Run));&lt;/P&gt;&lt;P&gt;Eval(model);&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:40:22 GMT</pubDate>
    <dc:creator>dadawasozo</dc:creator>
    <dc:date>2023-06-10T23:40:22Z</dc:date>
    <item>
      <title>Use model script in DOE table but change responses</title>
      <link>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435668#M68488</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 10 different DOE tables and each has the DOE&amp;nbsp; model script. I want to script to use the existing model script in each table and run it with different response column (or replacing the :Y in the model script).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;say one of the DOE table is dt and there are added 2 columns into the same table which will be the new responses (Y) for study: col1 and col2. These responses are not in the model script.&lt;/P&gt;&lt;P&gt;How can I modify the below section in script so it will take the input column and run the existing model script to it? is it possible? or I will have to manually go into each DOE table and modify the "Model" script with the 2 responses from col1 and col2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;model = dt &amp;lt;&amp;lt; Get Property("Model");&lt;/P&gt;&lt;P&gt;Insert Into(model,Expr(Run));&lt;/P&gt;&lt;P&gt;Eval(model);&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:40:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435668#M68488</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2023-06-10T23:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Use model script in DOE table but change responses</title>
      <link>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435863#M68496</link>
      <description>&lt;P&gt;Please find one way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

// Example table with saved DOE script
dt = Open("$SAMPLE_DATA/Design Experiment/Custom RSM.jmp");

// Make a new response column with different (random) values
Eval(Column(dt, "Y") &amp;lt;&amp;lt; getScript);
Column(dt, "Y 2") &amp;lt;&amp;lt; setName("New Y");
Column(dt, "New Y") &amp;lt;&amp;lt; setFormula(RandomNormal(0,1));

// Use the saved script with the new response column . . .
modelScript = dt &amp;lt;&amp;lt; getScript("Model");									// Get the saved script
RemoveFrom(modelScript, 1);												// Remove the current response definition
InsertInto(modelScript, Expr(Y(:New Y)));								// Add the updated response definition
InsertInto(modelScript, Expr(Run));										// Add the 'Run' directive
modelScript;															// Run the modified script&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Not sure why, but 'SubstituteInto()' had some issues).&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 11:19:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435863#M68496</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-11-12T11:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Use model script in DOE table but change responses</title>
      <link>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435929#M68506</link>
      <description>&lt;P&gt;Hi Ian,&lt;/P&gt;
&lt;P&gt;the line below actually remove everything (all Effects) in the DOE "model" script .&lt;/P&gt;
&lt;P&gt;RemoveFrom (modelscript, 1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is example the Model created when I design a DOE. Any way, to remove and replace the :Y with script?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Fit Model(
    Effects(
        :A, :B, :A * :B, 
    ), 
    Y( :Y )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 17:39:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435929#M68506</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2021-11-12T17:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Use model script in DOE table but change responses</title>
      <link>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435985#M68513</link>
      <description>&lt;P&gt;Hi Ian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got it. Just look into the "Model " in the Custom RSM.jmp that you showed here. the Y(:Y) is at the first argument under Fit model. while the Model in my DOE table is second (or last in this case) argument. I think using RemoveFrom (modelscript, 1), will remove the first argument in my "Model", which is Effect. I changed the 1 to -1 and it is working now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help, now I can enable a loop through all the different DOE tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 17:22:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/435985#M68513</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2021-11-12T17:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use model script in DOE table but change responses</title>
      <link>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/436370#M68559</link>
      <description>&lt;P&gt;Take a look at 'RemoveFrom()' using 'Help &amp;gt; Scripting Index'. If I understand correctly, you could also use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

modelScript = Expr(Fit Model(Effects(:A, :B, :A * :B, ), Y( :Y )));
RemoveFrom(modelScript, 2);												// Remove the current response definition
InsertInto(modelScript, Expr(Y(:New Y)));								// Add the updated response definition
InsertInto(modelScript, Expr(Run));										// Add the 'Run' directive
Print(modelScript);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 11:32:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-model-script-in-DOE-table-but-change-responses/m-p/436370#M68559</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-11-15T11:32:23Z</dc:date>
    </item>
  </channel>
</rss>

