# Cross-correlation of periodic time-series with uneven steps

## Background

I am seeking to understand the relationship between measured height of certain objects and tides. I have a tide gauge that measures tide height every 2 seconds and a number of other height time-series measurements with steps of approximately 30 minutes apart. These series have gaps, uneven time steps, and different sampling times per series.

## Problem

I would ultimately like to determine the phase lag between tide and object and some measure of the amplitude ratio between object and tide. Floating objects (series_0) probably have 0 phase lag and amplitude ratio of 1. Other objects (series_1) probably have a non-zero phase lag and amplitude ratio < 1. Ideally I would calculate the phase lag down to 2 second precision, but anything less than a minute would be alright.

## Data Cleaning

I can set the timestamps for a series to assure it coincides with a tide measurement. It is a rounding of less than 1 second so it is negligible. I don't want to interpolate the timeseries to have even timesteps or fill in gaps. I would be willing to interpolate or use a function for the tide series.

## Solutions

### (a) Brute force

Step through the tide series and compute the Pearson r for different lags. The lag with maximum r explains the phase shift. Minimize the difference between the tide sampled for this phase shift and a linear function of the object series.

### (b) FFT phase shift

Can be ruled out (?) because of uneven time step in series.

## Software

I would prefer to use python, but right now I need help with understanding the mathematics or algorithms.

• This is not the best solution, but here's one for point process observations that you can extend to the Marked point process case: doi.org/10.1016/j.jneumeth.2007.10.005 A proper method would be a continuous Bayesian bivarate autoregressive model... – Memming Dec 4 '16 at 15:49