<?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: JMP &amp;gt; JSL &amp;gt; Script Acceleration for Multiple Call to Fit Model (N &amp;gt; 2000)? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436050#M68528</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thanks for the suggestion. Thanks to the method you recommended, I have improved the speed by another 33%.&lt;/P&gt;
&lt;P&gt;There are still some tweaks that I need to perfect but I started at a total run time of about 450 seconds, down to 91 seconds with my initial changes, and down to 61 seconds now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 22:53:34 GMT</pubDate>
    <dc:creator>Thierry_S</dc:creator>
    <dc:date>2021-11-12T22:53:34Z</dc:date>
    <item>
      <title>JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/435681#M68490</link>
      <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;
&lt;P&gt;The size of my datasets is getting bigger and the basic scripts I created a while back (see below) are not keeping up from a speed point of view.&lt;/P&gt;
&lt;P&gt;I would greatly appreciate hearing about ideas on how to optimize this type of script for better speed. For example, I suspect that operations like "Concatenate" are relatively slow, and it might make sense to work with matrices for this type of operation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1);

dt = Current Data Table ();

CList = dt &amp;lt;&amp;lt; Get Column Names (string);

dtoutl = New Table ("LSM OUTPUT", "invisible");
dtoutp = New Table ("PVal OUTPUT", "invisible");


For (i = 1, i&amp;lt;= 2000, i++,  

	fm = dt &amp;lt;&amp;lt;	Fit Model(
					Y( Column (i) ),
					Effects( :VISIT, :TREATMENT, :VISIT * :TREATMENT, Column (i+2000) ),
					Personality( "Standard Least Squares" ),
					Emphasis( "Minimal Report" ),
					Run(
						Column (i) &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
						Parameter Estimates( 1 ), Scaled Estimates( 0 ),
						Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
						Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
						Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ),
						Box Cox Y Transformation( 0 ), {:VISIT * :TRT01A &amp;lt;&amp;lt;
						{LSMeans Contrast( [0 0 1 -1 0 0, 0 0 0 0 1 -1] )}}}
					)
					
				);
	fmr = report (fm);
	
	table_list = fmr &amp;lt;&amp;lt; xpath ("//OutlineBox [text() = 'VISIT*TREATMENT']//TableBox");
	
	temp_lsm = table_list [1];
	temp_pval = table_list [2];
	
	temp_tbl_lsm = temp_lsm &amp;lt;&amp;lt; Make into Data Table (invisible (1));
	temp_tbl_pval = temp_pval &amp;lt;&amp;lt; Make into Data Table (invisible (1));
	
	temp_tbl_lsm &amp;lt;&amp;lt; New column ("ID", character, nominal, &amp;lt;&amp;lt; set each value (CList [i]));
	temp_tbl_pval &amp;lt;&amp;lt; New column ("ID", character, nominal, &amp;lt;&amp;lt; set each value (CList [i]));
	
	fmr &amp;lt;&amp;lt; close window;
	
	dtoutl &amp;lt;&amp;lt; Concatenate (Data table (temp_tbl_lsm), "Append to First Table");
	Wait (0);
	dtoutp &amp;lt;&amp;lt; Concatenate (Data table (temp_tbl_pval), "Append to First Table");
	
	Close (temp_tbl_lsm, NoSave);	
	Close (temp_tbl_pval, NoSave);	
		
	
);


dtoutl &amp;lt;&amp;lt; Bring Window to Front;
dtoutp &amp;lt;&amp;lt; Bring Window to Front;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All feedback is welcome.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:05:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/435681#M68490</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2023-06-09T18:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/435786#M68494</link>
      <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have experimented with matrices as receptacles for aggregating long collections of analysis output tables, and so far I have accelerated my execution time by ~5 folds (see below). The only minor inconvenience is that I have had to rebuild the annotations for the captured output tables because (obviously) matrices do not hold text.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1);

st = Today();

dt = Current Data Table ();
dts = dt &amp;lt;&amp;lt; Summary( Group( :VISIT, :TRT01A ), Freq( "None" ), Weight( "None" ), invisible );
annot_lsm = {};
met_l = {};
annot_pv = {};

CList = dt &amp;lt;&amp;lt; Get Column Names (string);

For (j = 1, j &amp;lt;= N Rows (dts), j++,
	insert into (annot_lsm, dts:VISIT [j] || ", " || dts:TRT01A [j]);
);

