Goal
I want to find the strength of relationship (correlation) between two variables measured for 40 drivers.
Data
My dataset has 2 variables, tau_inv = a sensory quantity
and ED_bpf = brake pedal force
. These are measured repeatedly per driver for 40 drivers. participant
name is also included:
> dput(df)
structure(list(participant = structure(c(33L, 33L, 33L, 17L,
17L, 10L, 4L, 4L, 30L, 29L, 39L, 25L, 37L, 37L, 13L, 13L, 11L,
11L, 11L, 19L, 32L, 6L, 26L, 26L, 27L, 27L, 21L, 21L, 9L, 9L,
18L, 7L, 7L, 38L, 14L, 14L, 35L, 23L, 40L, 40L, 31L, 28L, 16L,
16L, 34L, 34L, 3L, 3L, 12L, 36L, 36L, 15L, 1L, 1L, 1L, 8L, 8L,
2L, 2L, 2L, 24L, 20L, 20L, 5L, 22L), .Label = c("driver: 01",
"driver: 02", "driver: 03", "driver: 04", "driver: 05", "driver: 06",
"driver: 07", "driver: 08", "driver: 09", "driver: 10", "driver: 11",
"driver: 12", "driver: 13", "driver: 14", "driver: 15", "driver: 16",
"driver: 17", "driver: 18", "driver: 19", "driver: 20", "driver: 21",
"driver: 22", "driver: 23", "driver: 24", "driver: 25", "driver: 26",
"driver: 27", "driver: 28", "driver: 29", "driver: 30", "driver: 31",
"driver: 32", "driver: 33", "driver: 34", "driver: 35", "driver: 36",
"driver: 37", "driver: 38", "driver: 39", "driver: 40"), class = "factor"),
tau_inv = c(0.08, 0.11, 0.16, 0.1, 0.17, 0.11, 0.12, 0.19,
0.19, 0.13, 0.09, 0.17, 0.13, 0.14, 0.08, 0.11, 0.08, 0.16,
0.22, 0.19, 0.16, 0.21, 0.13, 0.24, 0.11, 0.11, 0.09, 0.14,
0.15, 0.17, 0.13, 0.14, 0.19, 0.11, 0.17, 0.24, 0.15, 0.19,
0.07, 0.13, 0.25, 0.14, 0.13, 0.22, 0.11, 0.2, 0.16, 0.21,
0.12, 0.13, 0.18, 0.13, 0.05, 0.09, 0.14, 0.16, 0.2, 0.07,
0.14, 0.2, 0.23, 0.12, 0.16, 0.16, 0.15), ED_bpf = c(3.8,
3, 5.5, 1, 5.1, 8.8, 4.1, 12.6, 12.5, 10.8, 5.4, 8, 5.4,
6.6, 3.7, 4.8, 4.2, 3.9, 5.9, 6.8, 11.2, 9.9, 7.2, 8.5, 5.2,
9, 5, 5.5, 5.4, 11, 6.9, 5, 9.2, 7.2, 6.1, 10.6, 9.5, 8.8,
3.3, 8.8, 10, 7.5, 3.4, 7.1, 4, 5, 5.3, 7.9, 10.8, 7, 5.5,
7.8, 4.1, 3.4, 7.8, 5.1, 7.6, 6.4, 3.6, 8.7, 11.4, 5.6, 7,
13.3, 2.4)), row.names = c(NA, -65L), class = c("tbl_df",
"tbl", "data.frame"))
What I have done
I have estimated the pearson correlation coefficient as shown in the plot below:
library(ggplot2)
library(ggpubr)
ggplot(data = df,
aes(x = tau_inv,
y = ED_bpf)) +
geom_point(alpha = 0.5) +
stat_smooth(method = "lm", se =F) +
stat_cor(method = "pearson", label.x = 0.0025, label.y = 0)
Question
I am concerned that because there are multiple data points of the same driver (see the participant
column), the pearson correlation coefficient might not be the best method to find the strength of the relationship. My concern is due to the reason that if I were to fit a regression model here, it is better to use linear mixed effects model than the simple linear regression model due to the repeated observatios.
So, my question is: Is it okay for me to use pearson correlation coefficient as I am using it here? Or should I use a different method?