<?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: JSL Script - Grab Prediction Formula Result in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43243#M25034</link>
    <description>&lt;P&gt;thanks Ian&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sorry, my scripting knowledge is too restricted, your help is not accelerating me, can you please get me some more support.&lt;/P&gt;&lt;P&gt;First I work with JMP not with PRO. I assume that is the reason that my JMP automated PLS script looks different to yours. I attached my script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plenty of questions appear reading your script.&lt;/P&gt;&lt;P&gt;Why do you separte between PLSLAUNCH and PLSFITS. Is that necessary or just for your comfort in reading/documenting?&lt;/P&gt;&lt;P&gt;Is it necessary to assign PLSFITS the fits if I just have one "fits" eg. just 7 Factors&amp;nbsp; (&lt;FONT face="Consolas" size="2"&gt;plsFits &amp;lt;&amp;lt; (&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Fit&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;] &amp;lt;&amp;lt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;savePredictionFormula&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;plsFits &amp;lt;&amp;lt; (&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Fit&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;] &amp;lt;&amp;lt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;saveYresiduals&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt; I assume that means: Save the residual of Fit[1] to the object PLSFITS (and this name&amp;nbsp;can be chosen by me, it is just PLSFITS for better identification)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run your script&amp;nbsp;I get this error in the logwindow:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plsFits &amp;lt;&amp;lt; (Fit[/*###*/1] &amp;lt;&amp;lt; savePredictionFormula); Is that because of PRO Terminology?&lt;FONT face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Many thanks &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Peter&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Aug 2017 08:34:28 GMT</pubDate>
    <dc:creator>peter_michel</dc:creator>
    <dc:date>2017-08-15T08:34:28Z</dc:date>
    <item>
      <title>JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39601#M23154</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to obtain the predicted value after setting the X's in a prediction formula.&lt;/P&gt;&lt;P&gt;For example, if Y = X1 + X2, I want to create a new row,&amp;nbsp;set X1 = 2 and X2 = 4 and&amp;nbsp;grab the predicted value of&amp;nbsp;Y = 6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought the easiest way to do this would be to save the prediction formula into a new set of columns.&lt;/P&gt;&lt;P&gt;I would then add a new row and set all the X's.&lt;/P&gt;&lt;P&gt;Then, simply access the row value of&amp;nbsp;the prediction formula.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;However, this does not work. The log shows that the value returns a '.'. If I run the script twice, so multiple rows are created, the value returns correctly. If I add two rows and run the script only once, I still get the 'null' or '.' in the log file. There appears to be a reason for JMP needing to run the script twice to obtain the predicted formula result of a newly added row with set X values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better way to grab predicted values from prediction formulas using scripts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;BR /&gt;Nate&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 06:47:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39601#M23154</guid>
      <dc:creator>ngodfrey</dc:creator>
      <dc:date>2017-05-25T06:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39605#M23158</link>
      <description>&lt;P&gt;Details depend on the platform you use, but this shows the basic idea:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);
// Get some data
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt &amp;lt;&amp;lt; Bivariate(X(:height), Y(:weight));
// Do a regression
biv &amp;lt;&amp;lt; fitLine;
/// Save the prediction formula column
biv &amp;lt;&amp;lt; (curve[1] &amp;lt;&amp;lt; savePredicteds);
// Add a new observation (row) that we want to predict for
Wait(2);
dt &amp;lt;&amp;lt; addRows(1);
// Give predictor values and get the prediction back
Column(dt, "weight")[NRow(dt)] = 160;
Column(dt, "height")[NRow(dt)] = 65;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 May 2017 07:44:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39605#M23158</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2017-05-25T07:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39607#M23160</link>
      <description>&lt;P&gt;Ah perfect! I just need to put in the Wait(). Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 08:38:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39607#M23160</guid>
      <dc:creator>ngodfrey</dc:creator>
      <dc:date>2017-05-25T08:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39609#M23162</link>
      <description>&lt;P&gt;Sorry, No - I may have confused the issue. The 'Wait()' was just for cosmetic effect. Generally, you should never need this in JSL (but there are a few, very rare situations where you might). Probably best to send the data table a 'Run Formulas' message.&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 08:57:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/39609#M23162</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2017-05-25T08:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43195#M25012</link>
      <description>&lt;P&gt;Hello Ian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm searching the community for saving the&amp;nbsp; "Save Y Predicted Values" from&amp;nbsp;the PLS in a JSL. Is there a document available saying in which Tool I adress which colum saving (e.g. prediction formulas, Confidence intervals, Predicted Values).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Peter&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 15:08:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43195#M25012</guid>
      <dc:creator>peter_michel</dc:creator>
      <dc:date>2017-08-14T15:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43197#M25014</link>
      <description>&lt;P&gt;Hi Peter, This should help to get you started. The 'Wait()' commands are for cosmetic effect and can be removed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);
// Get some data
dt = Open( "$SAMPLE_DATA/Baltic.jmp" );
// Launch the PLS platform
plsLaunch = dt &amp;lt;&amp;lt; Fit Model(
							Y( :ls, :ha, :dt ),
							Effects(
								:v1,
								:v2,
								:v3,
								:v4,
								:v5,
								:v6,
								:v7,
								:v8,
								:v9,
								:v10,
								:v11,
								:v12,
								:v13,
								:v14,
								:v15,
								:v16,
								:v17,
								:v18,
								:v19,
								:v20,
								:v21,
								:v22,
								:v23,
								:v24,
								:v25,
								:v26,
								:v27
							),
							No Intercept( 1 ),
							Center Polynomials( 0 ),
							Personality( "Partial Least Squares" )
						);
