フィルターのクリア

Linear Regression - more weight on specific Bins of data

4 ビュー (過去 30 日間)
Hoda
Hoda 2011 年 11 月 28 日
Hi, I am sort of new to Matlab and I need to analyze some data on Matlab. What I need to do is; I have a scatter plot (x, y) and I need to do a linear regression on this data in a way that I have more weight on a specific section (or bins)of my x axis.For example, my x axis is from 0 to 45, and i want to make a linear regression of the data so that I have more weight on data between 15 to 40, and less weight on data points above 40. For this I have to BIN my data points to 5 parts, (1 bin < x<15, 2 bins when x between 15 and 40 , and 1 bin when x is higher than 40). How can I do this easily in Matlab. I used polyfit for the linear regression, but how can I modify it to do such a thing. Thanks alot.

回答 (3 件)

Richard Willey
Richard Willey 2011 年 11 月 28 日
MathWorks tech support has a solution documenting various options for weighted regression.
From my perspective, robustfit provides the most flexibility.
  1 件のコメント
Daniel Shub
Daniel Shub 2011 年 11 月 28 日
+1 nice use of the documentation

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


Daniel Shub
Daniel Shub 2011 年 11 月 28 日
I am not sure you can do it easily with polyfit. The cftool and lscov both allow differential weighting.

Michael
Michael 2011 年 11 月 28 日
lsqnonlin may be a good place to start, rather than giving it your model function and a starting point (eg. lsqcurvefit), you give it a function which returns a vector of the residuals of the fit. This way you have the freedom to multiply these residuals by factors based on their corresponding x coordinate- if a residual is multiplied by two, the minimisation scheme in lsqnonlin should work harder to ensure that this point is close to the final curve.

カテゴリ

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