LOWESS- Locally Weighted Scatterplot
Smoothing
Table of Contents
Modifications: ............................................................................................................1
Description ................................................................................................................ 2
Primary Function: lowess .............................................................................................3
Generate predicted XY data ..........................................................................................5
Modification of check for ten or more non-zero weights .....................................................6
Weighted least squares .................................................................................................6
Plotting of data and lowess regression line .......................................................................6
Modifications:
This regression will work on linear and non-linear relationships between X and Y.
12/19/2008 - added upper and lower LOWESS smooths. These additional
smooths show how the distribution of Y varies with X. These smooths
are simply LOWESS applied to the positive and negative residuals
separately, then added to the original lowess of the data. The same
smoothing factor is applied to both the upper and lower limits.
2/21/2009 - added sorting to the function, data no longer need to be
sorted. Also added a routine such that if a user also supplies a
second dataset, linear interpolations are done one the lowess and used
to predict y-values for the supplied x-values.
10/22/2009 - modified the second user provided X-data for obtaining
predictions. Matlab function unique sorts by default. It really was
not needed in the section of code to perform linear interpolations of
the x-data using the y-predicted LOWESS results. If the user does not
supply a second x-data set, it will assume to use the supplied x-y
data set. Thus there is an output (xy) that maintains the original
sequence of the input. Additionally, the user can now include a
sequence index as the first column of input data. This can be a
datenum or some other ordering index. The output will be sequenced
using that index. If a sequence index is provided a second subplot
will be created show the predicted Y-values in the order of the
included sequence index. I suspect this sequence index most often will
be a DateTime (i.e. datenum). Just to the function generic enough,
the X-axis labels are not converted to a nice date format, but the
user could easily change that with a datetic attribute in the subplot.
11/3/2009 - modified charting to include upper and lower line plots on
the simulated subplot (i.e. the lower plot).
An example dataset (skl1a.mat) is also included in the ZIP file for
convenience.
1