[R] Piecewise (segmented) linear regression with center section slope constraint

David Winsemius dwinsemius at comcast.net
Sat Aug 8 08:04:56 CEST 2015


On Aug 7, 2015, at 12:05 PM, Drew Morrison wrote:

> Thanks, Jean. I've actually looked at that source before. The issue is that I
> can't constrain the slope of the /center/ section to be zero - in fact, I've
> applied similar code to a three-segment regression and I can get a zero
> slope either of the two sides, but not in the middle.

If you replaced the values during the interval in question with their mean values during that interval, you should then get a zero slope.

-- 
David.
> 
> Here's a list of the main resources I've consulted so far:
> 
> https://climateecology.wordpress.com/2012/08/19/r-for-ecologists-putting-together-a-piecewise-regression/
> 
> http://www.stackoverflow.dluat.com/questions/30060278/creating-piecewise-linear-regression-with-flat-slope-in-r
> 
> https://rpubs.com/MarkusLoew/12164
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Piecewise-segmented-linear-regression-with-center-section-slope-constraint-tp4710839p4710875.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list