# Bootstrapping at group level (time series data)

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...

• If you're talking about analyzing your time series data at group level, don't you think that clustering might be helpful? If you're interested in time series clustering, please let me know - I might be able to suggest some information. – Aleksandr Blekh Jan 21 '15 at 11:25
• I don't quite understand what you are referring to. Do you mean clustering on the subject level? To what purpose? How could it help to solve the problem? – thias Jan 21 '15 at 12:16
• I was thinking that, if you could define a measure of the "pattern" you've described, then you could hypothesize that (and then test for) the difference between time series groups (determined by clustering) is statistically significant, which is QED. – Aleksandr Blekh Jan 21 '15 at 12:39

If you want to use similar approach on group level you should use bootstrap sampling on group level because sampling on individual level could give you biased estimates on group level (check here or here and here for an example why you should not confuse group-level and individual-level data). So what you do is (1) you sample with replacement $K$ groups out of $K$ groups (rather then sampling individual observations) and then (2) sample without replacement $n_k$ individuals in each group (so what you do is you simply shuffle the cases). In most cases step 2 actually does not make much difference, so is not required. Sampling in step 2 should be done without replacement because otherwise it gives biased results (see references in the linked answers).
• thanks for the answer! It does not, however, answer my main problem of estimating the group-level effect. 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... – thias Jan 21 '15 at 9:27