ANN: LOWESS fitting (python wrapper)

Istvan Albert ialbert at
Fri Sep 10 20:53:59 CEST 2004

Hello folks,

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
information see:

This module is a python wrapper around the lowess C code used
in the R project. It exposes a single function used as:

import lowess

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
	most purposes.

	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
lowess_readme.txt file.


On unix platforms SWIG is required. Type

python build


python install

On windows platforms copy the two files located in
the win32 directory to your python path, usually to the
c:\Python23\Lib\site-packages directory.


Run the file.


GNU GPL as required by the R project:

More information about the Python-list mailing list