locally weighted least square regresion

6 ビュー (過去 30 日間)
Fahime Sokhangou
Fahime Sokhangou 2022 年 8 月 3 日
編集済み: Fahime Sokhangou 2022 年 8 月 3 日
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 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