<?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: Need Help to automate stepwise model selection! in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/611658#M81193</link>
    <description>&lt;P&gt;The following page is useful to understand how to handle expressions.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.jmp.com/t5/JSL-Cookbook-Archived/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/ta-p/48998" target="_blank" rel="noopener"&gt;https://community.jmp.com/t5/JSL-Cookbook-Archived/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/ta-p/48998&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For stepwize regression, here is an example;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( response_col ), i++,
	Eval(
		Parse(
			Eval Insert(
				"\[step_wise = Fit Model(
	                               Y( ^response_col[i]^  ),
	                                          Effects( ^effects_term^ ),
	                                          Personality( Stepwise ),
	                                          Run Model(
			                                           Stopping Rule( "P-value Threshold" ),
			                                           Prob to Enter( 0.05 ),
			                                           Prob to Leave( 0.25 ),
	                                           ),
	                                           Run
                                         );
                            ]\"
			)
		)
	);
	step_wise &amp;lt;&amp;lt; Finish;
	Wait( 0 );
	fit_model = step_wise &amp;lt;&amp;lt; Run model;
	step_wise &amp;lt;&amp;lt; close window();

);//end of loop&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please see attached file for full script.&lt;/P&gt;
&lt;P&gt;(I found a mistake and edited the script. 19 Apr 2023)&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2023 01:17:41 GMT</pubDate>
    <dc:creator>yuichi_katsumur</dc:creator>
    <dc:date>2023-04-19T01:17:41Z</dc:date>
    <item>
      <title>Need Help to automate stepwise model selection!</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/610389#M81118</link>
      <description>&lt;P&gt;Hi JMP experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help to revise my code to automate stepwise model selection with p value threshold. This attached JSL can run stepwise automatically based on assigned effects and response. I need to add more functions to make my work more efficient.&lt;/P&gt;&lt;P&gt;1. I want to this script can generate interaction and quadratic automatically based on predictors (it's better to have it, but not necessary)&lt;/P&gt;&lt;P&gt;2. The script needs to generate model for each response in the response_col list.&lt;/P&gt;&lt;P&gt;3. After Run model, I want this response report has the following plots or tables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;{Summary of Fit( 1 ), Analysis of Variance( 1 ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Parameter Estimates( 1 ), Effect Tests( 0 ), Effect Details( 0 ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Lack of Fit( 0 ), Scaled Estimates( 0 ), Plot Actual by Predicted( 1 ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Plot Regression( 0 ), Plot Residual by Predicted( 0 ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Plot Studentized Residuals( 1 ), Plot Effect Leverage( 0 ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Plot Residual by Normal Quantiles( 1 ), Box Cox Y Transformation( 0 ),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Press( 1 )}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;4. I want to save this report into JMP table with an assigned name such as stepwise_&lt;FONT color="#0000FF"&gt;response.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;5. Save all those plots and table into separate graphs under an assigned folder, so that I don't need to copy the model results one by one into PowerPoint&amp;nbsp;or word document.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:30:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/610389#M81118</guid>
      <dc:creator>lazzybug</dc:creator>
      <dc:date>2023-06-08T16:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help to automate stepwise model selection!</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/611658#M81193</link>
      <description>&lt;P&gt;The following page is useful to understand how to handle expressions.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.jmp.com/t5/JSL-Cookbook-Archived/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/ta-p/48998" target="_blank" rel="noopener"&gt;https://community.jmp.com/t5/JSL-Cookbook-Archived/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/ta-p/48998&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For stepwize regression, here is an example;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( response_col ), i++,
	Eval(
		Parse(
			Eval Insert(
				"\[step_wise = Fit Model(
	                               Y( ^response_col[i]^  ),
	                                          Effects( ^effects_term^ ),
	                                          Personality( Stepwise ),
	                                          Run Model(
			                                           Stopping Rule( "P-value Threshold" ),
			                                           Prob to Enter( 0.05 ),
			                                           Prob to Leave( 0.25 ),
	                                           ),
	                                           Run
                                         );
                            ]\"
			)
		)
	);
	step_wise &amp;lt;&amp;lt; Finish;
	Wait( 0 );
	fit_model = step_wise &amp;lt;&amp;lt; Run model;
	step_wise &amp;lt;&amp;lt; close window();

);//end of loop&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please see attached file for full script.&lt;/P&gt;
&lt;P&gt;(I found a mistake and edited the script. 19 Apr 2023)&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 01:17:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/611658#M81193</guid>
      <dc:creator>yuichi_katsumur</dc:creator>
      <dc:date>2023-04-19T01:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help to automate stepwise model selection!</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/623627#M82246</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/1654"&gt;@yuichi_katsumur&lt;/a&gt;&amp;nbsp; &amp;nbsp;Thank you so much for your previous help about JSL stepwise. It worked well, the stepwise only has one P-value threshold, but this example below has two Stepwise method, one is P-value threshold, the other one is Minimum BIC. When I used your code to save the model it has two models, I have to use code to delete last script every time after saving models. Is there any way to remove minimum BIC in the graph below?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The direction for stepwise I used is "Mixed", but the graph below only shows "Forward", so what's actual direction used in the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;can you help take a look as well?&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="lazzybug_0-1681845373661.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/52066iB7B30F3C9C5C7C20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lazzybug_0-1681845373661.png" alt="lazzybug_0-1681845373661.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sdt = Open("$SAMPLE_DATA/Boston Housing.jmp");&lt;BR /&gt;response_col = {" :mvalue", ":crim"};&lt;BR /&gt;effects_term = {:zn, :indus, :chas, :nox, :rooms, :age, :distance, :radial, :tax, :pt, :b,&lt;BR /&gt;:lstat};&lt;BR /&gt;var1= 0.05;&lt;BR /&gt;var2 = 0.25;&lt;/P&gt;&lt;P&gt;For( i = 1, i &amp;lt;= N Items( response_col ), i++,&lt;BR /&gt;Eval(&lt;BR /&gt;Parse(&lt;BR /&gt;Eval Insert(&lt;BR /&gt;"\[step_wise = Fit Model(&lt;BR /&gt;Y( ^response_col[i]^ ),&lt;BR /&gt;Effects( ^effects_term^ ),&lt;BR /&gt;Personality( Stepwise ),&lt;BR /&gt;Run Model(&lt;BR /&gt;Stopping Rule( "P-value Threshold" ),&lt;BR /&gt;Prob to Enter( ^var1^ ),&lt;BR /&gt;Prob to Leave( ^var2^ );&lt;BR /&gt;Direction ("Mixed");&lt;BR /&gt;Rules("Combine");&lt;BR /&gt;),&lt;BR /&gt;Run&lt;BR /&gt;);&lt;BR /&gt;]\"&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;);&lt;BR /&gt;step_wise &amp;lt;&amp;lt; Finish;&lt;BR /&gt;Wait( 0 );&lt;BR /&gt;fit_model = step_wise &amp;lt;&amp;lt; Run model;&lt;BR /&gt;/* step_wise &amp;lt;&amp;lt; close window();*/&lt;BR /&gt;);&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 19:19:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/623627#M82246</guid>
      <dc:creator>lazzybug</dc:creator>
      <dc:date>2023-04-18T19:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help to automate stepwise model selection!</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/623678#M82253</link>
      <description>&lt;P&gt;I just noticed that the direction is forward only. How can we change it to "mixed" in the code above?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 23:29:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/623678#M82253</guid>
      <dc:creator>lazzybug</dc:creator>
      <dc:date>2023-04-18T23:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help to automate stepwise model selection!</title>
      <link>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/623688#M82256</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/40915"&gt;@lazzybug&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I'm sorry, I found an error in my script. Please replace ; with ,.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Previous script
Prob to Leave( ^var2^ );
Direction ("Mixed");
Rules("Combine");

// Correct one
Prob to Leave( ^var2^ ),
Direction ("Mixed"),
Rules("Combine"),&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Apr 2023 01:22:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-Help-to-automate-stepwise-model-selection/m-p/623688#M82256</guid>
      <dc:creator>yuichi_katsumur</dc:creator>
      <dc:date>2023-04-19T01:22:13Z</dc:date>
    </item>
  </channel>
</rss>

