<?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 to script calibration curve in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193296#M41360</link>
    <description>&lt;P&gt;The index is now only used for the iteration count. The specific sample lables would be captured in a list prior to the iteration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// handle each sample set separately
sample = List( "001-AAA", "002-AAA", "003-AAA" );
For( s = 1, s &amp;lt;= 3, s++,
	// isolate sample
	combined
		&amp;lt;&amp;lt; Select Where( :Sample == sample[s] )
		&amp;lt;&amp;lt; Invert Row Selection
		&amp;lt;&amp;lt; Exclude;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 17 Apr 2019 12:07:02 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2019-04-17T12:07:02Z</dc:date>
    <item>
      <title>How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/190893#M41002</link>
      <description>&lt;P&gt;Hi, my level of scripting is really basic and I hope you can help me.&lt;/P&gt;&lt;P&gt;How do I write a script to achieve the following?&lt;/P&gt;&lt;P&gt;I have a table with the known concentrations of the calibrators. In each assay (one table per assay) I have the signal of several unknowns as well as the signal for the calibrators, it is basically an internal calibration curve for each assay.&lt;/P&gt;&lt;P&gt;Is it possible to create a script that takes the values from the table of the known concentrations, plots them against their signals for that specific assay (assay table) and then uses the linear regression to calculate the concentration of the unknowns?&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 12:42:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/190893#M41002</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-03T12:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/191257#M41028</link>
      <description>&lt;P&gt;I suggest that you first learn how to perform this analysis interactively using JMP. See &lt;STRONG&gt;Help&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Books&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Predictive and Specialized&amp;nbsp;Modeling&lt;/STRONG&gt; &amp;gt; chapter about &lt;STRONG&gt;Fit Curve&lt;/STRONG&gt;. It will explain how to use this platform for your purpose. It includes examples to guide you and help you practice before you attempt to analyze your own data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What model do you currently use for your calibration curve? You mention linear regression. If this is the case, then click the red triangle next to Fit Curve and select &lt;STRONG&gt;Polynomials&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Fit Linear&lt;/STRONG&gt;. Now click the red triangle next to Linear and select &lt;STRONG&gt;Custom Inverse Prediction&lt;/STRONG&gt;. A dialog appears in which you can enter the unknown responses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the Fit Curve platform interactively first to be sure that this analysis is appropriate and yields the results you seek. Then we can help with a script.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 12:14:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/191257#M41028</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-04T12:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192570#M41171</link>
      <description>&lt;P&gt;Thanks Mark.&lt;/P&gt;&lt;P&gt;I have followed the steps you mention to get the custom inverse prediction. Yes, it is a linear regression.&lt;/P&gt;&lt;P&gt;My problem with that is the limited number of unknows I can enter. The scripting question was asked having in mind that I have thousands of unknowns and I assumed that scripting the procedure would allow me to values for all those unknowns.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 09:07:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192570#M41171</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-11T09:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192580#M41176</link>
      <description>&lt;P&gt;Thanks for verifying the analysis method and process. Onward to the script!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide a sample of data? You can use generic names (anonymous data). That way I will understand&amp;nbsp;what the script should expect from the data table.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 11:15:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192580#M41176</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-11T11:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192722#M41203</link>
      <description>&lt;P&gt;Here are two example tables. One is the calibrator table. The other table is the one that has the measured values (AU 1) and needs calibration to obtain the unknown values (AU 2). To complicate things a bit, this table has the measurements for 3 different samples and each of these 3 samples also contained the components that were used to make the calibrator. So in each sample we have an internal calibrator, sort of speak.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be great to know how to script a calibration that completely omits the fact that we have an internal calibrator (plain simple linear regression of what is on the calibrator table and use the expression to obtain the unknowns from samples table). And it would be even better to know how to script a calibration that uses the measured values (AU 1) of the calibrator components in each sample (samples table), plots it against the known values (AU 2) in the calibrator table and calculates the unknowns for that specific sample, and does the same for each sample present in the samples table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;English is not my native language so please let me know if you need me to be a bit clearer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you can help me.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 12:40:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192722#M41203</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-12T12:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192810#M41228</link>
      <description>&lt;P&gt;I think I understand the basic problem but I might have missed a detail. Try this script with both data tables open (calibration table and unknow table):&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 );

// find all open data tables
tables = Get Data Table List();
If( N Items( tables ) &amp;lt; 2,
	Throw( "Two data tables are required for this analysis" )
);

