# Multiple correlations across subjects

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?

• 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.
– Community Bot
Sep 19 at 8:36
• 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. Sep 19 at 13:16
• Also repeated-measures correlations (rmcorr package in R) might be helpful. Sep 19 at 13:18
• Were all subjects repeating the same action during all trials? Sep 22 at 9:23
• 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 Sep 22 at 12:59

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

#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

library(lme4)
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

library(rmcorr)
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.

EDIT.

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.

• 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? Sep 21 at 10:30
• 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? Sep 21 at 12:01
• 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. Sep 21 at 12:06
• 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. Sep 21 at 17:02
• Thanks for your help, I'll try that! Sep 22 at 17:02