# Grouping a Matrix into a Univariate Function: Correlation Functions

Hello I am attempting to implement a discrete correlation function for two astronomical light curves but I am struggling with the final steps of the math. The steps are as follows:

1. Given two datasets $$(a_i, t_{ai})$$ and $$(b_j, t_{bj})$$, construct two matrices: the unbinned discrete correlation function (UDCF) and the associated lag times

$$UDCF_{ij} = \frac{(a_i - \bar a)(b_j - \bar b)}{\sigma_a \sigma_b}$$ $$\Delta t_{ij} = t_j - t_i$$

1. Then Group the UDCF "into a univariate function of lag time $$\tau$$ by collecting the $$M(\tau)$$ data pairs with lags falling within the interval $$\tau - \Delta \tau/2 \leq \Delta t_{ij} < \tau + \Delta\tau/2$$. This produces the discrete correlation function:

$$DCF(\tau) = \frac{1}{M(\tau)}\sum_{k=1}^{M(\tau)}UDCF_{ij}$$

Step 2 is what I am struggling to understand. How does one group a matrix into a one variable function? I suppose my problem is in computing the $$M(\tau)$$ data pairs, which I imagine is produced by looking at the inequality provided. But how does one compare a matrix like $$\Delta t_{ij}$$ to a variable like lag time and bin size $$(\Delta \tau)$$? I apologize if my questions are a bit too general, but I'm afraid my total confusion on this step is making it difficult to be more specific. I have very little background in statistics and correlation functions. I'd appreciate any help or suggestions you can provide.

• I believe the summation should be done by all $(i, j)$ pairs that satisfy $\tau - \Delta \tau / 2 \leq \Delta t_{ij} \leq \tau + \Delta \tau / 2$. And $M(\tau)$ is simply the number of such pairs. Since each $UDCF_{ij}$ is just a number for any pair $(i,j)$, the sum also would be a number, not a matrix. In fact "matrix" is very misleading here, no matrix operation is involved. Just treat them as numbers associated with each $(i, j)$ pair Jun 30 '21 at 8:53
• I see, now it makes sense. So I first need to specify a lag time $\tau$ and and bin size $\Delta\tau$ and then determine the pairs that satisfy the condition. Then add their UDCF values together and divide by the total number of pairs. Please post an answer so I can accept it as the solution. Jun 30 '21 at 14:57

I believe the summation should be done by all $$(i,j)$$ pairs that satisfy $$\tau - \Delta \tau/2 \leq \Delta t_{ij} < \tau + \Delta\tau/2$$ condition: $$DCF(\tau) = \sum_{(i,j):\, \tau - \frac{\Delta\tau}{2} \leq \Delta t_{ij} < \tau + \frac{\Delta\tau}{2}} UDCF_{ij}$$ And $$M(\tau)$$ is simply the number of such pairs (and hence the number of summands).
Since each $$UDCF_{ij}$$ is just a number for any pair $$(i,j)$$, the sum also would be a number, not a matrix. In fact the "matrix" term is very misleading here, since no matrix operation is involved. Just treat them as numbers associated with each $$(i,j)$$ pair.
The bin size $$\Delta \tau$$ should be picked to some constant value before computing $$DCF(\tau)$$.