<?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: How can I parse effects to &amp;quot;Fit Model&amp;quot; in a script? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/50798#M28872</link>
    <description>&lt;P&gt;I think you might need to use JSL expressions for this. Below is an example similar to yours using the Boston Housing sample data table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myparameters = {"crim*zn", "zn", "indus", "nox", "rooms", "age", "distance"};

sdt = Open("$SAMPLE_DATA/Boston Housing.jmp");

EffectsExpr = Expr(Effects());

For (ii = 1, ii &amp;lt;= NItems(myparameters), ii++,
	colname = myparameters[ii];
	position = contains(colname,"*");
	If (position &amp;gt; 0,
		col = ":"||left(colname,position)||" :"||right(colname,length(colname)-position),
		col = ":"||colname
	);
	/*col = Column(sdt, colname);*/
	InsertInto(EffectsExpr, parse(col))
);

fmExpr = substitute(
	Expr(Fit Model(
	 Y( :chas ),
	 _effects_,
	 Personality( "Nominal Logistic" ),
	 Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confusion Matrix( 1 ) )
	)),
	expr(_effects_),
	nameexpr(EffectsExpr)
);

eval(fmExpr)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Feb 2018 16:15:11 GMT</pubDate>
    <dc:creator>michael_jmp</dc:creator>
    <dc:date>2018-02-06T16:15:11Z</dc:date>
    <item>
      <title>How can I parse effects to "Fit Model" in a script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/50778#M28858</link>
      <description>&lt;P&gt;I am trying to pars effects to a fit model in a script.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The effects are generated by a script using several runs of stepwise selection using nominal logistic regression. The selected variable names are outputted to a JMP datafile "final selection.jmp".&lt;/P&gt;
&lt;P&gt;This is no problem if only main effects are selected, but I have not been successful in including a two factor interaction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For main effects only I used the following script:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Basedata=concat( projectpath, "final selection.jmp");
dt = OPEN(basedata);
myparameters = :Parameter &amp;lt;&amp;lt; Get Values();
close(dt,nosave);

sdt = Open(concat(projectpath, "all data.jmp"));
UseEffects = {};
For (ii = 1, ii &amp;lt;= NItems(myparameters), ii++,
   colname = myparameters[ii];
   col = Column(sdt, colname);
   InsertInto(UseEffects, col)
  );
