locally weighted least square regresion

4 次查看(过去 30 天)
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

回答(1 个)

KSSV
KSSV 2022-8-3
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 个评论
KSSV
KSSV 2022-8-3
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 2022-8-3
编辑:Fahime Sokhangou 2022-8-3
@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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by