This is an assignment for Applied Time-Series and Spatial Analysis for Environmental Data. This course is a graduate level, R-based statistics course offered by the Huxley College of the Environment, within Western Washington University.
This document focuses mostly on spectral analysis. I have spent a significant amount of work smoothing some of my thesis data lately, which ties in nicely with this week’s content. Click here to see extensive use of the lowess smoother, used in comparing different temperature datasets.
Here, I’m going to analyze several different datasets using spectral analysis. I will use periodograms to identify the dominant frequencies in these data and the lowess smoother in an attempt to remove certain frequencies to highligh others.
Packages
I’ll be using the following packages: dplR and `tseries``.
Data
Within tseries there are several great ts datasets that allow for spectral exploration. I’ll look at: ice.river, giving flow amounts of two Icelandic rivers, as well as local precipitation and temperature values; and JohnsonJohnson, which shows the quarterly earnings per share of Johnson & Johnson stock.
Below is are timeseries of mean daily flow from two rivers in Iceland, and mean daily precipitation and temperature values.
data(ice.river)
The series is only 3 years long, but with daily values we have over 1000 data points to work with and we should be able to pull out the dominant frequencies.
It makes sense that the two rivers have a similar spectral signature, and that this also matches up well with temperature.
See that the green. blue, and yellow vertical lines all fall on f = 1. Even though these data are resolved daily, within the ts object the frequency is set to 1 year, thus resulting in the spike on the periodograms at 1 year.
The precipitation values seem to have some longer frequencies imdedded, but with such a small window (3 years), many of the longer frequencies may be ‘invisible’, meaning their periods are longer than the actual dataset, and thus they cannot be seen in the raw plot.
Note
I’ve been trying to figure these graphs out and was messing around with the units on temperature. Turns out the actual numbers dont have much to do with the power of each spectral signature. See below.
kel <- rep(273.15, times=length(temp))
vin <- kel + temp
spectrum(vin, log="no",xlim=c(0,20),main="",sub="",col="goldenrod")
Lets move on to something more complex.
This dataset was in my opinion the most challenging. I started by plotting the data and messing around with some smoothers until I felt like I had a decent idea of the trends. Combinding this with what I know about these systems, I started to look at their spectral signatures.
The most obvious feature shared between ENSO and the PDO is the f = 0.175 band. This translates into a period of about 5.7 years. We know ENSO fluctuates on a 3-7 year timescale, and so this 5+ year dominance is well within the range of expected periods. We also know that ENSO and the PDO are similar enough systems (location, mechanics, etc) that they may share some oscillatory (or faux-oscillatory to be be totally correct) behaviour. I’m going to speculate here that the green bands (ENSO: f = 0.2833, T = 3.53 years and PDO: f = 0.3085, T = 3.24 years) are also shared, or at least related. I know the PDO operates on a much longer scale (in theory anyway) than ENSO, and so I’m going to attribute the PDO’s f = 0.0166, T = 60.2 years band to the actual PDO mechanism (whatever that may be…).
El Nino Index
Here, I fit a smoother of 5.7 years, which is the dominant frequency of ENSO found from the periodogram. For easy visualization, I’ve filled in the area beween the smoother and the x-axis which is a common way to show the phase changes of ENSO.
PDO Index
Here, I fit a smoother of 60 years, which is the dominant frequency of the PDO found from the periodogram above. For easy visualization, I’ve filled in the area beween the smoother and the x-axis which is a common way to show the phase changes of the PDO.