Fit Model(
 Y( :Y ),
 Effects( Eval(UseEffects)),
 Personality( "Nominal Logistic" ),
 Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confusion Matrix( 1 ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the same script if an interaction is selected results in an error message "could not find column ..."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then tried the following script to generate an array with effects:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For (ii = 1, ii &amp;lt;= NItems(myparameters), ii++,
   colname = myparameters[ii];
   position = contains(colname,"*");
   If (position &amp;gt; 0,
   col = ":"||left(colname,position)||" :"||right(colname,length(colname)-position),
   col = ":"||colname);
   /*col = Column(sdt, colname);*/
   InsertInto(UseEffects, col)
  );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the effect names in UseEffects look ok, this also fails and gives again a "Column not found ... " error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any solution is welcome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 22:51:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/50778#M28858</guid>
      <dc:creator>frits_quadt</dc:creator>
      <dc:date>2018-02-06T22:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse effects to "Fit Model" in a script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/50798#M28872</link>
      <description>&lt;P&gt;I think you might need to use JSL expressions for this. Below is an example similar to yours using the Boston Housing sample data table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myparameters = {"crim*zn", "zn", "indus", "nox", "rooms", "age", "distance"};

sdt = Open("$SAMPLE_DATA/Boston Housing.jmp");

EffectsExpr = Expr(Effects());

For (ii = 1, ii &amp;lt;= NItems(myparameters), ii++,
	colname = myparameters[ii];
	position = contains(colname,"*");
	If (position &amp;gt; 0,
		col = ":"||left(colname,position)||" :"||right(colname,length(colname)-position),
		col = ":"||colname
	);
	/*col = Column(sdt, colname);*/
	InsertInto(EffectsExpr, parse(col))
);

fmExpr = substitute(
	Expr(Fit Model(
	 Y( :chas ),
	 _effects_,
	 Personality( "Nominal Logistic" ),
	 Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confusion Matrix( 1 ) )
	)),
	expr(_effects_),
	nameexpr(EffectsExpr)
);

eval(fmExpr)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 16:15:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/50798#M28872</guid>
      <dc:creator>michael_jmp</dc:creator>
      <dc:date>2018-02-06T16:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse effects to "Fit Model" in a script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/51294#M29085</link>
      <description>&lt;P&gt;Thank you, I have used the solution you described and it did solve my problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 13:15:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/51294#M29085</guid>
      <dc:creator>frits_quadt</dc:creator>
      <dc:date>2018-02-14T13:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse effects to "Fit Model" in a script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/622775#M82180</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4971"&gt;@michael_jmp&lt;/a&gt;&amp;nbsp;Do you know if we can get the effect list from DoE model? Because the effect list was saved in the model when we design the DoE, we don't have to manual generate effect list as mentioned here. For example, how to get the list of Y, and Effects from the model script below? Thank you so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fit Model(Y(:Y1, :Y2, :Y3, :Y4, :Y5, :Y6, :Y7, :Y8, :Y9, :Y10, :Y11, :Y12, :Y13, :Y14, :Y15), Effects(:X1 &amp;amp; RS, :X2 &amp;amp; RS, :X3 &amp;amp; RS, :X4 &amp;amp; RS, :X5 &amp;amp; RS, :X1 * :X1, :X1 * :X2, :X2 * :X2, :X1 * :X3, :X2 * :X3, :X3 * :X3, :X1 * :X4, :X2 * :X4, :X3 * :X4, :X4 * :X4, :X1 * :X5, :X2 * :X5, :X3 * :X5, :X4 * :X5, :X5 * :X5, :Block, :X6, :X7), Personality(\!"Standard Least Squares\!"))&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2023 16:51:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/622775#M82180</guid>
      <dc:creator>lazzybug</dc:creator>
      <dc:date>2023-04-15T16:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse effects to "Fit Model" in a script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/622780#M82181</link>
      <description>&lt;P&gt;There are at least two options, parsing that function as a string or expression. Below is one option how you could parse it as expression using Arg()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

f = Expr(Fit Model(
	Y(:Y1, :Y2, :Y3, :Y4, :Y5, :Y6, :Y7, :Y8, :Y9, :Y10, :Y11, :Y12, :Y13, :Y14, :Y15),
	Effects(
		:X1 &amp;amp; RS, :X2 &amp;amp; RS, :X3 &amp;amp; RS, :X4 &amp;amp; RS, :X5 &amp;amp; RS, :X1 * :X1, :X1 * :X2, :X2 * :X2, :X1 * :X3,
		:X2 * :X3, :X3 * :X3, :X1 * :X4, :X2 * :X4, :X3 * :X4, :X4 * :X4, :X1 * :X5, :X2 * :X5, :X3 * :X5,
		:X4 * :X5, :X5 * :X5, :Block, :X6, :X7
	),
	Personality("Standard Least Squares")
));

first_arg = Arg(f, 1);
second_arg = Arg(f, 2);
ys = Substitute(Arg(f, 1), Expr(Y), Expr(List()));
show(first_arg); // first_arg = Y(:Y1, :Y2, :Y3, :Y4, :Y5, :Y6, :Y7, :Y8, :Y9, :Y10, :Y11, :Y12, :Y13, :Y14, :Y15);
show(second_arg);
show(ys); // ys = {:Y1, :Y2, :Y3, :Y4, :Y5, :Y6, :Y7, :Y8, :Y9, :Y10, :Y11, :Y12, :Y13, :Y14, :Y15};
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you could also use Extract Expr()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Extract Expr(f, Y(Wild List()));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Apr 2023 18:20:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/622780#M82181</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-04-15T18:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I parse effects to "Fit Model" in a script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/623623#M82244</link>
      <description>&lt;P&gt;Thank you so much for your help&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;. I figured it out by myself, but your method is much simpler.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 18:59:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-parse-effects-to-quot-Fit-Model-quot-in-a-script/m-p/623623#M82244</guid>
      <dc:creator>lazzybug</dc:creator>
      <dc:date>2023-04-18T18:59:18Z</dc:date>
    </item>
  </channel>
</rss>

