Software to extract statistics (per month, per year) from a time series


I work with rain (precipitation) time series, and would like to extract time statistics:
- precipitations per month
- precipitations per year
- precipitations per month and year
- precipitations per hour
- precipitations per month and hour
- mean precipitation, deviation, ...

I can create my own program to do it, but wonder if there is an already-made software to carry out these tasks. It would be great if it could create graphics as well.

Any tip is appreciated. Thank you very much in advance.


TS Contributor
I assume you have daily precipitation data across multiple months and years. There are many options for this, but there's no software that I know of that is specialized for this purpose. I use R for this sort of thing, but your problem is such a straight-forward task that it could be solved with any number of programs.

On a side note, analysis of precipitation data has been a problem for most people. The large majority of studies describing variation in precipitation usually calculate mean precipitation. This is OK for annual measures, but is problematic for data derived from daily or monthly (i.e. small scale) measures of precipitation. This is because precipitation is not normally distributed and is bounded at zero. That is, there can't be negative precipitation. And, most commonly in all environments, precipitation will have a value of 0 (except, say, on Mount Wai-‘ale-‘ale in Hawaii). Yes, there are numerous graphs of precipitation in the scientific literature that show standard error bars dipping below zero. So, my strong advice is to model precipitation using either Poisson or Gamma distributions. In the latter case, you'll need to add a very small adjustment (0.0000001) to the zero values to make the analysis run, since Gamma is positive. At the very least for calculating summary statistics (like you requested), you should use the median rather than the mean value.


Ambassador to the humans
Or you could model it as a mixture of a Gamma and a point mass at 0. Essentially this would be modeling two things - the probability precipitation will occur and the distribution of measured precipitation when precipitation is actually present.


TS Contributor
Good point, Dason. Yes, Dason's approach (aka a "hurdle" model) is especially useful if the precipitation data has more zeroes than expected from a Gamma or Poisson (i.e. zero-inflated). This might be expected in desert environments.

There are several tools in R for mixture models of this sort. There are few, however, for this kind of modeling when you have random effects. That's just something to be aware of.
Thank you very much, guys.

I'm downloading R software and will try to extract statistics and to model it.

Should I try the same Gamma distribution if I'd like to model the flow of a river?


TS Contributor
The flow of the river can definitely be modeled as a Gamma distribution. This, of course, assumes that the river isn't influenced by tides or something (i.e. has zero or negative flow).