<?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 Slope and Intercept calculations in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55307#M31279</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7174"&gt;@Milo&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This is in reference to a discussion - &lt;A href="https://community.jmp.com/t5/Discussions/Slope-and-intercept-functions/m-p/37883" target="_blank"&gt;Slope and intercept functions&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have found this discussion to be helpful. I am currently using JMP 13, so if there are developments made in JMP 14, I dont necessarily have access to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; But, here are my questions:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Log() ; Clear Globals(); Close All(DataTables,"No Save");  

Slope = function({x,y},{default local},
				If( !(Is Matrix( x ) &amp;amp; Is Matrix( y ) &amp;amp; N Col( x ) == 1 &amp;amp; N Col( y ) == 1),
					Show( "x or y arguments are not matrices or they have more than one column" );
					Throw();
					,
					x = J( N Row( x ), 1 ) || x; // put in an intercept column of 1s 
					beta = Inv( X` * X ) * X` * Y; // the least square estimates 
					beta[2];
				  );
				); 
				
Intercept = function({x,y},{default local},
					 If( !(Is Matrix( x ) &amp;amp; Is Matrix( y ) &amp;amp; N Col( x ) == 1 &amp;amp; N Col( y ) == 1),
						Show( "x or y arguments are not matrices or they have more than one column" );
						Throw();
						,
						x = J( N Row( x ), 1 ) || x; // put in an intercept column of 1s 
						beta = Inv( X` * X ) * X` * Y; // the least square estimates 
						beta[1];
					   );
					); // end of intercept function 

x1 = 0.05417099; 
x2 = 0.057730865; 
y1 = 30.5885; 
y2 = 31.5885; 

dt = New Table(); 
dt &amp;lt;&amp;lt; New Column("X",Numeric,Continuous,&amp;lt;&amp;lt; Set Values({x1,x2}))
   &amp;lt;&amp;lt; New Column("Y",Numeric,Continuous,&amp;lt;&amp;lt; Set Values({y1,y2}));
   
dt &amp;lt;&amp;lt; New Script("Biv",Bivariate( Y( :Y ), X( :X ), Fit Line( {Line Color( {213, 72, 87} )} ) ));
 
SlopeTest = Slope(Matrix({y1,y2}),Matrix({x1,x2})); 
Show(SlopeTest);
InterceptTest = Intercept(Matrix({y1,y2}),Matrix({x1,x2})); 
Show(InterceptTest);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 1. Why do the slope and intercept not match for the test case that I have taken w.r.t bivariate ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2. If the function or its implementation have a bug, would you be kind enough to offer an alternative ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 21 Apr 2018 12:31:01 GMT</pubDate>
    <dc:creator>uday_guntupalli</dc:creator>
    <dc:date>2018-04-21T12:31:01Z</dc:date>
    <item>
      <title>Slope and Intercept calculations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55307#M31279</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7174"&gt;@Milo&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This is in reference to a discussion - &lt;A href="https://community.jmp.com/t5/Discussions/Slope-and-intercept-functions/m-p/37883" target="_blank"&gt;Slope and intercept functions&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have found this discussion to be helpful. I am currently using JMP 13, so if there are developments made in JMP 14, I dont necessarily have access to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; But, here are my questions:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Log() ; Clear Globals(); Close All(DataTables,"No Save");  

Slope = function({x,y},{default local},
				If( !(Is Matrix( x ) &amp;amp; Is Matrix( y ) &amp;amp; N Col( x ) == 1 &amp;amp; N Col( y ) == 1),
					Show( "x or y arguments are not matrices or they have more than one column" );
					Throw();
					,
					x = J( N Row( x ), 1 ) || x; // put in an intercept column of 1s 
					beta = Inv( X` * X ) * X` * Y; // the least square estimates 
					beta[2];
				  );
				); 
				
Intercept = function({x,y},{default local},
					 If( !(Is Matrix( x ) &amp;amp; Is Matrix( y ) &amp;amp; N Col( x ) == 1 &amp;amp; N Col( y ) == 1),
						Show( "x or y arguments are not matrices or they have more than one column" );
						Throw();
						,
						x = J( N Row( x ), 1 ) || x; // put in an intercept column of 1s 
						beta = Inv( X` * X ) * X` * Y; // the least square estimates 
						beta[1];
					   );
					); // end of intercept function 

x1 = 0.05417099; 
x2 = 0.057730865; 
y1 = 30.5885; 
y2 = 31.5885; 

dt = New Table(); 
dt &amp;lt;&amp;lt; New Column("X",Numeric,Continuous,&amp;lt;&amp;lt; Set Values({x1,x2}))
   &amp;lt;&amp;lt; New Column("Y",Numeric,Continuous,&amp;lt;&amp;lt; Set Values({y1,y2}));
   
dt &amp;lt;&amp;lt; New Script("Biv",Bivariate( Y( :Y ), X( :X ), Fit Line( {Line Color( {213, 72, 87} )} ) ));
 
SlopeTest = Slope(Matrix({y1,y2}),Matrix({x1,x2})); 
Show(SlopeTest);
InterceptTest = Intercept(Matrix({y1,y2}),Matrix({x1,x2})); 
Show(InterceptTest);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 1. Why do the slope and intercept not match for the test case that I have taken w.r.t bivariate ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2. If the function or its implementation have a bug, would you be kind enough to offer an alternative ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Apr 2018 12:31:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55307#M31279</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-04-21T12:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept calculations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55309#M31281</link>
      <description>&lt;P&gt;You got the arguments backward for the Slope and Intercept function.&amp;nbsp; Just reverse the order of the matrices.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 18:30:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55309#M31281</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-04-20T18:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept calculations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55312#M31283</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/8582"&gt;@cwillden&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;While that&amp;nbsp;was a good catch, that did not change the results and the function doesn't match up to bivariate&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 832px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10454iEB140EF8FE49FCEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 18:35:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55312#M31283</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-04-20T18:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept calculations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55314#M31284</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6696"&gt;@uday_guntupalli&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You still got the arguments reversed.&amp;nbsp; See the screenshot:&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="slope_int.PNG" style="width: 572px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10455i79E47F76D16F7F95/image-size/large?v=v2&amp;amp;px=999" role="button" title="slope_int.PNG" alt="slope_int.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 18:59:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55314#M31284</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-04-20T18:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept calculations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55315#M31285</link>
      <description>&lt;P&gt;The order of your inputs are backwards.&amp;nbsp; On the function it goes slope(x, y) and when you call you're doing slope(y, x)&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 19:00:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Slope-and-Intercept-calculations-in-JSL/m-p/55315#M31285</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2018-04-20T19:00:37Z</dc:date>
    </item>
  </channel>
</rss>