annot_pv = annot_lsm;

annot_pv = Concat To(annot_pv, {"Estimate","Std Error", "t Ratio", "Prob&amp;gt;|t|", "SS", "Lower 95%", "Upper 95%"});

Close (dts, NoSave);

mtx_lsm = [];
mtx_pval = [];

For (i = 1, i&amp;lt;= 2000, i++,  //2000

	fm = dt &amp;lt;&amp;lt;	Fit Model(
					Y( Column (i) ),
					Effects( :VISIT, :TRT01A, :VISIT * :TRT01A, Column (i+2000) ),
					Personality( "Standard Least Squares" ),
					Emphasis( "Minimal Report" ),
					Run(
						Column (i) &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
						Parameter Estimates( 1 ), Scaled Estimates( 0 ),
						Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
						Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
						Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ),
						Box Cox Y Transformation( 0 ), {:VISIT * :TRT01A &amp;lt;&amp;lt;
						{LSMeans Contrast( [0 0 1 -1 0 0, 0 0 0 0 1 -1] )}}}
					)
					
				);
	
	fmr = report (fm);
	
	insert into (met_l, CList [i]);
	
	table_list = fmr &amp;lt;&amp;lt; xpath ("//OutlineBox [text() = 'VISIT*TRT01A']//TableBox");
	
	temp_lsm = table_list [1];
	temp_pval = table_list [2];
	
	temp_mtx_lsm = temp_lsm &amp;lt;&amp;lt; Get as Matrix;
	temp_mtx_pval = temp_pval &amp;lt;&amp;lt; Get as Matrix;
	
	fmr &amp;lt;&amp;lt; close window;
	
	mtx_lsm = mtx_lsm |/ temp_mtx_lsm;
	mtx_pval = mtx_pval |/ temp_mtx_pval ;
		
);
dtoutl = as Table (mtx_lsm);
dtoutp = as Table (mtx_pval);

dtoutl &amp;lt;&amp;lt; new column ("COMP", Character, Nominal);
dtoutl &amp;lt;&amp;lt; new column ("MET_ID", Character, Nominal);
dtoutl:Col1 &amp;lt;&amp;lt; set name ("LSMEAN");
dtoutl:Col2 &amp;lt;&amp;lt; set name ("STDERR");
dtoutl:Col3 &amp;lt;&amp;lt; set name ("UPPER CI");
dtoutl:Col4 &amp;lt;&amp;lt; set name ("LOWER CI");

dtoutl &amp;lt;&amp;lt; Begin Data Update;
	For Each Row( dtoutl, :COMP = annot_lsm[Sequence( 1, N Items (annot_lsm), 1, 1 )] );
	For each row( dtoutl, :MET_ID = met_l[Sequence (1,N Items (met_l), 1, 6)] );
dtoutl &amp;lt;&amp;lt; End Data Update;

dtoutp &amp;lt;&amp;lt; new column ("LABEL", Character, Nominal);
dtoutp &amp;lt;&amp;lt; new column ("MET_ID", Character, Nominal);

dtoutp &amp;lt;&amp;lt; Begin Data Update;
	For Each Row( dtoutp, :LABEL = annot_pv[Sequence( 1, N Items (annot_pv), 1, 1 )] );
	For each row( dtoutp, :MET_ID = met_l[Sequence (1,N items (met_l), 1, 13)] );
dtoutp &amp;lt;&amp;lt; End Data Update;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Nov 2021 06:15:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/435786#M68494</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-11-12T06:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/435905#M68505</link>
      <description>&lt;P&gt;5X sounds great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There might also be an invisible option for the platform that might help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Try the JSL profiler, the next suggestion may be way off-base. There is no point making something faster that uses &amp;lt; 1% of the time...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it still isn't enough, the last two statements in the loop may be the next place to look. I think your JSL is reallocating the arrays 2000 times at progressively larger sizes. If you can pre-allocate the arrays (using the J(nr,nc,initvalue) function) and store into them with something like mtx_lsm[a::b,0] = temp_mtx_lsm[0,0] you'll save some time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: this is potentially an N^2 problem because it not only reallocates, it copies the data too; going from a run of 1000 to a run of 2000 will copy 4X (not 2X) the amount of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 14:47:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/435905#M68505</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-11-12T14:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436050#M68528</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thanks for the suggestion. Thanks to the method you recommended, I have improved the speed by another 33%.&lt;/P&gt;