dlg = New Window( "Assay Unknown Samples", &amp;lt;&amp;lt; Modal,
	H List Box(
		lb = List Box( tables ),
		Line Up Box( N Col( 2 ),
			Button Box( "Calibrator Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				cal lb &amp;lt;&amp;lt; Append( sel );
			),
			cal lb = List Box( {},
				N Lines( 1 )
			),
			Button Box( "Unknown Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				unk lb &amp;lt;&amp;lt; Append( sel );
			),
			unk lb = List Box( {},
				N Lines( 1 )
			)
		)
	),
	H List Box(
		Button Box( "OK",
			cal table = cal lb &amp;lt;&amp;lt; Get Items;
			Show( cal table );
			unk table = unk lb &amp;lt;&amp;lt; Get Items;
			Show( unk table );
		),
		Button Box( "Cancel" )
	)
);

If( dlg["Button"] == -1,
	Throw( "User cancelled" )
);

// unload dialog
cal table = Data Table( cal table[1] );
unk table = Data Table( unk table[1] );

// perform the linear calibration
dlg = cal table &amp;lt;&amp;lt; Fit Model(
	Y( :AU 1 ),
	Effects( :AU 2 ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" )
);
fit = dlg &amp;lt;&amp;lt; Run;

// perform inverse prediction on unknown
Current Data Table( unk table );
For Each Row(
	fit &amp;lt;&amp;lt; Inverse Prediction( Response( :AU 1[] ) );
);

// unload unknown assays
assays = Report( fit )["Inverse Prediction"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;
fit &amp;lt;&amp;lt; Close Window;
assays &amp;lt;&amp;lt; Delete Columns( Column( assays, 1 ) );

// join with unknown table
unk table &amp;lt;&amp;lt; Join(
	With( assays ),
	By Row Number
);
Close( assays, No Save );

// plot predictions with 95% confidence intervals versus actual
unk table &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 454 ),
	Show Control Panel( 0 ),
	Variables(
		X( :AU 1 ),
		Y( :Lower 95% ),
		Y( :Upper 95%, Position( 1 ) ),
		Y( :Predicted AU 2, Position( 1 ) )
	),
	Elements(
		Bar( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 8 ), Bar Style( "Interval" ) )
	),
	SendToReport(
		Dispatch( {}, "AU 1", ScaleBox, {Format( "Best", 12 )} ),
		Dispatch( {}, "Lower 95%", ScaleBox, {Format( "Fixed Dec", 12, 0 )} )
	)
);&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;The script is not flexible but it is a start.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 16:49:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192810#M41228</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-12T16:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192830#M41238</link>
      <description>&lt;P&gt;Maybe it's a JMP version issue (I have JMP 13.1) but the script does not work. I used the JSL Debugger and I get an error right at the start: Name Unresolved: Get Data Table List in access or evaluation of 'Get Data Table List' , Get Data Table List() /*###*/&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:14:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192830#M41238</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-12T19:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192832#M41240</link>
      <description>&lt;P&gt;It is a version issue. I opened JMP 13 and (1) the function was no longer highlighted as such and (2) it is not found in the Scripting Index.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hate when that happens!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this work-around:&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 );

// find all open data tables

/* for JMP 14 and later:
tables = Get Data Table List();
*/

n tables = N Table();

If( n tables &amp;lt; 2,
	Throw( "Two data tables are required for this analysis" )
);

tables = List();
For( t = 1, t &amp;lt;= n tables, t++,
	Insert Into( tables, Eval( Data Table( t ) &amp;lt;&amp;lt; Get Name ) );
);

// present open tables for assignment as calibration or unknown.

dlg = New Window( "Assay Unknown Samples", &amp;lt;&amp;lt; Modal,
	H List Box(
		lb = List Box( tables ),
		Line Up Box( N Col( 2 ),
			Button Box( "Calibrator Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				cal lb &amp;lt;&amp;lt; Append( sel );
			),
			cal lb = List Box( {},
				N Lines( 1 )
			),
			Button Box( "Unknown Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				unk lb &amp;lt;&amp;lt; Append( sel );
			),
			unk lb = List Box( {},
				N Lines( 1 )
			)
		)
	),
	H List Box(
		Button Box( "OK",
			cal table = cal lb &amp;lt;&amp;lt; Get Items;
			Show( cal table );
			unk table = unk lb &amp;lt;&amp;lt; Get Items;
			Show( unk table );
		),
		Button Box( "Cancel" )
	)
);

