Use Lowess models to fit smooth surfaces to your data. The names “lowess” and “loess” are derived from the term “locally weighted scatter plot smooth,” as both methods use locally weighted linear regression to smooth data. The process is weighted because the toolbox defines a regression weight function for the data points contained within the span. In addition to the regression weight function, the Robust option is a weight function that can make the process resistant to outliers.
In MATLAB, the function for locally weighted linear regression (Loess) is "fit", and it is part of the Statistics and Machine Learning Toolbox. Here is an example of how to use the function to fit a Loess model:
In Python, the package statsmodels has a similar function for Loess called "lowess" in the module statsmodels.nonparametric.smoothers_lowess. Here is an example of how to use the function to fit a Loess model:
from statsmodels.nonparametric.smoothers_lowess import lowess
Abderrahmane Boudribila thanks for your answer, I would like to define the weight by tricube function, But in the lowess (the one that you mentioned), we should define the weights ourselves!
Then after doing LOWESS, my goal is to calculate the studentized residual.