Skip to content

Cross-Correlation Calculator — Find the Lag Between Two Sensor Series

Choose two channels. You get the cross-correlation function across the lags you asked for, the lag of the strongest correlation, and significance bounds — which is how you find out that leaf wetness follows relative humidity by about two hours rather than assuming it.

Your data

Drop your logger CSV or Excel file here

CSV, TSV and .xlsx workbooks. HOBOware and Postlad exports are recognised on sight, and most other files are read anyway. It stays on this machine — the workbook is even unzipped here, and nothing is uploaded.

Synthetic twelve-day record at half-hourly intervals: air temperature and soil temperature at 10 cm depth, where the soil is a damped copy of the air delayed by exactly three hours — the thermal lag the tool should recover as lag −6. The soil probe drops out for three hours on the fifth day, so the pairwise handling of missing readings is visible. Not measured data.

Saved projects

0 of 1

Projects are stored in this browser only — never uploaded, and gone if you clear site data. Download one as a file to keep it, move it to another machine, or send it to a colleague.

Loading the figure…

Click any title, axis label, legend or note on the figure to reword it — Enter keeps it, Escape cancels, and an empty box hides the line. The numbers are not editable.

SVG is vector — scale it to any size in Illustrator, Inkscape or LaTeX without losing quality, and edit the type. Use it unless a journal insists on raster.

Options

Series

Lag k is the correlation between this channel at t+k and the second at t.

The figure says in words which channel leads, so the order cannot mislead you.

Both channels are averaged onto this regular grid first. A lag is one step of it — cross-correlating irregular timestamps has no defined lag.

More options — lags, figure

Lags

Automatic uses a quarter of the series, capped at 48 steps either way.

The CCF scales every lag by the whole series, so r shrinks as the overlap does — it is what R, Minitab and every textbook print. Pearson rescales to the overlapping window at each lag instead, which does not shrink and is easier to over-read at large lags.

Two smooth sensor channels cross the ±1.96/√n band at dozens of lags whether or not anything connects them, because the band assumes independent readings. Prewhitening fits an AR(1) to the chosen channel, subtracts that channel’s own memory from BOTH series, and cross-correlates what is left — after which the band means what it says. It is the standard fix (R’s TSA::prewhiten); the price is that the peak gets smaller and you are reading residuals, not readings.

Figure

All of that was worked out in this browser tab. Your file was not uploaded, and no request goes out while you work — open the network panel and watch, if you like.

How this tool’s arithmetic is checked — the published worked examples this tool reproduces, printed beside what it computes, with the test files that assert them.