Data:
I have 92 years of monthly climate data. One of my variables is a drought index (SPEI) ranging from -2 (dry) to 2 (wet). All the data can be found here.
Data Structure:
year month order.ID season temp.avg ppt.avg GDD pdo spei
1923 0 13 1 6.1612 0.23516 73.54 0.27 0.6544
1923 1 14 1 5.0967 0.24161 40.66 0.01 0.4837
1923 2 15 1 3.425 0.24428 47.19 -0.95 0.5207
1923 3 16 2 9.7870 0.46612 161.3 -1.23 0.2631
1923 4 17 2 12.753 0.304 238.1 -0.64 0.2476
note: PDO = Pacific Decadal Oscillation Index | order.ID = (monthly) time series order
Graph of SPEI across time:
I am trying to determine the long-term (92yr) trends of the SPEI data. I am doing so with a general least squares approach using gls
function from the nlme
package in R
.
Issue:
After examining my best (lowest AIC) model ( gls(spei ~ I(year - 1950) + pdo)
) using ACF and PACF, it was very clear that there was underlying temporal autocorrelation and likely periodicity.
I've attempted to account for these issues in two ways:
Accounting for periodicity by including sin + cos parameters to the model. I did so by examining how including the following parameters,
I(cos(2*pi/P*(order.ID))) + I(sin(2*pi/P*(order.ID)))
in my model using various period lengths (P) affected the AIC of the model:
- Though including the sin/cos parameters using the period (630) that created the model with the lowest AIC improved the AIC of my model, it did not correct for the issues I was seeing in my ACF/PACF plots. In fact, even including upwards of 4 combinations of SIN/COS parameters using numerous "strong" periods (e.g., 630, 238, 183 and 49) failed to eliminate the ACF/PACF issues:
Accounting for autocorrelation using corARMA argument in
gls
function. Specifically, I tried ARMA models using all combinations of p = {1:4} & q = {0:3} with no luck in eliminating the autocorrelation.The best performing (lowest AIC) model was
gls(spei ~ I(year - 1950) + pdo, correlation = corARMA(p=4,q=2), method = ML)
But the resulting ACF/PACF still had issues:
Note: I did try a combination of 1 and 2 (using sin+cos parameters and a corARMA argument in my model), but even the combination of approaches failed to "fix" the problem.
Additional note:
I tried adding months and seasons (separately and together) to the model in two ways: 1st, as periods (12 and 4 respectively) in SIN/COS parameters and, second, as categorical dummy variables in the model. Both approaches resulted in models with higher AICs - essentially suggesting the periodicity is not due to months or seasons??
Question:
What do I do now? How do I go about "fixing" this data - i.e., how do I properly account for the periodicity and autocorrelation so that I can accurately view the long-term annual (linear) trend (and correct p value of the coefficient)?
Obviously nothing I've tried so far has worked...