&lt;P&gt;There are still some tweaks that I need to perfect but I started at a total run time of about 450 seconds, down to 91 seconds with my initial changes, and down to 61 seconds now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 22:53:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436050#M68528</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-11-12T22:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436059#M68530</link>
      <description>&lt;P&gt;Cool! I think the community would like to see what you did to get there, or maybe summarize how important different changes were. &lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5080"&gt;@DonMcCormack&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 23:14:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436059#M68530</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-11-12T23:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436143#M68540</link>
      <description>&lt;P&gt;Hi JMP Community,&lt;/P&gt;
&lt;P&gt;Find below the annotated version of the most improved script to run and capture the output of a large number of Fit Model analyses.&lt;/P&gt;
&lt;P&gt;The two most essential steps to improve the run time are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Usage of matrices instead of Data Tables to aggregate the analysis output&lt;/LI&gt;
&lt;LI&gt;Replacement instead of insertion of the analysis output data into master matrices created ahead of the main loop.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1);

st = Today();

dt = Current Data Table ();

lc_path = dt &amp;lt;&amp;lt; GetPath;

// START: CAPTURING OUTPUT ANNOTATION TO REBUILD ANNOTATION // 
dts = dt &amp;lt;&amp;lt; Summary( Group( :VISIT, :TRT01A ), Freq( "None" ), Weight( "None" ), invisible );
annot_lsm = {};
met_l = {};
annot_pv = {};

CList = dt &amp;lt;&amp;lt; Get Column Names (string);

For (j = 1, j &amp;lt;= N Rows (dts), j++,
	insert into (annot_lsm, dts:VISIT [j] || ", " || dts:TRT01A [j]);
);

annot_pv = annot_lsm;

annot_pv = Concat To(annot_pv, {"Estimate","Std Error", "t Ratio", "Prob&amp;gt;|t|", "SS", "Lower 95%", "Upper 95%"});

Close (dts, NoSave);
// END: CAPTURING OUTPUT ANNOTATION TO REBUILD ANNOTATION // 

// START: CREATING EMPTY NASTER MATRICES TO HOLD TTHE OUTPUT OF THE FIT MODEL//
nro_l = 1933*6;
nco_l = 4;

nro_p = 1933 * 13;
nco_p = 2;

mtx_lsm = J(nro_l, nco_l);
mtx_pval = J(nro_p, nco_p);
// END: CREATING EMPTY MASTER MATRICES TO HOLD TTHE OUTPUT OF THE FIT MODEL//

//START MAIN LOOP//
For (i = 3921, i&amp;lt;= 5853, i++,  //5853
	
	//START LINEAR MODEL WITH CUSTGOMIZED CONTRASTS //
	
	fm = dt &amp;lt;&amp;lt;	Fit Model(
					Y( Column (i) ),
					Effects( :VISIT, :TRT01A, :VISIT * :TRT01A, Column (i-1933) ),
					Personality( "Standard Least Squares" ),
					Emphasis( "Minimal Report" ),
					Run(
						Column (i) &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
						Parameter Estimates( 1 ), Scaled Estimates( 0 ),
						Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
						Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
						Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ),
						Box Cox Y Transformation( 0 ), {:VISIT * :TRT01A &amp;lt;&amp;lt;
						{LSMeans Contrast( [0 0 1 -1 0 0, 0 0 0 0 1 -1] )}}}
					)
					
				);
	//END LINEAR MODEL WITH CUSTGOMIZED CONTRASTS //
	
	//START CAPTURE ANALYSIS OUTPUTS FOR EACH RUN//
	fmr = report (fm);
	
	insert into (met_l, CList [i]); //COLLATING THE NAME OF THE COLUMN FOR EACH RUN//
	
	table_list = fmr &amp;lt;&amp;lt; xpath ("//OutlineBox [text() = 'VISIT*TRT01A']//TableBox");
	
	temp_lsm = table_list [1]; //POINTER TO LSMEAN + STDERR TABLE//
	temp_pval = table_list [2]; // POINTER TO CONTRAST TABLE //
	
	temp_mtx_lsm = temp_lsm &amp;lt;&amp;lt; Get as Matrix; // EXTRACT LSMEAN + STDERR OUTPUT AS A MATRIX //
	temp_mtx_pval = temp_pval &amp;lt;&amp;lt; Get as Matrix; // EXTRACT CONTRAST OUTPUT AS A MATRIX //
	
	locr1_l = ((i-3921)*6) + 1; //GENERATE THE TOP ROW BLOCK FOR INSERTION OF LSMEAN + STDERR IN TO THE MASTER MATRIX //
	locr2_l = ((i-3921)*6) + 6; //GENERATE THE BOTTOM ROW BLOCK FOR INSERTION OF LSMEAN + STDERR IN TO THE MASTER MATRIX //
	
	mtx_lsm [locr1_l::locr2_l, 0] = temp_mtx_lsm [0,0]; //REPLACE PLACEHOLDER VALUES IN MASTER MATRIX WITH LOCAL LSMEAN + STDERR OUTPUT DATA FROM EACH RUN //
	
	locr1_p = ((i-3921)*13) + 1; //GENERATE THE TOP ROW BLOCK FOR INSERTION OF CONTRAST IN TO THE MASTER MATRIX //
	locr2_p = ((i-3921)*13) + 13; //GENERATE THE BOTTOM ROW BLOCK FOR INSERTION OF CONTRAST IN TO THE MASTER MATRIX //
	
	mtx_pval [locr1_p::locr2_p, 0] = temp_mtx_pval [0,0]; //REPLACE PLACEHOLDER VALUES IN MASTER MATRIX WITH LOCAL CONTRAST OUTPUT DATA FROM EACH RUN //
	
	fmr &amp;lt;&amp;lt; close window;	
);
// START CONVERT MASTER MATRICES INTO TABLES//
dtoutl = as Table (mtx_lsm); 
dtoutp = as Table (mtx_pval);
// END CONVERT MASTER MATRICES INTO TABLES//

