# Temporal linkage between two lists of data

I have 2 lists, representing a time series:

list_a = [23,43,29,45,6,12,240]
list_b = [13,23,11,35,60,52,40]


i.e. list_a is value in first year....list_a is values in 7th year.

I want to check if increase in values in list_a is followed by an increase or decrease in list_b in the subsequent year. Is there a statistical test that will allow me to do that? The key is looking at the direction of change rather than the magnitude of change.

Even better if I can say something about the temporal linkage between the two lists. I.e, perhaps increase in list_a precedes changes in list_b by 2 years.

• Your feedback will be appreciated. – rnso Nov 2 '14 at 17:17

Try correlation in R as follows:

> list_a = c(23,43,29,45,6,12,240)
> list_b = c(13,23,11,35,60,52,40)
>
> a = list_a
> b = list_b
>
> dd = data.frame(a,b)
>
> dd$diffa = c(0,diff(a)) > dd a b diffa 1 23 13 0 2 43 23 20 3 29 11 -14 4 45 35 16 5 6 60 -39 6 12 52 6 7 240 40 228 > > with(dd[-1,], cor.test(b, diffa)) Pearson's product-moment correlation data: b and diffa t = -0.008, df = 4, p-value = 0.994 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.8129184 0.8101954 sample estimates: cor -0.003988337  Edit: For using other methods: with(dd[-1,], cor.test(b, diffa, method='spearman')) with(dd[-1,], cor.test(b, diffa, method='kendall'))  A graph will clearly show how much delay is there. Such graph can be obtained with following code: dd$time = rownames(dd)
mm = melt(dd[-3], id='time')
ggplot(mm, aes(x=time, y=value, color=variable, group=variable))+geom_point()+geom_line() • thanks! I am looking at granger causality right now, not sure if statistically pearson's is the right metric. – user308827 Nov 2 '14 at 18:06
• Other methods of correlation can be specified as mentioned in my edit above. – rnso Nov 3 '14 at 0:55
• A graph will be helpful to find the delay. The code for such graph has been added above. – rnso Nov 3 '14 at 1:43
• @user308827 I was going to suggest Granger causality – shadowtalker Nov 3 '14 at 10:24
• thanks @ssdecontrol, do you know why that would be better than pure correlation? – user308827 Nov 3 '14 at 13:07