[SciPy-user] TimeSeries - Questions Re lib/moving_funcs.py

pablo mitchell pablo_mitchell@yahoo....
Tue Dec 4 22:25:17 CST 2007


I have comments/questions regarding this module:

* Why do the comments in the source code indicate that many of the functions are intended only for 1-D arrays (mov_var for example)?  

A very brief look at the source doesn't indicate why this should be.  Also, throwing some quick example code together suing 2-D arrays generates results.  The code does not seem to bomb.  

* The covariance related code is constructed in a way I would not expect.

Specifically, most of the functionality appear as facade functions fed into _mov_var_stddev.  This seems to be a multi-purpose function in the module.  Wouldn't it be more natural to define a general covariance function (ignoring bias or span) with pseudo-code:

cov(x,y) = [x - ave(x)]*[y - ave(y)]/n


The rest of the functions fall out of this like:

var(x) = cov(x,x)
stddev(x) = sqrt[var(x)]
corr(x,y) = cov(x,y)/stddev(x)/stddev(y)


Then add-ons like regression coefficients and zscores become trivial.

* This is a really nice package!  Look forward to seeing it grow.





      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071204/aaf74fe3/attachment.html 


More information about the SciPy-user mailing list