locally weighted least square regresion

조회 수: 4 (최근 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 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