ANN: LOWESS fitting (python wrapper)

Istvan Albert ialbert at mailblocks.com
Fri Sep 10 14:53:59 EDT 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:

http://www.personal.psu.edu/staff/i/u/iua1/python/dist/

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
values).

cheers,

Istvan.

-------------- README ------------------

Lowess fitting for python, version 0.5
======================================

ABOUT
-----

Lowess stands for "locally weighted regression". For more
information see:

http://www.itl.nist.gov/div898/handbook/pmd/section1/pmd144.htm

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

INSTALLATION
------------

On unix platforms SWIG is required. Type

python setup.py build

then

python setup.py 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.

TESTING
-------

Run the runme.py file.

LICENSE
-------

GNU GPL as required by the R project: http://www.r-project.org/



More information about the Python-list mailing list