I have a bunch of data where I am recording two variables across time for many subjects: velocity of the right hand, and intensity of the speech.

For each of my 20 subjects, I have ~30 recordings of ~1 minute each.

So, my data looks like this:


I can calculate the correlation between the velocity of the hand and the intensity of the speech for each recording.

The thing is, I am not sure about what to do next. It seems like I cannot really "average" this correlations for each subject, and then compare these averages between subjects - or even compute a meta-average between all subjects.

How can I get:

  • A correlation coefficient accounting for all the trials of one subject
  • A correlation value that accounts for the variation of correlation across all subjects?

Thanks for your help!

  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Sep 19 at 8:36
  • $\begingroup$ I'm afraid you have presented your data in a format that is difficult to understand. You'd get more advice if you presented it in matrix format (i.e. rows and columns corresponding to the participants, variables and measurements). However, based on the info given, if you want to find out the average relationship between velocity and intensity for each participant and across participants, a multilevel regression analysis with one predicting the other and including a random intercept of participant (and maybe a random slope of the predictor) might work pretty well. $\endgroup$
    – Sointu
    Sep 19 at 13:16
  • $\begingroup$ Also repeated-measures correlations (rmcorr package in R) might be helpful. $\endgroup$
    – Sointu
    Sep 19 at 13:18
  • $\begingroup$ Were all subjects repeating the same action during all trials? $\endgroup$
    – dipetkov
    Sep 22 at 9:23
  • $\begingroup$ No, they were re-telling stories they had seen but the content was different for each of them. We don't really care about the content itself though, we were more interested in seeing how the hands move in relation to the acoustic of the speech $\endgroup$
    – Paidon
    Sep 22 at 12:59

1 Answer 1


So, one way would be to arrange the data in long format

id trial velo intens
1  1     0.3  0.4
1  2     0.2  0.3
1  3     0.1  0.2
1  4     0.4  0.2

#Edited to add: you'd have to choose some slice of time 
and average the velocity and intensity within that time 
(for each participant and within each trial) to get your 
data into a "modellable" numeric form. 

Maybe you can average over the whole minute, 
maybe you want to use 10 second slices, maybe 1 second slices -
what's reasonable depends of subject knowledge and other data properties.

And run a multilevel regression analysis, e.g. in R lmer like this

model<-lmer(velo ~ (1|id) + intens, data=data) #though you'd probably need to person-mean center intensity and use this centered variable as predictor

#in this approach you could also include a random intercept of trial (1|trial) if you feel trials are meaningfully different from each other

From this analysis you'd get an average estimate about the relationship between velocity and intensity for each participant, as well as a global estimate of this relationship across all participants. See lmer and general multilevel regression tutorials (there are tons online) to get a better idea of this approach.

Another way would be to use repeated measures correlations. E.g. in R

rmcorr(participant=id, velo, intens, dataset=data)

Which gives you the average within-participant correlation between velocity and intensity. See this article for reference.

Yet another way might be to calculate a correlation for each participant, Fisher-transform these correlations, average the transformed correlations, and then back-transform the average (see, e.g. this article, but I'm not sure what's the status of that practice nowadays.


So, first thing for you to do is to get the data into a numeric and data frame format. Choose a time slice over which you average the values or use the raw values from the 0.125 second clips depending on which is reasonable based on your subject knowledge. Though if you use raw values you will have an enormous dataset of about 14 400 rows per participant, which may not be necessary and may require a lot of computational power to analyze.

At least in softwares I'm familiar with, regardless of your analytical approach, you'd organize your data like this:

ID  trial  velocity  intensity
1   1      100       120
1   1      110       110
.. ..
.. ..
20 30      120       130    
20 30      110       140

So, each participant gets as many rows as there are trials * time slices within a trial. In other words, each row corresponds to a particular time slice for each participant within each trial. If you choose to average over the whole trial, you'd have 30 rows per participant.

Then, you can use any of the approaches I suggested on the data. You should probably read some background on each approach to decide which works for you.

  • $\begingroup$ Hi! Thanks for your help on this :) I don't know if I understand everything well, but it seems in your first solution that I have to summarize the whole time series by an average. Is there a way to start from a correlation of each trial independently? $\endgroup$
    – Paidon
    Sep 21 at 10:30
  • $\begingroup$ Yes, definitely. But I'd need to know what kind of numerical values you have for each participant per each trial. So is 1 trial = 1 minute? Do you have, for each participant, one value of velocity and one value of intensity per trial, or do you have, for each participant, several values for velocity and intensity per trial? What is the shortest time unit for which these two constructs are measured? $\endgroup$
    – Sointu
    Sep 21 at 12:01
  • $\begingroup$ And the lmer solution is exactly the opposite or averaging over the whole data; it gives you participant-specific correlations AND their average while correcting for non-independence of observations and using every observation. $\endgroup$
    – Sointu
    Sep 21 at 12:06
  • $\begingroup$ So, what I have is 32 recordings per participant. The recordings vary in time, being 1 minute +/- 15 seconds, and both the velocity and the intensity are downsampled at 8 Hz, so there is one value every 0.125 seconds. Because the duration is not the same between recordings, the number of measures in each trial varies. $\endgroup$
    – Paidon
    Sep 21 at 17:02
  • 1
    $\begingroup$ Thanks for your help, I'll try that! $\endgroup$
    – Paidon
    Sep 22 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.