<?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 Segmented regression in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5750#M5749</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know how to perform a segmented regression and calculate the breakpoint (where the 2 lines meet) on JMP?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Oct 2012 00:34:07 GMT</pubDate>
    <dc:creator>phystudent</dc:creator>
    <dc:date>2012-10-09T00:34:07Z</dc:date>
    <item>
      <title>Segmented regression</title>
      <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5750#M5749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know how to perform a segmented regression and calculate the breakpoint (where the 2 lines meet) on JMP?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 00:34:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5750#M5749</guid>
      <dc:creator>phystudent</dc:creator>
      <dc:date>2012-10-09T00:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Segmented regression</title>
      <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5751#M5750</link>
      <description>&lt;P&gt;If it's a simple broken stick relationship, you could do something like this:&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;// Create a broken stick relationship with some noise;

x = [ 1,&amp;nbsp; 2,&amp;nbsp; 3,&amp;nbsp; 4,&amp;nbsp; 5,&amp;nbsp; 6,&amp;nbsp; 7,&amp;nbsp; 8,&amp;nbsp; 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
y = [15, 12, 27, 31, 26, 31, 42, 47, 56, 56, 47, 46, 36, 44, 38, 35, 34, 35, 25, 19];

expr_FX&amp;nbsp; = expr(a + b*x + c*(x-d):*(x&amp;gt;d));
expr_SSE = expr(sum((y-expr_FX)^2));

// Supply a set of starting values;
a = 20; b = 1; c = -10; d = 15;
print("Starting values:");
show(a, b, c, d);

sse = minimize(expr_SSE, {a, b, c, d}, &amp;lt;&amp;lt; tolerance(1e-5));
print("Final estimates:");
show(a, b, c, d);
show(eval(expr_FX));&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;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I've based the above on the Least Squares Example in the JMP 10 Manual, Chapter 8, substituting a broken stick relationship in the expression for the exponential model in the example.&amp;nbsp; The break point will be parameter d, as that's the x value at which the slope of the line changes.&amp;nbsp; Note that when you multiply the two matrices (x-d) and (x&amp;gt;d) together, you'll need the element-wise product :*&lt;/img&gt; as opposed to a simple multiplication.&amp;nbsp; You'll also probably need a relatively good starting value for the break point for the expression to converge.&amp;nbsp; In this example, all the output is written to the log.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Presumably this could also be set up in the nonlinear platform (Analyze | Modeling | Nonlinear), but I haven't tried that yet as I'm not very familiar with using formulae within data tables.&amp;nbsp; Does that help at all?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 13:59:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5751#M5750</guid>
      <dc:creator />
      <dc:date>2019-07-04T13:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Segmented regression</title>
      <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5752#M5751</link>
      <description>&lt;P&gt;As Dodo suggests, piecewise regression can be done with the Nonlinear platform. Below is an example based on the broken-stick example above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; color: #801392;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "piecewise",
&amp;nbsp; Add Rows( 20 ),
&amp;nbsp; New Column( "X",
&amp;nbsp; Continuous,
&amp;nbsp; Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] )
&amp;nbsp; ),
&amp;nbsp; New Column( "Y",
&amp;nbsp; Numeric,
&amp;nbsp; Set Values( [15, 12, 27, 31, 26, 31, 42, 47, 56, 56, 47, 46, 36, 44, 38, 35, 34, 35, 25, 19] )
&amp;nbsp; ),
&amp;nbsp; New Column( "Ypred",
&amp;nbsp; Numeric,
&amp;nbsp; Formula( Parameter( {a = 20, b = 1, c = -10, d = 10}, a + b * :X + c * (:X - d) * (:X &amp;gt; d) ) )
&amp;nbsp; )
);
Nonlinear( Y( :Y ), X( :Ypred ), Newton, Finish );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 13:59:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5752#M5751</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2019-07-04T13:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Segmented regression</title>
      <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5753#M5752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks I will try this out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2012 03:22:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/5753#M5752</guid>
      <dc:creator>phystudent</dc:creator>
      <dc:date>2012-10-16T03:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Segmented regression</title>
      <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/216203#M43190</link>
      <description>&lt;P&gt;I tried this just recently, it makes more sense to me than the Nonlinear platform utility.&amp;nbsp; I'd be interested in understanding how the iteration scheme is converging on my solution?&amp;nbsp; I tried picking a reasonable value of d (the cutpoint) for my data, and it seemed to work better when I "locked" the value of d and re-clicked the "Go" button on the platform dialogue window that is generated from the Nonlinear platform launched using the:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt; Nonlinear( Y( :Y ), X( :Ypred ), Newton, Finish );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;portion of the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy way to change this short script to call a data table instead? (of manually entering in the values for X and Y)?&lt;/P&gt;&lt;P&gt;I'm sure this is a "JSL Novice Question" so I apologize in advance.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I took this in a cloogey way and copy-pasted just the following into my saved datable with Columns, {X, Y, Ypred} and my populated data:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Parameter( {a = 5, b = 45, c = -100, d = 0.109}, a + b * :X + c * (:X - d) * (:X &amp;gt; d) );
 
 Nonlinear( Y( :Y ), X( :Ypred ), Newton, Finish );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and that's how I arrived at my result for my data!&amp;nbsp; Thanks again for this contribution to the community.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 00:20:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/216203#M43190</guid>
      <dc:creator>PatrickGiuliano</dc:creator>
      <dc:date>2019-07-04T00:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Segmented regression</title>
      <link>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/486134#M73014</link>
      <description>&lt;P&gt;For those who have not seen this, here is a potentially useful blog written by my colleague&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/8239"&gt;@JerryFish&lt;/a&gt;&amp;nbsp; on how to construct and manipulate piecewise fitting in JMP (using the Nonlinear platform):&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMP-Blog/Piecewise-Nonlinear-Solutions-Part-3-Using-JMP-s-Formula-Editor/ba-p/424744" target="_blank"&gt;Piecewise Nonlinear Solutions Part 3: Using JMP's Formula Editor to solve for unknown parameters.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I am including this here since it dovetails nicely with this discussion.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 16:57:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Segmented-regression/m-p/486134#M73014</guid>
      <dc:creator>PatrickGiuliano</dc:creator>
      <dc:date>2022-05-11T16:57:01Z</dc:date>
    </item>
  </channel>
</rss>

