Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Segmented regression

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 8, 2012 5:34 PM
(1404 views)

3 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 9, 2012 2:11 AM
(669 views)

If it's a simple broken stick relationship, you could do something like this:

// Create a broken stick relationship with some noise;

x = **[** **1**, **2**, **3**, **4**, **5**, **6**, **7**, **8**, **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 = expr**(**a + b*x + c***(**x-d**)**:***(**x>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**}**, << tolerance**(****1e-5))**;

print**(**"Final estimates:"**)**;

show**(**a, b, c, d**)**;

show**(**eval**(**expr_FX**))**;

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. The break point will be parameter d, as that's the x value at which the slope of the line changes. Note that when you multiply the two matrices (x-d) and (x>d) together, you'll need the element-wise product :* as opposed to a simple multiplication. You'll also probably need a relatively good starting value for the break point for the expression to converge. In this example, all the output is written to the log.

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. Does that help at all?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 9, 2012 6:48 AM
(669 views)

As Dodo suggests, piecewise regression can be done with the Nonlinear platform. Below is an example based on the broken-stick example above.

New Table**(** "piecewise",

Add Rows**(** **20** **)**,

New Column**(** "X",

Continuous,

Set Values**(** **[****1**, **2**, **3**, **4**, **5**, **6**, **7**, **8**, **9**, **10**, **11**, **12**, **13**, **14**, **15**, **16**, **17**, **18**, **19**, **20****]** **)**

**)**,

New Column**(** "Y",

Numeric,

Set Values**(** **[****15**, **12**, **27**, **31**, **26**, **31**, **42**, **47**, **56**, **56**, **47**, **46**, **36**, **44**, **38**, **35**, **34**, **35**, **25**, **19****]** **)**

**)**,

New Column**(** "Ypred",

Numeric,

Formula**(** Parameter**(** **{**a = **20**, b = **1**, c = -**10**, d = **10****}**, a + b * :X + c * **(**:X - d**)** * **(**:X > d**)** **)** **)**

**)**

**)**;

Nonlinear**(** Y**(** :Y **)**, X**(** :Ypred **)**, Newton, Finish **)**;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 15, 2012 8:22 PM
(669 views)