How to determine the correlation between 2 time series while controlling for a 3rd? I would like to determine the relationship between two variables after controlling for a third. Specifically, I want to know if the prices of mercury and gold over time are correlated with each other more than or less than they are correlated with a generic metals price index. Is there some special signal in the relationship between these commodities or are they just moving in line with the overall index?
I have a data set with 32 annual values (1980-2011) for mercury price, gold price, and metals index. I am using R. 
Below I have posted time series plots of each of the three variables.
 
 A: You can approach the problem within a VAR (vector autoregressive models) framework. Essentially, you would ask: after I take into account the past values of M, and the past values of IMF, is there some information in the past values of G that would help me improve my prediction for the current value of M (and similarly for the other variables in the system).
The vars package in R can be used to estimate VAR models.
Note that depending on the properties of the time series (e.g. stationarity), the VAR approach can be more or less appropriate. An alternative to consider is vector error-correction models. You can find this document useful: http://cran.r-project.org/web/packages/vars/vignettes/vars.pdf 
A: Before undertaking a more complex time series approach like VAR, I have attempted some more basic approaches. Again, the aim is to determine the relationship of Hg prices and Au prices after taking into account a generic metals price index. 
First, I ran a cross-correlation of the mercury and gold price series. The highest correlation  was a lag-0, so I decided to ignore time lags for now. 
Then, I ran correlations (pearson) on each pair of variables (e.g. mercury~gold). I found that mercury and gold prices were correlated more strongly (~0.9) than either mercury or gold were correlated with the price index (~0.6 and ~0.5 respectively). 
Next, I created 3 linear regression models: (hg~au), (hg~price index), and (hg~au + price index). The last mode showed the highest R2, with au contributing most to the fit, but the price index also making a statistically significant contribution. 
I concluded that mercury and gold prices are correlated much more strongly to each other than to a generic price index, and that a linear model including both gold price and metals price index provided the best prediction for mercury prices. 
I would be very grateful for any feedback or criticism. Would VAR add significant value to this?
