ANN: LOWESS fitting (python wrapper)
ialbert at mailblocks.com
Fri Sep 10 20:53:59 CEST 2004
I have recently needed to use lowess fitting in a project. I ended
up using the C code from R by wrapping it as a python module.
If you need such things have a look here:
Windows binaries for python 2.3 are included in the library.
In the meantime I found out that biopython has a lowess call,
but that depends on Numeric. (It also does not seem to work
properly. As far as I could tell, it was not returning correct
-------------- README ------------------
Lowess fitting for python, version 0.5
Lowess stands for "locally weighted regression". For more
This module is a python wrapper around the lowess C code used
in the R project. It exposes a single function used as:
ys = lowess.fit(x=X, y=Y, F=F, NSTEPS=NSTEPS, DELTA=DELTA)
that computes the smooth scatterplot of Y against X
using robust locally weighted regression. The function
returns the fitted values, computed at each of the
values of the horizontal axis in X. Parameter description:
X = abscissas of the points on the scatterplot;
VERY IMPORTANT: the values in X must be ordered
from smallest to largest!
Y = ordinates of the points on the scatterplot.
F = specifies the amount of smoothing; F is
the fraction of points used to compute each
fitted value; as F increases the smoothed values
become smoother; choosing F in the range .2 to
idea which value to use, try F = .5.
NSTEPS = the number of iterations in the robust
fit; if NSTEPS = 0, the nonrobust fit is
returned; setting NSTEPS equal to 2 should serve
DELTA = nonnegative parameter which may be used
to save computations. If let to the default value of
'None' DELTA will be esstmated as (max(X)-min(X))/50
For more information on the parameters see the
On unix platforms SWIG is required. Type
python setup.py build
python setup.py install
On windows platforms copy the two files located in
the win32 directory to your python path, usually to the
Run the runme.py file.
GNU GPL as required by the R project: http://www.r-project.org/
More information about the Python-list