I have a dataset from 2002-2015 from a fish market next to a floodplain in southern Africa. We collected data on fish species, length and price from 5 randomly selected vendors every two weeks.

The reviewers suggested we use a time series analysis to see if there is a correlation between species abundance and or length and the annual flood cycle. I have the monthly water levels during the period, but I am unsure of how to test for correlation. I think I understand the theory behind autocorrelation but not how to do it. Below is a screenshot of the data from the market (l) and river level (r)

  • $\begingroup$ Can you post an erxcerpt of the data? $\endgroup$ May 16, 2017 at 18:17

1 Answer 1


Notwithstanding that seeing some data would be helpful, simply looking for a correlation in its own right would be erroneous.

When you say "use time series analysis to see if there is a correlation", I am going to assume you would be using Ordinary Least Squares to do so - if indeed you do go down this route you need to ensure that your model is corrected for autocorrelation. Autocorrelation means that the error term of your time series at xt will be correlated with that of xt-1. This violates OLS and will lead to inaccurate results.

Instead, you want to determine whether a potential correlation is actually significant or simply due to chance. Many time trends can be correlated with each other, but that doesn't mean that the correlation is meaningful.

One way of testing for correlation between two time series is using what is called cointegration testing. This allows you to determine whether any correlations are in fact significant or simply due to chance.

A cointegrated pair is one that is non-stationary, but a linear combination of that pair is stationary.

yt - βxt = ut

where xt and yt are a non-stationary and cointegrated pair.

The Engle-Granger method allows for selection of the α, β, and ρ that best fit the following model:

Y [i] = α + β * X[i] + R[i]

R[i] = ρ * R[i − 1] + ε[i]

ε[i] ∼ N(0, σ2)

If you are using the R software, you could run the Engle-Granger method using the "egcm" library.

For instance:


egcm(length_of_annual_flood_cycle, species_abundance)

If the two series are cointegrated, the correlation is meaningful. If not, the correlation is coincidental.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.