# Can I use the correlation between two variables when observations on each variable are autocorrelated?

I have two variables:

• urban areas
• protected areas.

My observations are urban areas and protected areas in each year. But these observations are the cumulative ones, so observations in each variable have auto-correlation.

Can I use the general correlation such as yielded by cor() in R to measure the correlation between these two variables? If not, which indicator or method can I use?

I have the scatter plot: the horizontal variable is urban area in a specific year, and the vertical variable is another one in that specific year. And these two variables are increasing as years pass. I can see these two variables present a linear relationship. And my purpose is to find a indicator which can measure this linear relationship. I actually have tested the linear regression: the urban area as independent variable, the protected area as dependent variable, and I put 14 pairs of each year into the regression model, and the coefficients can pass the t-test, and model can pass the t-test, the $R^2$ can reach more than 0.9.

I want to research the relationship between urban development and protected area development. And the scatter plot below is urban and protected area pairs on global scale for 1950-2014 with 5 year intervals (except for 2010 and 2014).

I want to test two questions: First, are these two areas (urban and protected areas) both increasing over the research period? Second, does urbanization (here I mean the development of urban area) cause the development of protected areas?

I want to use some correlation analysis to solve the first question, such as correlation, linear regression or MIC value. However, because my data are time series, I'm not sure it can be used in the calculation of correlation? So I raise this question. In addition, I don't know other methods that could be used to measure strength of linear relationship between two time series.

And for the second question, I want to use Granger causality test to test the causality relationship between these two areas statistically. I know the result of Granger causality can't be sure to determine the causality relationship. And in my opinion, the reasons to improve the development of urban areas or protected areas are both complex, and some of them may be shared. At this level, I simply want to test the causality relationship between these two variables.

• You have only one region whose share on urban and farm areas you measure, right? Then you can't calculate the correlation because at each time point you only have one pair of data. Nov 25 '14 at 11:25
• hello, horst. My data can be divided into three scale:1)Global, 2)Continental and 3)National. Global data does have one sequence for each variable; Continental data have 6 pairs for I have each sequence of urban and farm land in 6 continents;National data have more than 100 pairs. Now I want to calculate the correlation between these two variables. How can I measure it? And I am a little confused that why the auto-correlation pairs can't be used the correlation value to measure the correlation? Thanks~ Nov 26 '14 at 1:03
• Unfortunately, the term correlation is frequently used for forms of assiciation that are not really correlation. I'm not really sure what you mean. The correlation between two random variables $X$ and $Y$ is $E[(X-EX)(Y-EY)]\cdot (Var(X)\cdot Var(Y))^{-\frac{1}{2}}$. If you can write down your model in formulas answering your question is quite straightforward. If you cannot, you should ask a statistical consultant and explain him the whole story. Nov 26 '14 at 8:41
• Hi, horst. Thank you for your reply. After reading your comment, if I apply the linear regression to the point pairs, and the coefficient pass the t-test, model pass the F-test, the R2 is also high. So in order to measure the relationship between these two variables, should I prefer the regression model, rather than the indicator like correlation value? And I also upload a scatter plot above~ Nov 26 '14 at 9:16
• And if I want to measure the strength of the correlation value, how can the linear regression help me to identify? Nov 26 '14 at 9:24

## 2 Answers

You can certainly calculate the correlation between two time series. That's a short answer.

When, as true here and as true often, there is a marked trend in both cases, the correlation is likely to be extremely high. In general, it's not especially helpful. It's not as if there was serious doubt that there would be an apparent association; that's easily imagined from looking at the graphs of time series and thinking about the corresponding scatter plot. The P-value from conventional calculations is certainly not applicable, as independence of observations clearly does not hold.

The correlation throws absolutely no light on questions of process or causation. It's just a descriptive measure of strength of linear association.

What appear to be the same or similar data as in the question appear at How to interpolate a variable with frequency of 5 years to annual data? As an exercise I calculated the correlation between the variables parea and urea there as 0.9957; and between their logarithms as 0.9911.

In fact, many of the classic examples of high but spurious correlations arise from situations where two time series both show marked trends, but for quite different reasons, including apocryphally the price of rum and the number of Methodist ministers. Here there seems likely to be substantive association, but that's not the main question.

• You mean that the correlation result doesn't reflect the association between the trends of these two variables? After I read some materials about correlation, auto-correlation and cross-correlation, I know that the calculation of these indicates can't reflect the association between the trends of time-series. Dec 5 '14 at 14:47
• I don't know quite what you mean, but it doesn't correspond to any wording I would adopt. The correlation is genuine in so far as one variable could be predicted well from the other, but spurious in so far as both variables are trending upwards in time. Both statements are true, even they may appear contradictory. There is a long literature on spurious correlation between time series. The correlation will not help you address questions of causality. Dec 5 '14 at 14:50
• And since I want to know the trends of these two variables in long term, So I want to represent it by cointegration test, thus maybe the results can reflect their association in long term, for example, they both increase in the long term~ Dec 5 '14 at 14:53
• @ NickCox And when I asked someone (not on StakOver) about this question that whether can I use the correlation to calculate two time-series, he told me that definitely I can't. Because for a time-series data like my data, the observations are correlated with each other, so it obviously violate the hypothesis that the observations should be independent, and this may lead to the wrong estimations of parameters~ Does he right? Dec 5 '14 at 15:06
• Sorry, but you're asking the same question again and again, and my answer has already been given. The correlation is a descriptive measure. Any one wondering or worrying whether it might be slightly different from 0.9957 is just wasting their time, in my view. There may be a language problem here, but manifestly you can calculate the correlation; you should not try getting a P-value with it, but the inferential question is absurd any way. The hypothesis that the correlation is really 0 is utterly ridiculous. As no other hypothesis has been mentioned, there is no problem to solve. Dec 5 '14 at 15:17

It appears that you have a case for either difference or trend model here. The difference model would be like this $y_t-y_{t-1}=f(x_t)+\varepsilon_t$, where $x_t$ - exogenous variables and $\varepsilon_t$ is random errors.

The trend model is $y_t=f(x_t)+\varepsilon_t$, where $f(x_t)$ is the trend, such as a linear time trend $\beta_0+\beta_1t$.

There are many variations on these models, such as log transforms etc. If you think that volatility of your data is increasing with levels then log-transform may work well.

In this case the correlation will come from the $f_i(.)$ terms, where $i$ is a variable, and from $\varepsilon_{it}$ terms. The first is a correlation from exogenous factors, the second is from random errors.

• Yeah, in my data processing, I have use the log transformation of data, because I think these two variables are very different for the detail numbers, one varies between millions to 10 millions, another one varies between 10 thousands to 70 thousands. Dec 5 '14 at 14:43
• The key to using logs in not just different levels of variables, but increasing variance at higher levels. If the levels change a lot but the variance stays the same, then trend stationary process may fit better. Dec 5 '14 at 14:47