// Do a couple of fits
Wait(2);
plsFits = plsLaunch &amp;lt;&amp;lt; Run(
							Fit( Method( NIPALS ), Number of Factors( 7 ) ),
							Fit( Method( NIPALS ), Number of Factors( 6 ) )
							);
// Save the prediction formula for the first fit (7 factors)
Wait(2);
plsFits &amp;lt;&amp;lt; (Fit[1] &amp;lt;&amp;lt; savePredictionFormula);
// Save the prediction formula for the second fit (6 factors)
Wait(2);
plsFits &amp;lt;&amp;lt; (Fit[2] &amp;lt;&amp;lt; savePredictionFormula);
// Now save the Y residuals
Wait(2);
plsFits &amp;lt;&amp;lt; (Fit[1] &amp;lt;&amp;lt; saveYresiduals);
plsFits &amp;lt;&amp;lt; (Fit[2] &amp;lt;&amp;lt; saveYresiduals);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Aug 2017 16:07:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43197#M25014</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2017-08-14T16:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43243#M25034</link>
      <description>&lt;P&gt;thanks Ian&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sorry, my scripting knowledge is too restricted, your help is not accelerating me, can you please get me some more support.&lt;/P&gt;&lt;P&gt;First I work with JMP not with PRO. I assume that is the reason that my JMP automated PLS script looks different to yours. I attached my script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plenty of questions appear reading your script.&lt;/P&gt;&lt;P&gt;Why do you separte between PLSLAUNCH and PLSFITS. Is that necessary or just for your comfort in reading/documenting?&lt;/P&gt;&lt;P&gt;Is it necessary to assign PLSFITS the fits if I just have one "fits" eg. just 7 Factors&amp;nbsp; (&lt;FONT face="Consolas" size="2"&gt;plsFits &amp;lt;&amp;lt; (&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Fit&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;] &amp;lt;&amp;lt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;savePredictionFormula&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;plsFits &amp;lt;&amp;lt; (&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Fit&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[&lt;/FONT&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;] &amp;lt;&amp;lt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;saveYresiduals&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt; I assume that means: Save the residual of Fit[1] to the object PLSFITS (and this name&amp;nbsp;can be chosen by me, it is just PLSFITS for better identification)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run your script&amp;nbsp;I get this error in the logwindow:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plsFits &amp;lt;&amp;lt; (Fit[/*###*/1] &amp;lt;&amp;lt; savePredictionFormula); Is that because of PRO Terminology?&lt;FONT face="Consolas" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Many thanks &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Peter&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 08:34:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43243#M25034</guid>
      <dc:creator>peter_michel</dc:creator>
      <dc:date>2017-08-15T08:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43244#M25035</link>
      <description>&lt;P&gt;I was forgetting about the fact that there is additional PLS functionality in JMP Pro that is not in the regular version. For JMP it will be similar, but a little simpler:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);
// Get some data
dt = Open( "$SAMPLE_DATA/Baltic.jmp" );
// Do a PLS fit in JMP (also works in JMP Pro)
pls = dt &amp;lt;&amp;lt; Partial Least Squares(
				Y( :ls, :ha, :dt ),
				X(
					:v1,
					:v2,
					:v3,
					:v4,
					:v5,
					:v6,
					:v7,
					:v8,
					:v9,
					:v10,
					:v11,
					:v12,
					:v13,
					:v14,
					:v15,
					:v16,
					:v17,
					:v18,
					:v19,
					:v20,
					:v21,
					:v22,
					:v23,
					:v24,
					:v25,
					:v26,
					:v27
				),
				Validation Method( Name( "Leave-One-Out" ), Initial Number of Factors( 15 ) ),
				Fit(
					Method( NIPALS ),
					Number of Factors( 7 ),
					Show Confidence Band( 1 ),
					Distance Plots( 1 ),
					Scatter Scores Plots( 1 ),
					Diagnostics Plots( 1 ),
					Overlay Loadings Plots( 1 ),
					T Square Plot( 1 ),
					Overlay Coefficients Plots( 1 )
				)
			);
// See what messages the PLS platform understands (look in the Log Window)
ClearLog();
ShowProperties(pls);
// Save some results from the (7 factor) fit
pls &amp;lt;&amp;lt; (Fit[1] &amp;lt;&amp;lt; savePredictionFormula);
pls &amp;lt;&amp;lt; (Fit[1] &amp;lt;&amp;lt; saveYresiduals);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To understand why the code works, I would start with 'Help &amp;gt; Books &amp;gt; Scripting Guide' to learn the rudiments of JSL.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 08:52:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43244#M25035</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2017-08-15T08:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Script - Grab Prediction Formula Result</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43255#M25042</link>
      <description>Great. It runs now and doing as expected. Many thanks.</description>
      <pubDate>Tue, 15 Aug 2017 13:12:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Script-Grab-Prediction-Formula-Result/m-p/43255#M25042</guid>
      <dc:creator>peter_michel</dc:creator>
      <dc:date>2017-08-15T13:12:42Z</dc:date>
    </item>
  </channel>
</rss>

