Fitting data with broekn stick regression

7 ビュー (過去 30 日間)
Wendy Cameron
Wendy Cameron 2018 年 6 月 5 日
コメント済み: John D'Errico 2018 年 6 月 8 日
Hi.
I have some grape ripening data (sugar versus heat degrees) and want to try and fit a broken stick regression to it, and am wondering if this can be done in Matlab.
The data is quite simple e.g.
x=[1644 1669 1697 1720 1792 1909];
y=[11.9 11.6 12.6 13.4 13.9 14.6],
Basically grape ripening seems to follow a linear increase until some point and then flattens off on another trajectory. I'm wondering how I might use segmented or broken stick regression in matlab.

回答 (3 件)

Image Analyst
Image Analyst 2018 年 6 月 6 日
Yes your data is quite simple. In fact TOO simple.
x=[1644 1669 1697 1720 1792 1909];
y=[11.9 11.6 12.6 13.4 13.9 14.6]
plot(x, y, 'bs-', 'LineWidth', 2);
grid on;
title('Sugar versus heat degrees', 'fontSize', fontSize);
ylabel('Sugar', 'fontSize', fontSize);
xlabel('heat degrees', 'fontSize', fontSize);
I don't see how you can expect to get any kind of meaningful regression out of this very tiny simple set of data.
Anyway, why would you want to lines instead of a formula for a more continuous function? What does two linear formulas get you over one single model formula, except for a more complicated model where you have to check your x value first before plugging it into one of two models? Not sure why two formulas are desired/advantageous over one formula. Please explain why.
  11 件のコメント
Wendy Cameron
Wendy Cameron 2018 年 6 月 8 日
Yes, thank you. I'm working on that now with some of my data. It is intuitively correct an my data is simpler so less iterations to try.
Thanks
John D'Errico
John D'Errico 2018 年 6 月 8 日
To reiterate my comment, you simply do not have sufficient information to estimate a broken stick regression, and certainly not to estimate where the breaks occur.

サインインしてコメントする。


Image Analyst
Image Analyst 2018 年 6 月 8 日
編集済み: Image Analyst 2018 年 6 月 8 日
Here's one way to do it. See attached script for demo with noisy data.
Basically I fit lines to the left side and right side and kept track of the slope differences as I varied the point (x value, index) at which the sides were separated. The point where the slope different is greatest is where the lines are most dissimilar and where the crossing occurs.
  2 件のコメント
Wendy Cameron
Wendy Cameron 2018 年 6 月 8 日
Thanks, I just trialled that approach with much simpler data and it seems to work. Also, because this is a biological system, in some weather conditions the sugar increase does not plateau before the fruit is picked so your approach should handle that as well because the lines won't be dissimilar.
Image Analyst
Image Analyst 2018 年 6 月 8 日
Then, is it time to "Accept this answer"? Or is it still not working?

サインインしてコメントする。


JAYANTH BHIMAVARAPU
JAYANTH BHIMAVARAPU 2018 年 6 月 5 日
You can have a look at this solution: Broken-Stick Regression
  1 件のコメント
Wendy Cameron
Wendy Cameron 2018 年 6 月 6 日
Yes I did see that but I really just can't understand it and can't make it work with my data unfortunately.
Wendy

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by