<?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: Add predicted columns to the data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55960#M31433</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/70"&gt;@gzmorgan0&lt;/a&gt;&amp;nbsp;yes, I meant getting formulas from an already existing report. How can I write a more generalized script to achieve this? So, I have a fitted model in the Peanuts sample dataset. How can I add (using JSL) the prediction formula or studentized residuals to the existing Peanuts data table? I manually do: Save Columns--&amp;gt; for this.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Apr 2018 14:14:27 GMT</pubDate>
    <dc:creator>powerpuff</dc:creator>
    <dc:date>2018-04-27T14:14:27Z</dc:date>
    <item>
      <title>Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55591#M31413</link>
      <description>&lt;P&gt;I have a script in my JMP table named "Outlier Analysis". I open the script, hit the little red triangle and select Save Columns--&amp;gt; Prediction Formula. How can I script this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();
a = Eval( dt &amp;lt;&amp;lt; get table property( "Outlier Analysis" ) ); 
abc = a &amp;lt;&amp;lt; Report;
abc &amp;lt;&amp;lt; prediction formula;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 21:21:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55591#M31413</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-04-27T21:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55592#M31414</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10894"&gt;@powerpuff&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Look at the example below.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Boston Housing.jmp" );
obj = Partition(
	Y( :mvalue ),
	X(
		:crim,
		:zn,
		:indus,
		:chas,
		:nox,
		:rooms,
		:age,
		:distance,
		:radial
	),
	Method( "Boosted Tree" ),
	Validation Portion( .2 ),
	Go
);
obj &amp;lt;&amp;lt; Save Prediction Formula;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Apr 2018 21:03:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55592#M31414</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-04-26T21:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55593#M31415</link>
      <description>&lt;P&gt;I get it, but I already have the script ready. I dont want to add the Partition part again. For example,&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;a = Eval( dt &amp;lt;&amp;lt; get table property( "Outlier Analysis" ) ); 
abc = a &amp;lt;&amp;lt; Report;
dta = abc["Summary of Fit"][Table Box( 1 )] &amp;lt;&amp;lt; Make Combined data table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This script helped me open up the Summary of Fit table from the "Outlier Analysis" script. Is there any way I can add Prediction Formula that way?&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6696"&gt;@uday_guntupalli&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 21:21:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55593#M31415</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-04-27T21:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55595#M31417</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10894"&gt;@powerpuff&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I am not sure I followed what ou said however based on what I understand, here :&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a Fit Model analysis, that you do, you can capture the formula directly into the table this way. You dont need to extract the formula separately.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Drug.jmp" );
FM = dt &amp;lt;&amp;lt; Fit Model(
	Y( :y ),
	Effects( :Drug, :x ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
	Run(
		:y &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Show Prediction Expression( 1 ),
		Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ),
		Plot Effect Leverage( 0 )}
	)
);


