<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/863962#M102786</link>
    <description>&lt;P&gt;Thank you Jarmo!!&amp;nbsp; Most appreciated!&lt;/P&gt;</description>
    <pubDate>Tue, 01 Apr 2025 13:14:59 GMT</pubDate>
    <dc:creator>learning_JSL</dc:creator>
    <dc:date>2025-04-01T13:14:59Z</dc:date>
    <item>
      <title>need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854499#M102617</link>
      <description>&lt;P&gt;My code is not working and I'm having trouble identifying why.&amp;nbsp; Any help would be most appreciated - thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open("C:\Users\trcampbell\Desktop\MASTER ECOLI\2025\2024.xlsx");

&amp;nbsp;
obj = Fit model(
Y( :LOGECOLI ),
Effects( :LOGTURB),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(:LOGECOLI )) ;
&amp;nbsp; &amp;nbsp;&amp;nbsp;
// Extract slope and intercept
reportObj = obj &amp;lt;&amp;lt; Report;
paramTable = reportObj( "Parameter Estimates" );
&amp;nbsp;
// Extract values from Parameter Estimates table
intercept = paramTable[estimate(1)];&amp;nbsp; //1st column
slope = paramTable[estimate(2)];&amp;nbsp; //2nd column&amp;nbsp; &amp;nbsp;&amp;nbsp;
&amp;nbsp;
// Create a new data table to store the results
results = New Table( "Fit Results",
&amp;nbsp; &amp;nbsp; Add Column( "Parameter", Character, Set Values( {"Slope", "Intercept"} ) ),
&amp;nbsp; &amp;nbsp; Add Column( "Value", Numeric, Set Values( {slope, intercept} ) )
);
&amp;nbsp;
// Save the results to an Excel spreadsheet
results &amp;lt;&amp;lt; Export( "C:\\Users\\trcampbell\\Desktop\\MASTER ECOLI\\2025\\validation results\\test xxx.xlsx");&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:33:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854499#M102617</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2025-03-25T15:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854524#M102620</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/31342"&gt;@learning_JSL&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've altered your script to take advantage of the 'make into data table' function to bring the details over, but I've also added where your challenges with the script were by changing the paramtable to target the specific estimates section of the table - if you want to find how to do this it's best to right click&amp;gt;properties and highlight the estimates section to find the path to the object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've used the sample data folder here just to test that it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=Open("$SAMPLE_DATA/Tablet Production.jmp");
obj = Fit model(
Y( :Dissolution ),
Effects( :Mill Time),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(:Dissolution )) ;
    
// Extract slope and intercept
reportObj = obj &amp;lt;&amp;lt; Report;
paramTable = ReportObj["Response Dissolution","Whole Model","Parameter Estimates",TableBox(1)]; //Change the report to target the table that needs saving

/*In the old method you had, you could instead make param table this to target the specific estimate column, just change the Y name:
paramTable = reportObj["Response Dissolution","Whole Model","Parameter Estimates",NumberColBox("Estimate")];*/
// Extract values from Parameter Estimates table
/*intercept = paramTable[1];  //1st column - grab the first item [corrected from what you had]
slope = paramTable[2];  //2nd column - grab the second item*/

dtnew=paramTable&amp;lt;&amp;lt;make into data table;
 

 
// Save the results to an Excel spreadsheet as you have
dtnew &amp;lt;&amp;lt; Export( "C:\\Users\\trcampbell\\Desktop\\MASTER ECOLI\\2025\\validation results\\test xxx.xlsx"); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:44:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854524#M102620</guid>
      <dc:creator>Ben_BarrIngh</dc:creator>
      <dc:date>2025-03-25T15:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854583#M102622</link>
      <description>&lt;P&gt;Thanks Ben.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting this error:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="learning_JSL_0-1742919193908.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74237i68685BD98FACABE6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="learning_JSL_0-1742919193908.png" alt="learning_JSL_0-1742919193908.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 16:13:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854583#M102622</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2025-03-25T16:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854634#M102626</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The same code works for me&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=Open("$SAMPLE_DATA/Tablet Production.jmp");
obj = Fit model(Y( :Dissolution ),Effects( :Mill Time),Personality( "Standard Least Squares" ),Emphasis( "Effect Leverage" ),Run(:Dissolution )) ;

rpt=obj&amp;lt;&amp;lt;report;
rpt["Response Dissolution", "Whole Model", "Parameter Estimates", Table Box( 1 )] &amp;lt;&amp;lt; Make Into Data Table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It could be that you're using an older version of JMP?&lt;BR /&gt;maybe try using a different platform&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fit y by X&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
rpt = New Window( "Tablet Production - Fit Y by X of Dissolution by Mill Time",
	Data Table( "Tablet Production.jmp" ) &amp;lt;&amp;lt;
	Bivariate(Y( :Dissolution ),X( :Mill Time ),
	Fit Line( {Line Color( {230, 159, 0} )} )
	)
);

rpt["Bivariate Fit of Dissolution By Mill Time", "Linear Fit", "Parameter Estimates",
Table Box( 1 )] &amp;lt;&amp;lt; Make Into Data Table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or this one&lt;BR /&gt;Fit Curve&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
rpt = New Window( "Tablet Production - Fit Curve of Dissolution by Mill Time",
	Data Table( "Tablet Production.jmp" ) &amp;lt;&amp;lt;
	Fit Curve( Y( :Dissolution ), X( :Mill Time ), Fit Linear ));

rpt["Fit Curve", "Linear", "Parameter Estimates", Table Box( 1 )] &amp;lt;&amp;lt;
Make Into Data Table;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 17:40:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854634#M102626</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2025-03-25T17:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854729#M102630</link>
      <description>&lt;P&gt;One small change I would consider doing when looking for the reference, is to drop the column name from the first outline box reference ("Dissolution" in this case) as it makes it more robust. You could either ignore that outline box or you could use wildcard "?" in place of the column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Drug.jmp");

fm = dt &amp;lt;&amp;lt; Fit Model(
	Y(:y),
	Effects(:Drug, :x),
	Personality(Standard Least Squares),
	Run Model()
);

rep = Report(fm);

// tb_param_estimates1 = rep["Whole Model", "Parameter Estimates", TableBox(1)];
tb_param_estimates2 = rep["Response ?", "Whole Model", "Parameter Estimates", TableBox(1)];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Usually I also add those outlineboxes there, but its a preference&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rep[OutlineBox("Response ?"), OutlineBox("Whole Model"), OutlineBox("Parameter Estimates"), TableBox(1)];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Mar 2025 19:57:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/854729#M102630</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-03-25T19:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/863961#M102785</link>
      <description>&lt;P&gt;Thanks so much!&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 13:14:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/863961#M102785</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2025-04-01T13:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract slope and intercept from parameter estimates table in a linear least squares model fit and save to a file</title>
      <link>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/863962#M102786</link>
      <description>&lt;P&gt;Thank you Jarmo!!&amp;nbsp; Most appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 13:14:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/need-to-extract-slope-and-intercept-from-parameter-estimates/m-p/863962#M102786</guid>
      <dc:creator>learning_JSL</dc:creator>
      <dc:date>2025-04-01T13:14:59Z</dc:date>
    </item>
  </channel>
</rss>