//START REBUILD ANNOTATIONS AND REFORMAT FOR LSMEAN + STDERR TABLE//
dtoutl &amp;lt;&amp;lt; new column ("COMP", Character, Nominal);
dtoutl &amp;lt;&amp;lt; new column ("MET_ID", Character, Nominal);
dtoutl:Col1 &amp;lt;&amp;lt; set name ("LSMEAN");
dtoutl:Col2 &amp;lt;&amp;lt; set name ("STDERR");
dtoutl:Col3 &amp;lt;&amp;lt; set name ("UPPER CI");
dtoutl:Col4 &amp;lt;&amp;lt; set name ("LOWER CI");

dtoutl &amp;lt;&amp;lt; Begin Data Update;
	For Each Row( dtoutl, :COMP = annot_lsm[Sequence( 1, N Items (annot_lsm), 1, 1 )] );
	For each row( dtoutl, :MET_ID = met_l[Sequence (1,N Items (met_l), 1, 6)] );
dtoutl &amp;lt;&amp;lt; End Data Update;

dtoutl &amp;lt;&amp;lt; New Column ("METAB_ID", Character, Nominal, Formula (Substitute (:MET_ID, "LOG10 FC ", ""))) ;
dtoutl &amp;lt;&amp;lt; New Column ("VISIT", Character, Nominal, Formula (Word (1,:COMP, ",")));
dtoutl &amp;lt;&amp;lt; New Column ("ARM", Character, Ordinal, Formula (Word (-1, :COMP, ",")));

dtoutl:METAB_ID &amp;lt;&amp;lt; Delete Formula;
dtoutl:ARM &amp;lt;&amp;lt; Delete Formula;
dtoutl:VISIT &amp;lt;&amp;lt; Delete Formula;
//END REBUILD ANNOTATIONS AND REFORMAT FOR LSMEAN + STDERR TABLE//

//START REBUILD ANNOTATIONS AND REFORMAT FOR CONTRAST TABLE//
dtoutp &amp;lt;&amp;lt; new column ("LABEL", Character, Nominal);
dtoutp &amp;lt;&amp;lt; new column ("MET_ID", Character, Nominal);

dtoutp &amp;lt;&amp;lt; Begin Data Update;
	For Each Row( dtoutp, :LABEL = annot_pv[Sequence( 1, N Items (annot_pv), 1, 1 )] );
	For each row( dtoutp, :MET_ID = met_l[Sequence (1,N items (met_l), 1, 13)] );
dtoutp &amp;lt;&amp;lt; End Data Update;

CNAME1 = Column (dtoutp, 3) [3];
CNAME2 = Column (dtoutp, 3) [5];

dtoutp &amp;lt;&amp;lt; Select Where (:LABEL == "Prob&amp;gt;|t|");

