<?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: loop through column names and do bivariate fitting with certain ones and output slope and R squared value in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251883#M49462</link>
    <description>&lt;P&gt;Did this solution help you?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Mar 2020 21:14:15 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2020-03-11T21:14:15Z</dc:date>
    <item>
      <title>loop through column names and do bivariate fitting with certain ones and output slope and R squared value</title>
      <link>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251633#M49405</link>
      <description>&lt;P&gt;Relevant post is here,&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-to-group-by-and-get-slopes-in-a-JSL-fit-model-script/m-p/251632#M49404" target="_blank"&gt;https://community.jmp.com/t5/Discussions/How-to-group-by-and-get-slopes-in-a-JSL-fit-model-script/m-p/251632#M49404&lt;/A&gt;&lt;BR /&gt;I have many columns and do not want to include some of them to the analysis. So I need to loop through the column names and pick the ones I need and do bivariate fitting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So by following the solution on above post&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Fishing.jmp");


colList = dt &amp;lt;&amp;lt; get column names( string );

For( i = 1, i &amp;lt;= N Items( colList ), i++,
	If( ! Contains( colList[i], "Validation") &amp;amp; ! Contains( colList[i], "People") ,
	
	biv = Bivariate(invisible,
	Y( :Fish Caught ),
	X( :i),
	Fit Line( {Line Color( "Medium Dark Red" )} ),
	By( :Validation )
))
	
	dtR2 = report(biv[1])["Summary of Fit"][tablebox(1)]&amp;lt;&amp;lt; make combined data table;

dtR2 = report(biv[1])["Summary of Fit"][tablebox(1)]&amp;lt;&amp;lt; make combined data table;
dtSlope = report(biv[1])["Parameter Estimates"][tablebox(1)]&amp;lt;&amp;lt; make combined data table (invisible);
dtR2 &amp;lt;&amp;lt; select where(:Column 1 != "RSquare");
dtR2 &amp;lt;&amp;lt; delete rows;
dtR2:Column 2 &amp;lt;&amp;lt; set name("RSquare");
dtR2 &amp;lt;&amp;lt; delete Columns({"Validation 2","Column 1"});	

dtSlope &amp;lt;&amp;lt; select where(:Term == "Intercept");
dtSlope &amp;lt;&amp;lt; delete rows;
dtSlope:Estimate &amp;lt;&amp;lt; set name( "Slope");
dtSlope &amp;lt;&amp;lt; delete columns({"Validation 2","Term","~Bias","Std Error","t Ratio","Prob&amp;gt;|t|"});

// Put the data together
dtR2 &amp;lt;&amp;lt; Update(
	With( dtSlope ),
	Match Columns( :Validation = :Validation, :X = :X, :Y = :Y )
);

// Clean up the items not needed
close(dtSlope, nosave);
window("Fishing - Bivariate of Fish Caught") &amp;lt;&amp;lt; close window;
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but it seems that I'm not sure how to implement this correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 18:06:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251633#M49405</guid>
      <dc:creator>joshua</dc:creator>
      <dc:date>2020-03-10T18:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: loop through column names and do bivariate fitting with certain ones and output slope and R squared value</title>
      <link>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251641#M49406</link>
      <description>&lt;P&gt;Can somebody from Jmp staff help me with this problem ?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 19:54:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251641#M49406</guid>
      <dc:creator>joshua</dc:creator>
      <dc:date>2020-03-10T19:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: loop through column names and do bivariate fitting with certain ones and output slope and R squared value</title>
      <link>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251666#M49416</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Fishing.jmp" );

col = dt &amp;lt;&amp;lt; Get Column Names( Numeric, String );

For( c = N Items( col ), c &amp;gt; 0 , c--,
	If( col[c] == "Fish Caught", Remove From( col, c ) );
	If( col[c] == "Validation", Remove From( col, c ) );
	If( col[c] == "People", Remove From( col, c ) );
);

biv = dt &amp;lt;&amp;lt; Bivariate(
	Y( :Fish Caught ),
	X( Eval( col ) ),
	By( :Validation ),
	Fit Line
);

biv rep = biv &amp;lt;&amp;lt; Report;

summary dt = biv rep[1]["Summary of Fit"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;
parameter dt = biv rep[1]["Parameter Estimates"][TableBox(1)] &amp;lt;&amp;lt; Make Combined Data Table;

Wait( 0 );

biv &amp;lt;&amp;lt; Close Window;

Column( summary dt, 6 ) &amp;lt;&amp;lt; Set Name( "RSquare" );
summary dt
	&amp;lt;&amp;lt; Select Where( Contains( :Column 1[], "RSquare" ) &amp;amp; Not( Contains( :Column 1[], "Adj" ) ) )
	&amp;lt;&amp;lt; Invert Row Selection
	&amp;lt;&amp;lt; Delete Rows
	&amp;lt;&amp;lt; Delete Columns( { "Y", "Validation 2", "Column 1" } );

Column( parameter dt, 7 ) &amp;lt;&amp;lt; Set Name( "Slope" );
parameter dt
	&amp;lt;&amp;lt; Select Where( Contains( :Term[], "Intercept" ) )
	&amp;lt;&amp;lt; Delete Rows
	&amp;lt;&amp;lt; Delete Columns( { "Y", "Validation 2", "Term", "~Bias", "Std Error", "t Ratio", "Prob&amp;gt;|t|" } );

summary dt &amp;lt;&amp;lt; Join(
	With(parameter dt ),
	Select( :Validation, :X, :RSquare ),
	SelectWith( :Slope ),
	By Row Number
);

Close( summary dt, No Save );
Close( parameter dt, No Save );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Mar 2020 21:29:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251666#M49416</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-03-10T21:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: loop through column names and do bivariate fitting with certain ones and output slope and R squared value</title>
      <link>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251883#M49462</link>
      <description>&lt;P&gt;Did this solution help you?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 21:14:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/251883#M49462</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-03-11T21:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: loop through column names and do bivariate fitting with certain ones and output slope and R squared value</title>
      <link>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/252123#M49494</link>
      <description>yes mark, Sorry for delay:)</description>
      <pubDate>Thu, 12 Mar 2020 19:02:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/loop-through-column-names-and-do-bivariate-fitting-with-certain/m-p/252123#M49494</guid>
      <dc:creator>joshua</dc:creator>
      <dc:date>2020-03-12T19:02:55Z</dc:date>
    </item>
  </channel>
</rss>