FM &amp;lt;&amp;lt; Get Prediction Formula; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Check your log and the formula is printed. When you mean get the formula that way, I presume you want to access it from the report. If that is what you are after, you can add as shown above - Show Prediction Expression(1) to your Fit Model and then access the expression&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 21:24:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55595#M31417</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-04-26T21:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55598#M31419</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6696"&gt;@uday_guntupalli&lt;/a&gt;&amp;nbsp;but I have a fit group with a lot of fit models. Plus, I don't want to limit doing this to only one script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 22:01:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55598#M31419</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-04-26T22:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55604#M31424</link>
      <description>&lt;P&gt;See the Scripting Guide and search for&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Scripting-Only Messages and Arguments by Platform&lt;/STRONG&gt;&lt;/EM&gt;. The messages and options are different by model.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Standard Least Squares&lt;/STRONG&gt;&lt;BR /&gt;The following JSL messages return the requested item from the fitted model, such as variance components, p-values, parameter estimates, and so on:&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Variance Components( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Effect Names( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Effect PValues( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Estimates( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Parameter Names( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Random Effect Names( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Std Errors( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get X Matrix( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get XPX Inverse( );&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fit_model_object &amp;lt;&amp;lt; Get Y Matrix( );&lt;BR /&gt;The following message for Standard Least Squares objects is available only in JSL:&lt;BR /&gt;&amp;nbsp; &amp;nbsp;obj &amp;lt;&amp;lt; Get SQL prediction expression;&lt;/P&gt;&lt;P&gt;___________________________________________________________________________________&lt;/P&gt;&lt;P&gt;For the last example,&amp;nbsp; xx = FM &amp;lt;&amp;lt; get prediction Formula; show(xx);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Log&lt;/P&gt;&lt;P&gt;xx = New Column("y", Numeric, Formula((-2.69577290612704) + Match(:Drug, "a", -1.18503653738055, "d", -1.07606520517145, "f", 2.261101742552, .) + 0.987183811129848 * :x), Set Property("Predicting", {:y, Creator("Fit Least Squares")}));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you asking how to write a script to get the formulas from an already created window with a fitted report?&amp;nbsp; If yes, let's see if I can emulate that situation: Help&amp;gt; Scripting Index&amp;gt;Objects&amp;gt;Fit Model &amp;gt; Least Squares then run the sample script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;obj the reference to the Least Squares Fit is only recognized within that script.&amp;nbsp; To be able to get the formula you needto get a handle to the model object. There might be another method, but here is my method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- prompt for the window or use window name to create a handle to the report&lt;/P&gt;&lt;P&gt;&amp;nbsp;- get its child and the first OutlIne Box&lt;/P&gt;&lt;P&gt;- get the scriptable Object&lt;/P&gt;&lt;P&gt;- get the formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your script has multiple models, I recommend you use Xpath to get all instances.&amp;nbsp; The attached script gets the formulas from the Scripting Index script. The report has 2 responses (2 models) and creates an associative array of formulas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure this is what you were asking for.&amp;nbsp; &amp;nbsp;By the way, once you have a handle(reference) to the scrtiptable object you can send it messages to save the formulas to the table. One of the nice features of Xpath, and get scriptable object,&amp;nbsp; it might find 20 models, but you can send the message once and it is applied to each of the models.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this isn't your question, please clarify.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 04:16:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55604#M31424</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-04-27T04:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55960#M31433</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/70"&gt;@gzmorgan0&lt;/a&gt;&amp;nbsp;yes, I meant getting formulas from an already existing report. How can I write a more generalized script to achieve this? So, I have a fitted model in the Peanuts sample dataset. How can I add (using JSL) the prediction formula or studentized residuals to the existing Peanuts data table? I manually do: Save Columns--&amp;gt; for this.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 14:14:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55960#M31433</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-04-27T14:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55962#M31434</link>
      <description>&lt;P&gt;I am sorry, but I realized it was the easiest.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just two lines of code have saved my formula&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = Eval( dt &amp;lt;&amp;lt; get table property( "Outlier Analysis" ) ); 
a &amp;lt;&amp;lt; save prediction formula;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you for the help and I am so sorry for the confusion. I only added "save" which I somehow missed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 21:22:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55962#M31434</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-04-27T21:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55974#M31436</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/10894"&gt;@powerpuff&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp;Which is what I kept referring you to . Glad it finally worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 14:31:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/55974#M31436</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-04-27T14:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/56017#M31437</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6696"&gt;@uday_guntupalli&lt;/a&gt;&amp;nbsp;yep, thanks for the help!!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 15:33:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/56017#M31437</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-04-27T15:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add predicted columns to the data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/56191#M31540</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/70"&gt;@gzmorgan0&lt;/a&gt;&amp;nbsp;One more question, I have already fitted scripts that have Fit groups, not fit models. How can I add studentized residuals for them to the data table?&amp;nbsp;My approach: try adding all fit models in the fit group to a list and pass that list to add residuals. The script does not work for now, but is this the correct way ahead? Also, if possible can you point me out to where I am going wrong in this script?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
ft = dt &amp;lt;&amp;lt; Run Script( "Outlier Analysis" );
ftList = Substitute( ftList, Expr( FitGroup() ), Expr( {} ) );
Print( Head( ftList ) );
//For(i=1, i&amp;lt;=NItems(ftList),i++,
//ftList[i] &amp;lt;&amp;lt; Studentized Residuals;
//);
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 15:09:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-predicted-columns-to-the-data-table/m-p/56191#M31540</guid>
      <dc:creator>powerpuff</dc:creator>
      <dc:date>2018-05-02T15:09:16Z</dc:date>
    </item>
  </channel>
</rss>

