# How to check if relationship between two variable changes over time?

I am working on a commodity-exchange rate model as part of my thesis. My dependent variable is log of first difference of exchange rate of Colombia and my independent variable is log of first difference of crude petroleum price.

I have daily data for last 20 years for both the variable. I am interested in looking whether the relationship (i.e. the effect of crude petroleum prices on Colombia's exchange rate) between the two variables changes over time.

So let say i want to check whether effect of crude petroleum prices on Colombia's exchange rate in the last 5 years ( 2012-2017) is different from that in 2007-2012.

I was thinking of creating dummy variables for 5 years ( 1 if the data is from 2012-2017, 0 otherwise) and then creating an interaction variable of the dummy and crude petroleum prices.

I am not sure whether this is the right thing to do. also can i use any other model or test for the same. Any advice is appreciated. Please let me know if my question is unclear. I can try to modify it.

If you are trying to use an Ordinary Least Squares regression to determine the impact of crude petroleum prices on the Colombian exchange rate - the first thing you need to do is analyze your data to see if it is stationary. To do this, plot the autocorrelation function and run a Dickey-Fuller test adf.test in R to confirm/deny the same. Once you have confirmed that your model is stationary, i.e. you have a significant p-value for the Dickey-Fuller test at your specified significance level, then your OLS results are valid by regressing on first differences.

However, a more effective way to investigate the correlations between two time series is through cointegration analysis.

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.

When running the Engle-Granger two step method, the purpose of this is to estimate the value of ut through OLS and then regress the estimate of ut on the first differenced regression.

The reason that cointegration is preferred is that a normal correlation analysis or OLS in standard form will detect a trend from the time series, but this trend does not necessarily have theoretical meaning. This means that you would be quite likely to make a Type I error of rejecting the null hypothesis, or concluding a significant relationship exists when it doesn't.

A cointegration analysis accounts for the fact that a time trend could have been obtained due to chance, and therefore looks to see if the relationship between the two time series is statistically significant. While a stationary, first-differenced OLS is a valid procedure, your analysis would be well served with cointegration testing as well.

• Let us assume that i decide to go ahead with the first-difference OLS procedure. I have data for last 20 years. If i create 3 dummy variables, one for 2017-2012, one for 2012-2007, and one for 2007-2002 (Leaving out a dummy for 1997-2002). Then interact these dummy with crude prices. So my equation will be 1st difference of exchange rate = B0 + B1 1st diff_of_crude + B2 1stdiff_of_crude x dummy for 2017-2012 + B3 1stdiff_of_crude x dummy for 2012-2007 + B4 1st diff_of_crude x dummy for 2007-2002 + ut. – Siddharth Mundra Mar 26 '17 at 14:01
• Will these interactive variable be meaningful to see if there is any change in relationship between exchange rate and crude in these different time interval of 5 years. – Siddharth Mundra Mar 26 '17 at 14:06
• Your analysis might be better served by running a Chow test - which is a test that would check for a structural break across the periods you specify. You could create dummy variables as you have described, but it's not necessarily the ideal way to go about it. – Michael Grogan Mar 26 '17 at 18:48