How to find if a growth of X in time correlates with a growth of Y in time? Let's say I have many objects described by X and Y both of which are numbers. These numbers change in time and I want to figure out if a rise of X also correlates with a rise of Y.
I've no idea where to even start and I'd appreciate any pointers on which directions should I investigate.
 A: If X and Y are normally distributed, you can use a Pearson correlation.
If they are not, you can use a Spearman rank correlation.
Here is some R code.
> a <- c(1,2,3,4,5,6,7)
> b <- c(2,4,6,8,10,12,14)
> c <- c(2,5,4,10,8,13,11)
> d <- c(7,6,5,4,3,2,1)
> e <- runif(7, min=1,max=14)
> e
[1]  6.938054  1.347591  1.561456 10.867986
[5]  1.044163  1.870397 12.238245
> 
> cor(a,b, method="spearman")
[1] 1
> cor(a,c, method="spearman")
[1] 0.8928571
> cor(a,d, method="spearman")
[1] -1
> cor(a,e, method="spearman")
[1] 0.2857143
> 

A perfect correlation has a value of 1.  A perfect negative correlation has a value of -1. 0 means there is no correlation. the runif() command generates random data. The c() command creates a vector. The data could also be put in tables, with rows and columns.
This page described what I did here more fully: http://www.sthda.com/english/wiki/correlation-test-between-two-variables-in-r
A: As Larry suggested in another answer, a simple correlation might be sufficient. If you want to allow that the relationship can be delayed or lagged, you can use cross-correlation. This is similar to autocorrelation, which is a cross-correlation of a function with itself, in that it will give you many coefficients, each corresponding to a value of lag.
