As an example, let's take var_a
and var_b
:
var_a <- c(0,10,10,9,12,10,10,0)
var_b <- c(5,7,6,5,7,7,8,7)
All points are arranged in chronological order.
Within var_a, I calculate the difference between each value and the preceding one, so that:
diff.var_a <- c(NA,10,0,-1,3,-2,0,-10)
Then I do the same with var_b
:
diff.var_b <- c(NA,2,-1,-1,2,0,1,-1)
The correlation between var_a
and var_b
is 0.35, while the correlation between diff.var_a
and diff.var_b
is (remving the NAs) 0.75.
What I would like to achieve is to show if variations in var_a are related to variations in var_b.
My initial idea was simply to calculate Pearson's r for var_a
and var_b
. Then I thought that maybe using the difference between consecutive points might do a better job in highlighting how changes in one variable correspond to changes in the other, hence the correlation between diff.var_a
and diff.var_b
.
The correlation coefficients are quite different, and can results in different interpretations. So now I am a bit stumped and I don't know a) if I should stick to a simple correlation between var_a
and var_b
, and b) what kind of information does the difference between consecutive points actually convey.
Any suggestion is appreciated.
var_a
andvar_b
does not address this question: it's irrelevant. $\endgroup$