Linear Regression - more weight on specific Bins of data
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (3)
Richard Willey
am 28 Nov. 2011
MathWorks tech support has a solution documenting various options for weighted regression.
From my perspective, robustfit provides the most flexibility.
1 Kommentar
Daniel Shub
am 28 Nov. 2011
I am not sure you can do it easily with polyfit. The cftool and lscov both allow differential weighting.
0 Kommentare
Michael
am 28 Nov. 2011
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!