Nature is full of cycles. Temperature tends to rise during daytime and fall at night, and to rise during summer and fall in winter. During ice ages, glaciers advance, retreat, advance, retreat again. Sunspots increase and decrease in a roughly 11-year repeating pattern. Even the stars can pulse, showing repeated brightenings and dimmings with repetition periods ranging from mere minutes to years.
One of the best ways to detect and study cycles is Fourier analysis, the brainchild of French mathematician Jean Baptiste Joseph Fourier. It’s based on the idea of matching our observed data to a particular type of cycle, the sinusoid. You can generate a sinusoid by attaching a peg to the outer part of a wheel and spinning the wheel at a regular rate. If you measure the height of the peg as a function of time, it will follow a sinusoidal pattern:
If you spin the wheel faster, the peg will go up and down faster:
The speed at which the peg (or whatever we’re measuring) goes up and down can be expressed as the frequency of the oscillation. Frequency is the number of cycles in a given unit of time. If we note 10 full cycles every second, the frequency is 10 cycles/second. Some phenomena have rather obvious frequencies; the seasonal cycle has a frequency of 1 cycle/year.
The period of a cycle is how long it takes to undergo one full cycle. Frequency and period are related by the simple formula (period)x(frequency)=1. So, (period)=1/(frequency) and (frequency)=1/(period). If our wheel is spinning with a frequency of 10 cycles/second, then the period is 1/10th of a second. The seasons have a frequency of 1 cycle/year, so the period is simply 1 year.
Another aspect of cyclic phenomena is the size of the change during the cycle; this is called the amplitude of the oscillation. If we place one peg on the outer rim of a wheel, and another peg halfway from the center to the first peg, the two pegs will both go up and down with the same frequency — whatever the rotation frequency of the wheel is. But the inner peg won’t go up and down as much as the outer peg.
We see that the oscillation in height of the 2nd peg has an amplitude which is only half that of the oscillation of the 1st peg.
Yet another aspect of cycles is the phase. Phase is the timing of the peaks and troughs of the cycle. Suppose I place two pegs on the outer rim of the wheel, one at the 9-o’clock position and the other at 12-o’clock position. Again, both will go up and down at the same frequency, the frequency of rotation of the wheel. Both will show the same amplitude, because they’re both on the outer rim of the wheel. But the two pegs will peak, and trough, at a different times; they will be be “out of phase” with each other:
In Fourier analysis, we take a sinusoid — a pure wave — and attempt to match it as closely as possible to our data. We change the frequency of the wave, as well as its amplitude and phase, until we get the best match. We then compute (mathematically) the “goodness” of the match, to decide whether or not the fit is “statistically significant.” If it is, then we declare that we’ve found a cycle in our data. If no combination of frequency, amplitude, and phase produces a significant fit, we have evidence (but by no means proof!) that there is not a cycle.
The oscillations we’ve looked at so far were perfectly consistent; each cycle had the same period, amplitude, and phase. But in nature, this is uncommon; while cyclic behavior is commonplace, the characteristics of oscillation are rarely constant. The frequency, amplitude, and/or phase may vary. Also, sometimes natural processes show cyclic behavior that doesn’t last; it may begin and end, suddenly or slowly, exhibiting transient cyclic behavior.
Consider, for example, the daily mean temperature in Svalbard, Norway, from 1995 to 2005:
Each dot is the mean temperature for a single day, the red line is a “smoothed” version to give an idea of the overall trend. It’s plain to see that there is a cycle in this data, it’s the seasonal cycle of warmth in summer and cold in winter. But it’s also plain to see, both from the raw data and from the “smoothed” version, that each cycle is different. In this case, it’s not the period or phase that’s fluctuating, it’s the amplitude. The period and phase of the seasonal cycle is driven by earth’s rotation around the sun. This external driving force maintains constant period and phase, but the response shows different amplitude for each cycle.
Fourier analysis will detect the seasonal cycle with statistical significance. The best-matching sinusoid aligns quite nicely, but it has constant period, phase, and amplitude. It doesn’t enable us to identify, or quantify, the constantly changing amplitude of the annual temperature (although modern, more sophisticated Fourier analysis methods do make that possible).
It would be good to have a method which, like Fourier analysis, matches the data to an oscillating pattern, but unlike Fourier analysis, could focus attention on a limited time span. We could match the pattern to different moments of time, and in that way enable us to identify the changes in period, amplitude, and phase of the signal underlying the data. Fortunately, there is such a method: wavelet analysis.
With wavelet analysis, instead of matching the data to an unchanging wave pattern, we match it to a pattern which only covers a small “window” of time. For example, one of the most popular wavelets is the Morlet wavelet, which looks like a sinusoidal wave but decays with time:
When we do a Fourier analysis, we try to match a simple sinusoid, and we test a large array of frequencies (periods). This gives us the goodness-of-fit for a large number of frequencies, which we can plot as a Fourier spectrum. Essentially, we’re doing a frequency analysis of our data.
When we do a wavelet analysis, we begin by centering the wavelet on a particular moment in time. Then we allow the frequency to vary and find the goodness-of-fit for all our choices of possible frequency. Then we move the wavelet to a slightly later moment of time, and repeat. In fact, we test the fit of the wavelet at enough moments of time to uncover cyclic behavior, no matter when it may occur, no matter what frequency it may show. We’re doing a time-frequency analysis.
An example may help to make this clearer. If we apply Fourier (frequency) analysis to the daily temperature in Svalbard from 1995 to 2005, we can plot the power (the “goodness-of-fit”) as a function of frequency, to give a power spectrum:
There’s quite a tall peak at frequency 1 cycle/year. This tells us that these data follow a cycle with frequency 1 cycle/year, or period 1 year (not surprising for the cycle of the seasons!). We can even use the height of the peak to compute the amplitude of the cycle. But that only tells us about the average amplitude over the whole data set; it doesn’t tell us whether the amplitude is changing, or if so, by how much.
With a wavelet analysis, we have two variables we’re “exploring,” frequency and time. So we do a time-frequency plot, and since we want to plot goodness-of-fit as a function of both time and frequency, I’ll color-code the goodness-of-fit response (wavelet power):
We see that over the entire time span, there’s a strong response at frequency 1 cycle/year. Hence we know that there’s a 1 cycle/year oscillation, whose frequency doesn’t change appreciably throughout the data. But we can also see that the strength of the response (indicated by color) is changing over time. Just as with Fourier analysis, we can use the height of the “peak” (actually, the “ridge”) to compute the amplitude of the cycle. More to the point, we can do this at each moment of time. This enables us to determine how the amplitude changes over time:
We can see that the amplitude does indeed change over time, and applying statistical tests we can determine that those changes are statistically significant — they’re not just random fluctuations, they’re real amplitude changes. With wavelets, we can measure how much the amplitude changes, and when.
If the frequency or phase had changed appreciably, we could have measured that with wavelets too. Since so many of nature’s phenomena are cyclic, but the cycles themselves are constantly changing, this makes it possible to study how those changes progress in time. Wavelets are a recent innovation, originally developed for image processing. But they are increasingly being applied to time series, like the changing temperature of planet earth or the growth and decay of ice sheets. As an analytical tool, wavelets are “all the rage” in science today.
The ability of wavelets to do time-frequency analysis, and to detect changes in period, amplitude, and phase, makes it one of the most powerful tools in the analyst’s arsenal. And … they’re fun!
7 responses so far ↓
Brian // January 26, 2007 at 6:45 am
Great summary…even a numerically-challenged geologist like me understands that technique much better.
I’ve been wanting to do this kind of analysis on data collected from a vertical succession of sedimentary rocks (which is a time series in its own sense). There are different attributes to test…bed thickness or grain size being the most obvious in the rocks i’m looking at. People have tried this before with limited results. But, it’s something I’d like to do myself even just to learn the technique.
What software do people commonly use to do this? Is there an Excel add-in or is it done in Matlab?
Thanks
[Response: I don't know about Excel or Matlab, I tend to write my own software for things like this.
One of the things to be careful about is: do your data show an uneven time distribution? If the data are regularly sampled, wavelets work great. If not, and if you apply traditional wavelet analysis, the results are likely to be far less than ideal. A lot of the paleoclimate data I've looked at have uneven sampling (usually, more data from recent eras than long past ages).
But there is one wavelet method which solves many of the problems of irregular sampling, and there's a nice program for it (a nice version for Windows, and I think they have a FORTRAN version for Linux users), the WWZ ("weighted wavelet Z-transform). It also works great when the data are evenly sampled. Astronomers suffer from irregular sampling all the time (what with the weather and all), so it's no surprise it was developed for astronomy. You can get the program from AAVSO.]
Dano // January 26, 2007 at 1:12 pm
Yup. This is what’s needed. You’re doing good. Keep it up, sir.
Best regards,
D
Yelling in the fog // January 26, 2007 at 1:20 pm
Great post! Good description of wavelets.
Here is a quick question. I notice in your time-frequency plot (the coloured one) that the “goodness of fit” response trails off at the start and the end of the series. In other words you have a strip of yellow in the middle that fades to blue at the ends. Is this an end effect from the data - perhaps since the data is starting and ending at these points the fit is poorer (you don’t have as much data to fit)?
[Response: Yes, it's an "edge effect." But it's not because the fit is poor at the edges. The "wavelet power" measures the statistical significance of the fit, and at the edge the significance is less because the analyzing wavelet covers fewer data points (only half as many as when it's far from the edge). In general, fewer data points means less statistical signficance.
But the program I use (see response to previous comment) computes both the statistical signficance (wavelet power), and the size of the appropriate wave (wavelet amplitude), so statistics determines "what frequency" and "is it real?" while "if real, then how big" is computed separately. Nonetheless, all wavelet methods suffer from edge effects, so caution is in order near the beginning and end of the time series.]
Brian // January 26, 2007 at 5:31 pm
Cool….thanks for tip on the software.
“One of the things to be careful about is: do your data show an uneven time distribution?”
You hit the nail right on the head…the record of preserved sediment is inherently irregular. Even though the sedimentation reflects time, I suppose it’s more correctly a ‘depth series’ and not a time series.
[Response: I believe depth is usually translated to time using an age model, and that makes it a legitimate time series. But the result generally has high irregularity along the time axis, and this spells trouble for most wavelet methods. One can, however, interpolate to generate an evenly spaced time series, which is better than applying uncompensated wavelets as is. But the WWZ compensates automatically.
One thing to be aware of is that time intervals with more data points will show stronger statisical significance (wavelet power) simply by virtue of having more data. But when computing the wavelet amplitude, the WWZ compensates for this too. I think it's a superior choice -- but I'm sure there are those who would disagree. This much is certain, it hasn't been adequately tested in paleoclimate. I'm working on that!]
Peaseblossom // January 26, 2007 at 11:20 pm
I’ve been hearing you mention “wavelet” this and “Fourier” that for going on five years now and this is the first time I’ve ever “heard” you explain it. I should have asked sooner! I can’t exactly be expected to repeat back what I just read, but at least it didn’t make my head explode. Keep up the good work.
Gil Pearson // January 29, 2007 at 8:03 am
Great post! Can’t wait for the next installment.
Catherine Morgan // January 31, 2007 at 9:31 pm
This was in my local news today…what do you think about it…..is it possible??
http://www.tampabays10.com/news/local/article.aspx?storyid=48267
Leave a Comment