1

I want to plot a boxplot figure using ggpaired from ggpubr to compare the two conditions of the following dataframe. So you can see that the csv consists of 3 data pairs (-FLS, UT) coming from 3 experiments (E2020-36, E2021-04, E2021-06). Calculation of p-value is done using stat_compare_means, however, I have the feeling that the wrong values are paired when I run a paired t-test. When I run an unpaired test, p = 0.032. When I run a paired T-test, p = 0.094. However, in my view a paired t-test would be appropriate for this calculation, since the pairs to be compared come from 3 separate biological replicates. So this should result rather in an even lower p-value than in a higher one. Maybe someone can help me out and explain what's happening here...

Thanks, Max

testdata.csv:

"condition","experiment","CD69"
"UT","E2020-36",15.2
"-FLS","E2020-36",5.47
"UT","E2021-04",17.45
"-FLS","E2021-04",4.98
"UT","E2021-06",10.9
"-FLS","E2021-06",7.8

Code:

test1 <- read.csv("testdata.csv")

ggpaired(test1, x = "condition", y = "CD69", id = "experiment",
         color = "condition", line.color = "gray", line.size = 0.4,
         palette = "jco") +
  labs(y = "% CD69+", subtitle = "N = 3 patients (biol. replicates), paired t-test") +
  stat_compare_means(method = "t.test", paired = TRUE)

IMG Boxplot, paired T-test

MaxRH
  • 11
  • 2
  • 1
    I have just calculated the p-values with `t.test`. It reproduces these p-values. You'll have to readjust your feelings ... I'm not sure how you arrived at the misconceptions that the p-value from a paired t-test is always lower than from an unpaired t-test (setting aside that if one is appropriate the other is not). – Roland Feb 16 '21 at 07:36

1 Answers1

0

For the unpaired t-test, the formula for t is t = (mean_ut - mean_fls)/sqrt((var_ut/3) + (var_ut/3)) ~ 3.99 For the paired t-test, it is mean(ut-fls)/sqrt(var(ut-fls)/3) ~ 3.03

Which might mean that one of the experiments (e2021-06) is so different from the others that the difference (in the paired t-test) is causing a larger variance among experiments. Whereas the variance of the experiments within each condition is not so high. This suggests an interaction effect between condition and experiment.

rdodhia
  • 350
  • 2
  • 9