dtoutp_s = dtoutp &amp;lt;&amp;lt; subset (Selected Rows, Output Table Name ("P VAL"));

Close (dtoutp, NoSave);

dtoutp_s &amp;lt;&amp;lt; New Column ("METAB_ID", Character, Nominal, Formula (Substitute (:MET_ID, "LOG10 FC ", "")));

dtoutp_s:Col1 &amp;lt;&amp;lt; Set Name (CNAME1);
dtoutp_s:Col2 &amp;lt;&amp;lt; Set Name (CNAME2);

dtoutp_s_s = dtoutp_s &amp;lt;&amp;lt; Stack (Columns (as name(CNAME1), as name (CNAME2)), Output Table Name ("STACK P VAL"));

Close (dtoutp_s, NoSave);

dtoutp_s_s &amp;lt;&amp;lt; New Column ("VISIT", Character, Nominal, Formula (Word (1,:Label, ",")));
dtoutp_s_s &amp;lt;&amp;lt; New Column ("xARM", Character, Ordinal, Formula (Word (-1, :Label, ",")));
dtoutp_s_s:Data &amp;lt;&amp;lt; Set name ("NOM P VAL");

dtoutl &amp;lt;&amp;lt; Update(
	With( dtoutp_s_s ),
	Match Columns( :METAB_ID = :METAB_ID, :VISIT = :VISIT ),
	Add Columns from Update Table( :NOM P VAL ),
	Replace Columns in Main Table( None )
);

Close (dtoutp_s_s, NoSave);
//END REBUILD ANNOTATIONS AND REFORMAT FOR CONTRAST TABLE//
dtoutl &amp;lt;&amp;lt; Save (substitute (lc_path, dt &amp;lt;&amp;lt; get name||".jmp", "LINMOD_OUT_")||char(today())); //

et = Today ();

show (Date Difference (st, et, "second"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 20:11:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436143#M68540</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-11-13T20:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436155#M68542</link>
      <description>&lt;P&gt;These might give some further (most likely fairly small) speed increases:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can most likely add invisible to fit model&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;fm = dt &amp;lt;&amp;lt;	Fit Model(
	Y( Column (i) ),
	Effects( :VISIT, :TRT01A, :VISIT * :TRT01A, Column (i-1933) ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Minimal Report" ),
	Run(
		Column (i) &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 0 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 0 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 ), {:VISIT * :TRT01A &amp;lt;&amp;lt;
		{LSMeans Contrast( [0 0 1 -1 0 0, 0 0 0 0 1 -1] )}}}
	),
	invisible
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also if you are creating columns with formulas and then immediately removing them, you could use &amp;lt;&amp;lt; Set Each value instead of Formula and Delete Formula&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;dtoutl &amp;lt;&amp;lt; New Column("METAB_ID", Character, Nominal, &amp;lt;&amp;lt; Set Each Value(Substitute(:MET_ID, "LOG10 FC ", "")));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might be able to replace For Each Row with &amp;lt;&amp;lt; Set Each Value also (not sure about this one, also not sure if this will have speed increase):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Column(dtoutp, "LABEL") &amp;lt;&amp;lt; Set Each Value(annot_pv[Sequence( 1, N Items (annot_pv), 1, 1 )]);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also try to keep datatables private (at least invisible) until you need them. &lt;A href="https://community.jmp.com/t5/Discussions/Data-Table-from-Private-to-Visible/m-p/42155/highlight/true#M24562" target="_blank" rel="noopener"&gt;You can make private tables visible with &amp;lt;&amp;lt; New Data View&lt;/A&gt; (didn't know this before today).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Close datatables / reports / windows immediately after you have no need for them.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 20:39:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436155#M68542</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-11-13T20:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: JMP &gt; JSL &gt; Script Acceleration for Multiple Call to Fit Model (N &gt; 2000)?</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436167#M68544</link>
      <description>&lt;P&gt;Hi jthi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Making the Fit Model invisible shaved another 8 seconds (from 61 seconds to 53 seconds), and replacing the "For Each Row" with direct assignments trims another 5 seconds (53 seconds to 48 seconds).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Brilliant!&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 21:49:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-gt-JSL-gt-Script-Acceleration-for-Multiple-Call-to-Fit-Model/m-p/436167#M68544</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-11-13T21:49:12Z</dc:date>
    </item>
  </channel>
</rss>

