Using StatsBase.crosscor and finding unexpected answers
answer below is 0.66666 and I think it should be 1 since crosscor calculates the correlation of numone with the 1 lag correlation of numtwo which is perfectly correlated
crosscor(x, y, , demean=false) is doing:
# Julia 1.5
numone, numtwo = [2,3,4,5], [1,2,3,4]
x, y = numone[1:end-1], numtwo[2:end]
ra = dot(x,y)/sqrt(dot(numone,numone)*dot(numtwo,numtwo)) # what crosscor does
rb = dot(x,y)/sqrt(dot(x,x)*dot(y,y)) # what you expect
Note that ra~rb for large n, e.g.
numone, numtwo = [2:1001;], [1:1000;]
but not for small n.