title: How to find the lag between two time series using cross-correlation
body: <p>Say the two series are:</p>
  <pre><code>x = [4,4,4,4,6,8,10,8,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4]
  y = [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,8,10,8,6,4,4]
  </code></pre>
  <p>Series x clearly lags y by 12 time periods.
  However, using the following code as suggested in <a href="https://stackoverflow.com/questions/25830840/python-cross-correlation">Python cross correlation</a>:</p>
  <pre><code>import numpy as np
  c = np.correlate(x, y, &quot;full&quot;)
  lag = np.argmax(c) - c.size/2
  </code></pre>
  <p>leads to an incorrect lag of -0.5.<br />
  What's wrong here?</p>