Re: [R] Identify period length of time series automatically?

From: Rainer M Krug <>
Date: Thu, 14 Apr 2011 12:42:28 +0200

Hash: SHA1

On 14/04/11 11:57, Mike Marchywka wrote:
> ----------------------------------------

>> Date: Thu, 14 Apr 2011 11:29:23 +0200
>> From:
>> To:
>> Subject: [R] Identify period length of time series automatically?
>> Hash: SHA1
>> Hi
>> I have 10.000 simulations for a sensitivity analysis. I have done a few
>> sensitivity analysis for different response variables already,
>> but now, as most of the simulations (if not all) show some cyclic
>> behaviour, see how the independent input parameter influence the
>> frequency of the cyclic changes and "how cyclic" they actually are.
>> So effectively, I have 39 values, and I want to identify automatically
>> the frequency / period length of the series and a kind of a measure on
>> "how cyclic" the series is.

Hi Mike,

thanks for your answer - it confirms my fears ...

> Probably google "Digital Signal Processing" or Fourier transform.
> From this, you resolve your time series into sinusoids of various components

> and you can separate peaks in line spectra from background noise.
> Depending on what you consider to be "cyclic" the analysis details
> will vary. If you look at things like amplitude and frequncy modulation
> of one sine wave with another and various relationships between carrier and
> modulation frequency, you can get some ideas of what to look for in spectra.

That is what I thought as well. As I have no idea about fourier analysis, could you give me a small example in R, which gives me the frequencies of the resulting sin waves after a fourier transformation? I only see large matrices as return values when using e.g. fft().

> Alternatively, you can try to define exactly what you mean by "cyclic"
> and maybe make a better transform that discriminates that from acyclic
> but offhand I would suggest FFT and various tests on the spectra.

the shape of the fluctuations can be quite different - so no common pattern there.

> Just off hand I'm not sure that 39 points would be a lot to go on
> but you can simulate some examples in R quite easily if you know
> what the data looks like in various cases you think may exist.

Well - the data is over a year summed up data from daily data points, so I could easily go to daily data, which would be 365*39. But that would make the analysis probably more difficult, as I have seasonal fluctuations, and fluctuations over several years (1, 2, 3, 4, ...?; depending on the parameters used for the simulation).

Any ideas on how to do this in R?

I have the feeling, that the quesion id more difficult then I thought...



>> How can I do that automatically without individual checking? I do not
>> want to do an eyeball assessment for 10.000 time series....
>> Thanks,
>> Rainer
>> - --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>> Centre of Excellence for Invasion Biology
>> Stellenbosch University
>> South Africa


Centre of Excellence for Invasion Biology Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44


Skype: RMkrug
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -

iEYEARECAAYFAk2mz5QACgkQoYgNqgF2egqZ8QCfZrtSmYczWo+Gq9NgY25mtP5Q LHwAn3qaWKoo2wkc4pjTe9skZhcW7UL+
-----END PGP SIGNATURE----- mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 14 Apr 2011 - 10:45:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Apr 2011 - 11:00:30 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive