Hello to the dear forum.

I'm trying to describe a time-series using multiple linear models.

sample_result.jpg

My initial approach (result shown in the image above) was to slice the data into multiple chunks using a greedy-algorithm that searches for the best r-value (or standard error). In a first glance it yields nice results, but looking more carefully into it, it poorly handles many cases (notably around x=700).

I'm looking for some advice on how to tackle this problem. I reckon the only challenge is the segmentation. I can try non-greedy approaches, perhaps dynamic programming. I also thought about trying to fit an high order polynomial curve, calculate it's derivative and use it's roots as segmentation indices... What do you think?

If anyone wants to try, here's a link to the data: http://pastebin.com/wYGLiHav

Thank you!