I have time series of continuous measurements of two different variables $x(t)$ and $y(t)$ measured at times $t_i$. I measured those variables for different subjects (with different characteristics) and I would like to find out if a peak in variable $x$ is significantly followed by a peak in variable $y$ in a certain interval at the group level.
At the individual level, I do a peak detection for both $x$ and $y$, yielding $m_x$ peaks at times $(t_{x,i})_{1\le i\le m_x}$ and $m_y$ peaks $(t_{y,i})_{1\le i\le m_y}$. Then I count all occurrences in which a peak in $x$ is followed by a peak in $y$ (in the specified interval) and divide it by the total number of peaks in $x$ ($m_x$). I think a good way to test the significance of that measure is to bootstrap by picking $N$ realizations of $m_x$ random indices and calculate the same measure. This gives a distribution at the individual level and if the data falls outside the 95% highest-density interval, it is significant.
However, my question is, how I can find out if this pattern is statistically significant across subjects (i.e., at the group-level).
Edit: The problem is (1) that each subject has a different base-rate of peaks in $y$ and therefore a different probability for "peak $y$ after peak $x$" has a different meaning for each subject. And (2) each subject has a different number of peaks in $x$ and therefore some subjects have more reliable estimates than others...