Modular regression model

341 Views Asked by At

Short version, I need to find a regression to this : $ a\equiv t\pmod \Delta $, $a$ and $\Delta$ are the unknowns constants.

Any idea where I should start looking ?

Some context, because I may be wording it in a confusing way : I am trying to find the tempo of time-stamped events $t_i$ for some real time musical analysis. They have a typical interval of $\Delta$, but there isn't an event at every "tick", so no linear regression, and there may be more than one event for a given "tick". In other words, $t_{n+1} - t_n$ may be $0$ or any $m\Delta$.

Just so you know, I have a light background on stats, and none in modular arithmetic.

1

There are 1 best solutions below

0
On

It sounds like your problem would benefit from Fourier analysis more than any sort of regression model.

Given that the events are discrete, you could use $\displaystyle \sum_{j=1}^n e^{\frac{2 \pi i t_j}{p}}$ to get the "Fourier transform" $F(p)$ of your samples, where $p$ is the period, or "tick interval", you're testing for. Even with some random dispersion, if your points are more or less regularly spaced at integer multiples of an interval $\Delta$, you'd see a spike in magnitude at $p = \Delta$, with smaller spikes at $p = \frac\Delta2, \frac\Delta3, \frac\Delta4$, etc.

As an added bonus, since $F(p)$ will be a complex number, the argument of $F(\Delta)$ at the peak magnitude would also give you an estimate of the value of $a$.

One thing to watch out for is that you shouldn't try to test values of $p$ greater than the total length of the music itself, because then the values will tend toward a maximum just due to the angles of the samples being squished close to 0, and that's not the kind of spike you're looking for.