[SciPy-User] how to use kendalltau_seasonal

Pierre GM pgmdevlist at gmail.com
Wed Apr 6 08:01:27 EDT 2011


On Apr 6, 2011, at 12:41 PM, Andreas wrote:

> Hi there,
> I'm a bit at a loss how to use scipy.stats.mstats.kendalltau_seasonal.
> The docstring and the online documentation aren't really that helpful
> about what input and output mean ...

<sigh>Somebody was too busy coding to pay attention to doc writing...</sigh></sorry>

Imagine you need to check whether there's a trend in a time series X, but want to take a potential seasonal dependence into account.
Reshape your data so that it's 2D, with seasons as columns, and feed it to the function. You'll get a dictionary giving you the value of Kendall's tau (w/ and w/o the seasonal effects) with the corresponding p-values that should help you figure out without there's a trend in your data and whether seasonality plays a role.
Example:
You have a 60-element array corresponding to 5 years of consecutive monthly data, and want to check the trend, taking potential monthly variations into account. In that case, your "season" is a month. Reshape it as a (5,12), and use the result as input to the function.

More info:
http://pubs.usgs.gov/sir/2005/5275/pdf/sir2005-5275.pdf
Hirsch R.M., Slack J.R. and Smith R.A. (1982), Techniques of Trend Analysis
for Monthly Water Quality Data, Water Resources Research 18(1), 107-12

I'm sure there must be a R equivalent somewhere.
In any case, please do help to document the function as needed. Don't hesitate to contact me if you need more info.
Cheers
P.





More information about the SciPy-User mailing list