If( dlg["Button"] == -1,
	Throw( "User cancelled" )
);

// unload dialog
cal table = Data Table( cal table[1] );
unk table = Data Table( unk table[1] );

// perform the linear calibration
dlg = cal table &amp;lt;&amp;lt; Fit Model(
	Y( :AU 1 ),
	Effects( :AU 2 ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" )
);
fit = dlg &amp;lt;&amp;lt; Run;

// perform inverse prediction on unknown
Current Data Table( unk table );
For Each Row(
	fit &amp;lt;&amp;lt; Inverse Prediction( Response( :AU 1[] ) );
);

// unload unknown assays
assays = Report( fit )["Inverse Prediction"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;
fit &amp;lt;&amp;lt; Close Window;
assays &amp;lt;&amp;lt; Delete Columns( Column( assays, 1 ) );

// join with unknown table
unk table &amp;lt;&amp;lt; Join(
	With( assays ),
	By Row Number
);
Close( assays, No Save );

// plot predictions with 95% confidence intervals versus actual
unk table &amp;lt;&amp;lt; Graph Builder(
	Size( 534, 454 ),
	Show Control Panel( 0 ),
	Variables(
		X( :AU 1 ),
		Y( :Lower 95% ),
		Y( :Upper 95%, Position( 1 ) ),
		Y( :Predicted AU 2, Position( 1 ) )
	),
	Elements(
		Bar( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 8 ), Bar Style( "Interval" ) )
	),
	SendToReport(
		Dispatch( {}, "AU 1", ScaleBox, {Format( "Best", 12 )} ),
		Dispatch( {}, "Lower 95%", ScaleBox, {Format( "Fixed Dec", 12, 0 )} )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:43:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192832#M41240</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-12T19:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192840#M41242</link>
      <description>&lt;P&gt;Thanks Mark, it worked now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I understood, looking at the script, this is for the straightforward calibration using AU 1 and AU 2 values from the calibrator table, yes?&lt;/P&gt;&lt;P&gt;How can we rearrange it so that the calibrator is the AU 1 values specified in the calibrator table vs the AU 2 from the unknown table (making it a different calibrator for each sample) and then predict the AU 2 values for the rest of the components in the sample?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Apr 2019 10:18:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192840#M41242</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-13T10:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192858#M41247</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am confused.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;First of all, did it work or not? Did it work up to a point?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Second, yes, the calibration is performed entirely with the AU 1 and AU 2 values in the calibration table. Is that not correct?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Third, you don't have AU 2 values in the unknown table. Do you mean to use the predicted unknown AU 2 values?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Fourth, is this a change to the calibration definition or is it a new requirement (follow on step) after predicting the AU &lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;2 in the unknown table?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fifth, what is Sample? How does it relate to Peps?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sixth, shouldn't the AU 1 in the calibrator table for Pep1 to Pep29 be correlated? They are not:&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="Screen Shot 2019-04-13 at 4.05.27 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/16876iB95CB2DC788FB96D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-04-13 at 4.05.27 PM.png" alt="Screen Shot 2019-04-13 at 4.05.27 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am probably missing something very important and very basic.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Apr 2019 20:25:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192858#M41247</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-13T20:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192875#M41250</link>
      <description>&lt;P&gt;It did work perfectly. And it does what I asked help for. But there were two parts of my initial post. The first was to know how to script the calibration just like you showed me.&lt;/P&gt;&lt;P&gt;The second, which is not related to the first, so it would be a completely different script, is to do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The unknown table has 3 samples, each sample was analyzed for 74 Peps. 29 of those Peps I want to use them for calibration of the other 45. And I want to do that by fetching the AU 2 values from the calibration table. So the script should fetch the AU 2 values from the calibration table and join them with the 1-29 Peps for each sample in the unknown table, after which should make a calibration curve (linear regression) for each of the samples and attribute AU 2 values to the remainder 45 Peps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for bearing with me!&lt;/P&gt;&lt;P&gt;I know that the values do not correlate, these were randomly generated values with the purpose of learning how to script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Apr 2019 21:18:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/192875#M41250</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-13T21:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193004#M41275</link>
      <description>&lt;P&gt;OK, thanks for clarifying.&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 );

// check for sufficient tables
n tables = N Table();

If( n tables &amp;lt; 2,
	Throw( "Two data tables are required for this analysis" )
);

tables = List();
For( t = 1, t &amp;lt;= n tables, t++,
	Insert Into( tables, Eval( Data Table( t ) &amp;lt;&amp;lt; Get Name ) );
);

// identify the calibration and unknown data tables
dlg = New Window( "Assay Unknown Samples", &amp;lt;&amp;lt; Modal,
	H List Box(
		lb = List Box( tables ),
		Line Up Box( N Col( 2 ),
			Button Box( "Calibrator Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				cal lb &amp;lt;&amp;lt; Append( sel );
			),
			cal lb = List Box( {},
				N Lines( 1 )
			),
			Button Box( "Unknown Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				unk lb &amp;lt;&amp;lt; Append( sel );
			),
			unk lb = List Box( {},
				N Lines( 1 )
			)
		)
	),
	H List Box(
		Button Box( "OK",
			cal table = cal lb &amp;lt;&amp;lt; Get Items;
			Show( cal table );
			unk table = unk lb &amp;lt;&amp;lt; Get Items;
			Show( unk table );
		),
		Button Box( "Cancel" )
	)
);

If( dlg["Button"] == -1,
	Throw( "User cancelled" )
);

// unload the dialog
cal table = Data Table( cal table[1] );
unk table = Data Table( unk table[1] );

// include AU 2 values for calibrators from calibration table
combined = cal table &amp;lt;&amp;lt; Join(
	With( unk table ),
	Copy formula( 0 ),
	Select With( :Sample, :Peps, :AU 1 ),
	Select( :AU 2 ),
	By Matching Columns( :Peps = :Peps ),
	Drop Multiples( 0, 0 ),
	Include Nonmatches( 0, 1 ),
	Preserve Main Table Order( 0 )
);
Close( cal table, No Save );
Close( unk table, No Save );

// distinquish peps
Current Data Table( combined );
combined &amp;lt;&amp;lt; New Column( "Status", "Character", "Nominal" );
For Each Row(
	:Status = If( 1 &amp;lt;= Num( Regex( :Peps, "\w{3}(\d+)", "\1" ) ) &amp;lt;= 29, "Calibrator", "Unknown" );
);


// fit the calibration curve
dlg = combined &amp;lt;&amp;lt; Fit Model(
	Y( :AU 1 ),
	Effects( :AU 2 ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
	Where( :Status == "Calibrator" )
);
fit = dlg &amp;lt;&amp;lt; Run;

// determine the assay for the unknown samples from the calibration curve
For Each Row(
	fit &amp;lt;&amp;lt; Inverse Prediction( Response( :AU 1[] ) );
);

// extract the assays into a new data table
assays = Report( fit )["Inverse Prediction"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;
fit &amp;lt;&amp;lt; Close Window;
assays &amp;lt;&amp;lt; Delete Columns( Column( assays, 1 ) );

// add the assays to the unknown table
final = combined &amp;lt;&amp;lt; Join(
	With( assays ),
	Copy formula( 0 ),
	By Matching Columns( :AU 1 = :Specified AU 1 ),
	Drop Multiples( 0, 0 ),
	Include Nonmatches( 1, 0 ),
	Preserve Main Table Order( 1 )
);
Close( combined, No Save );
Close( assays, No Save );

final &amp;lt;&amp;lt; Sort(
	By( :Peps, :Sample ),
	Order( Ascending, Ascending ),
	Replace Table
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the predicted AU 2 values are missing due to the random measurements of AU 1.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 12:12:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193004#M41275</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-15T12:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193006#M41277</link>
      <description>&lt;P&gt;This is perfect! Thank you so much Mark!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 12:30:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193006#M41277</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-15T12:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193010#M41281</link>
      <description>&lt;P&gt;I think I spoke too soon. There is one issue Mark. Right now the script is pulling all AU 2 values from the calib table to the unk table fort the calibrators and that is fine. But then the new table is using all that were assigned with the calibrator designation to be used in the fit model and the unknowns are being predicted from that one model (that has the calibrators from sample 1, 2 and 3 pooled together), right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need is a fit model per sample and that the unknowns of that sample be determined with the fit model associated with that sample only.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:55:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193010#M41281</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-15T13:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193051#M41294</link>
      <description>&lt;P&gt;So the three sample sets should be handled separate?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 16:20:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193051#M41294</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-15T16:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193052#M41295</link>
      <description>Yes, they have the 29 peps as internal calibrators. Those specific 29 peps should fetch the AU 2 values from the calib table and then each set calibrate the remainder peps associated to the sample number.&lt;BR /&gt;I think I made this more confusing by asking for two different things in the same post. I’m sorry for that.&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Apr 2019 16:37:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193052#M41295</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-15T16:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193056#M41299</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

// check for sufficient tables
n tables = N Table();

If( n tables &amp;lt; 2,
	Throw( "Two data tables are required for this analysis" )
);

tables = List();
For( t = 1, t &amp;lt;= n tables, t++,
	Insert Into( tables, Eval( Data Table( t ) &amp;lt;&amp;lt; Get Name ) );
);

// identify the calibration and unknown data tables
dlg = New Window( "Assay Unknown Samples", &amp;lt;&amp;lt; Modal,
	H List Box(
		lb = List Box( tables ),
		Line Up Box( N Col( 2 ),
			Button Box( "Calibrator Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				cal lb &amp;lt;&amp;lt; Append( sel );
			),
			cal lb = List Box( {},
				N Lines( 1 )
			),
			Button Box( "Unknown Table",
				sel = lb &amp;lt;&amp;lt; Get Selected;
				unk lb &amp;lt;&amp;lt; Append( sel );
			),
			unk lb = List Box( {},
				N Lines( 1 )
			)
		)
	),
	H List Box(
		Button Box( "OK",
			cal table = cal lb &amp;lt;&amp;lt; Get Items;
			Show( cal table );
			unk table = unk lb &amp;lt;&amp;lt; Get Items;
			Show( unk table );
		),
		Button Box( "Cancel" )
	)
);

If( dlg["Button"] == -1,
	Throw( "User cancelled" )
);

// unload the dialog
cal table = Data Table( cal table[1] );
unk table = Data Table( unk table[1] );

// include AU 2 values for calibrators from calibration table
combined = cal table &amp;lt;&amp;lt; Join( With( unk table ),
	Copy formula( 0 ),
	Select With( :Sample, :Peps, :AU 1 ),
	Select( :AU 2 ),
	By Matching Columns( :Peps = :Peps ),
	Drop Multiples( 0, 0 ),
	Include Nonmatches( 0, 1 ),
	Preserve Main Table Order( 0 )
);
Close( cal table, No Save );
Close( unk table, No Save );

// distinquish peps
Current Data Table( combined );
combined &amp;lt;&amp;lt; New Column( "Status", "Character", "Nominal" );
For Each Row(
	:Status = If( 1 &amp;lt;= Num( Regex( :Peps, "\w{3}(\d+)", "\1" ) ) &amp;lt;= 29, "Calibrator", "Unknown" );
);

// placeholders for matching information
combined
	&amp;lt;&amp;lt; New Column( "Predicted AU 2", "Numeric", "Continuous" )
	&amp;lt;&amp;lt; New Column( "Lower 95%", "Numeric", "Continuous" )
	&amp;lt;&amp;lt; New Column( "Upper 95%", "Numeric", "Continuous" );

// handle each sample set separately
For( s = 1, s &amp;lt;= 3, s++,
	// isolate sample
	ss = Char( s );
	combined
		&amp;lt;&amp;lt; Select Where( :Sample == ss )
		&amp;lt;&amp;lt; Invert Row Selection
		&amp;lt;&amp;lt; Exclude;

	// fit the calibration curve for this sample
	dlg = combined &amp;lt;&amp;lt; Fit Model(
		Y( :AU 1 ),
		Effects( :AU 2 ),
		Personality( "Standard Least Squares" ),
		Emphasis( "Minimal Report" ),
		Where( :Status == "Calibrator" )
	);
	fit = dlg &amp;lt;&amp;lt; Run;

	// determine the assay for the unknown samples from the calibration curve
	For Each Row(
		If( Not( Excluded( Row State( Row() ) ) ),
			fit &amp;lt;&amp;lt; Inverse Prediction( Response( :AU 1[] ) );
		);
	);

	// access report layer
	fit rep = fit &amp;lt;&amp;lt; Report;

	// remove extraneous string column box that interferes with making combined data table
	(fit rep &amp;lt;&amp;lt; XPath( "//StringColBox[StringColBoxHeader=\!"Type of CI\!"]")) &amp;lt;&amp;lt; Delete;

	// extract the assays into a new data table
	assays = fit rep["Inverse Prediction"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;
	fit &amp;lt;&amp;lt; Close Window;

	// prepare predicted values for join
	assays
		&amp;lt;&amp;lt; Delete Columns( Column( assays, 1 ) )
		&amp;lt;&amp;lt; New Column( "Sample", "Character", "NominaL" )
		&amp;lt;&amp;lt; New Column( "Peps", "Character", "NominaL" );
	Current Data Table( combined );
	r = 1;
	For Each Row(
		If( Not( Excluded( Row State( Row() ) ) ),
			assays:Sample[r] = combined:Sample;
			assays:Peps[r] = combined:Peps;
			r++;
		);
	);
	combined &amp;lt;&amp;lt; Clear Row States;
	combined &amp;lt;&amp;lt; Update(
		With( assays ),
		Match Columns(
			:Sample = :Sample,
			:Peps = :Peps
		)
	);
	Close( assays, No Save );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 18:13:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193056#M41299</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-15T18:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193261#M41351</link>
      <description>&lt;P&gt;It works perfectly! Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I understand what each line of code is doing. I do have some doubts about these:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-jsl"&gt;&lt;CODE class="  language-jsl"&gt;&lt;SPAN class="token function"&gt;For Each Row&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;
	&lt;SPAN class="token punctuation"&gt;:&lt;/SPAN&gt;Status &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;If&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Num&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Regex&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;:&lt;/SPAN&gt;Peps&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"\w{3}(\d+)"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"\1"&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;29&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"Calibrator"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"Unknown"&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE class=" language-jsl"&gt;&lt;CODE class="  language-jsl"&gt;&lt;SPAN class="token function"&gt;For&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; s &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; s &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; s&lt;SPAN class="token operator"&gt;++&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;
	&lt;SPAN class="token comment"&gt;// isolate sample&lt;/SPAN&gt;
	ss &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Char&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; s &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	combined
		&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token messages"&gt; Select Where&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;:&lt;/SPAN&gt;Sample &lt;SPAN class="token operator"&gt;==&lt;/SPAN&gt; ss &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;
		&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token messages"&gt; Invert Row Selection
		&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token messages"&gt; Exclude&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Could you explain them to me, please?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 06:13:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193261#M41351</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-17T06:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193292#M41357</link>
      <description>&lt;P&gt;You doubt my code? Well, it is your prerogative.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first example populates a new column without using a column formula property.&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;For Each Row(
	:Status = If( 1 &amp;lt;= Num( Regex( :Peps, "\w{3}(\d+)", "\1" ) ) &amp;lt;= 29, "Calibrator", "Unknown" );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;STRONG&gt;For Each Row()&lt;/STRONG&gt; function iterates over the rows of the current data table. It handles indexing rows automatically. So the assignment occurs row-wise. The right side of the assignment is the &lt;STRONG&gt;If()&lt;/STRONG&gt; function. The first argument is interpreted as a Boolean expression. If this expression evaluates to true, the the second argument ("Calibrator") is evaluated and returned. Otherwise, the third argument ("Unknown") is evaluated and returned. The first argument determines if the Peps number is in the range of 1 to 29. The number string is extracted with a regular expression and converted to a number. The regular expression matches a pattern of three word characters followed by one or more digit characters. The back reference returns the only capturing group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second example iterates over the three samples in the data set.&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;For( s = 1, s &amp;lt;= 3, s++,
	// isolate sample
	ss = Char( s );
	combined
		&amp;lt;&amp;lt; Select Where( :Sample == ss )
		&amp;lt;&amp;lt; Invert Row Selection
		&amp;lt;&amp;lt; Exclude;&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;It uses an integer index that is converted to a character string to match the data column attribute. It sends a cascade of messages to the combined data table to (1) select all the rows for the current sample, (2) change the selection to all the rows not for the current sample, and (3) excludes those rows. This approach is usually simpler and faster than subsetting data tables and later joining and concatenating the data tables with the results.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:18:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193292#M41357</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-17T11:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to script calibration curve</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193293#M41358</link>
      <description>&lt;P&gt;I think you've misunderstood me. By doubts, I meant that I didn't understand the function of the code. I know very very little about coding and I wouldn't dare to doubt your code!&amp;nbsp; I'm just trying to understand and learn from you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I understand the first example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the second example, if instead of numbers the samples also have a text designation, how would the code be changed? For example, instead of sample 1, 2 and 3, we have sample 001-AAA, 002-AAA and 003-AAA?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:41:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-calibration-curve/m-p/193293#M41358</guid>
      <dc:creator>JD23</dc:creator>
      <dc:date>2019-04-17T11:41:16Z</dc:date>
    </item>
  </channel>
</rss>

