[SciPy-user] fill a timeseries with masked data by correlation from another series

Pierre GM pgmdevlist@gmail....
Thu Apr 3 18:21:13 CDT 2008

On Thursday 03 April 2008 18:52:26 Marco Tuckner wrote:
> Is it also possible to perform mathematical and statistical operations on
> two or more timeseries with same frequencies?

Mmh, that'll depend on what you want to do. More specific questions would be 
better answered... As long as a function works with MaskedArrays, it should 
work with TimeSeries.

> I would like to correlate two (or more timeseries) to estimate invalid and
> masked values in one series based on the values of another complete series
> using the correlation coefficient.
> How can I to that?
> I tried this without successs:
> ### CODE ###
> In [22]: scipy.stats.corrcoef(series,modseries)

scipy.stats.corrcoef doesn't accept masked arrays. More exactly, it transforms 
a masked array into a regular ndarray, therefore losing the mask. Most of the 
functions of scipy.stats work that way. I'm currently rewriting (most of) 
them to support masked array, hopefully I'll be able to post something in the 
next few days. Where should I post them ? In scipy.stats.mstats ? In 
numpy.ma ?

> Furthermore I like to calculate other tests like t-test, chi-test,
> Kolmogorov-Smirnof on the two sets and get distribution parameters (RMSE,
> MBE, STD) for each series.
> How can this be done?

For the basic statistical tests in scipy.stats, see above.
For STD, you can use the std method
For RMSE, you could try to sum the squares of the anomalies
For MBE, you're losing me: Member of the British Empire

More information about the SciPy-user mailing list