locally weighted least square regresion

4 Ansichten (letzte 30 Tage)
Fahime Sokhangou
Fahime Sokhangou am 3 Aug. 2022
Bearbeitet: Fahime Sokhangou am 3 Aug. 2022
Dear all
I have a curve that I would like to apply locally weighted polynominal regresion on them. I do not how how define the span and the weight for this type of regresion.
Thanks for your help in advance

Antworten (1)

KSSV
KSSV am 3 Aug. 2022
t = linspace(0,2*pi) ;
y = sin(t) ;
p = polyfit(t,y,3) ;
xi = linspace(t(1),t(end)) ;
yi = polyval(p,xi) ;
plot(t,y,'r',xi,yi,'.b')
  3 Kommentare
KSSV
KSSV am 3 Aug. 2022
Least square regression:
A*x = b ; % A is m*n matrix, b is column matrix m*1
x = A\b ; % solve for unknow x
Weighted least square regression:
W = diag(W); % where W is column matrix of weights
x = (W*A)\(w.*y);
Fahime Sokhangou
Fahime Sokhangou am 3 Aug. 2022
Bearbeitet: Fahime Sokhangou am 3 Aug. 2022
@KSSV thank you so much. so you mean that if I have curve with 68 points and I want to do local regresion smoothing with polynominal for this curve, I should define the weight myself and put them in the matrix. But in the paper that I am following, it is written 10 persent of data points and I do not know how to consider this span?
I do not know how to define the span...
also they used following weight function.
should I have (10%*68 points=7 weights) for each point?
I found the following link very helpful.
https://www.mathworks.com/matlabcentral/fileexchange/55407-loess-regression-smoothing?s_tid=srchtitle
Thanks in advance

Melden Sie sich an, um zu kommentieren.

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!

Translated by