Как сравнить значения двойной корреляции для двух независимых групп enet? - PullRequest
0 голосов
/ 09 мая 2020

У меня есть значения корреляции, полученные из двух независимых популяций

structure(list(Gene = structure(1:6, .Label = c("Gene_1", "Gene_2", 
"Gene_3", "Gene_4", "Gene_5", "Gene_6"), class = "factor"), WT = c(0.71, 
-0.37, 0.43, -0.07, 0.1, 0.16), mut = c(-0.11, 0, 0.42, 0.4, 
0.42, 0.49)), class = "data.frame", row.names = c(NA, -6L))

Как я могу сравнить эти два значения корреляции для каждого гена?

Односторонний : WT больше чем mut

α = 0,05

WT n = 9

mut n = 18

1 Ответ

1 голос
/ 09 мая 2020

Вы должны использовать z-критерий Фишера. Пакет cocor r имеет эту функцию для выполнения этого теста с использованием значений корреляции. cocor r package cran Из пакета мы используем функцию cocor.indep.groups (). Таким образом мы указываем первое значение корреляции, второе значение корреляции, размер первой группы, размер второй группы, направление теста и альфа-значение. cocor.indep.groups(0.71,-0.11,9,18, alternative="greater",alpha=0.05) На основе значения p вы можете отклонить или не отклонять нулевую гипотезу. Выходные данные дают результаты о нулевой гипотезе. Использование ваших данных в качестве первого примера кадра данных df, указав

    # load the library
    library(cocor)
    # perform test for two independent group
    cocor.indep.groups(df$WT[df$Gene == "Gene_1"],
                       df$mut[df$Gene == "Gene_1"],
                       9,
                       18,
                       alternative = "greater",
                       alpha = 0.05)
    # perfrom for each gene using for loop
    for (gene in unique(df$Gene)) {
        paste("Gene", gene)
        print(cocor.indep.groups(
            df$WT[df$Gene == gene],
            df$mut[df$Gene == gene],
            9,
            18,
            alternative = "greater",
            alpha = 0.05
        ))
    }

Вывод:

          Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = 0.71 and r2.hm = -0.11
    Difference: r1.jk - r2.hm = 0.82
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = 2.0653, p-value = 0.0194
      Null hypothesis rejected

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: 0.0296 1.3125
      Null hypothesis rejected (Lower boundary > 0)


      Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = 0.71 and r2.hm = -0.11
    Difference: r1.jk - r2.hm = 0.82
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = 2.0653, p-value = 0.0194
      Null hypothesis rejected

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: 0.0296 1.3125
      Null hypothesis rejected (Lower boundary > 0)


      Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = -0.37 and r2.hm = 0
    Difference: r1.jk - r2.hm = -0.37
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = -0.8041, p-value = 0.7893
      Null hypothesis retained

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: -1.0255 0.5219
      Null hypothesis retained (Lower boundary <= 0)


      Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = 0.43 and r2.hm = 0.42
    Difference: r1.jk - r2.hm = 0.01
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = 0.0253, p-value = 0.4899
      Null hypothesis retained

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: -0.8131 0.6472
      Null hypothesis retained (Lower boundary <= 0)


      Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = -0.07 and r2.hm = 0.4
    Difference: r1.jk - r2.hm = -0.47
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = -1.0222, p-value = 0.8467
      Null hypothesis retained

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: -1.1827 0.3743
      Null hypothesis retained (Lower boundary <= 0)


      Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = 0.1 and r2.hm = 0.42
    Difference: r1.jk - r2.hm = -0.32
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = -0.7191, p-value = 0.7640
      Null hypothesis retained

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: -1.0942 0.4603
      Null hypothesis retained (Lower boundary <= 0)


      Results of a comparison of two correlations based on independent groups

    Comparison between r1.jk = 0.16 and r2.hm = 0.49
    Difference: r1.jk - r2.hm = -0.33
    Group sizes: n1 = 9, n2 = 18
    Null hypothesis: r1.jk is equal to r2.hm
    Alternative hypothesis: r1.jk is greater than r2.hm (one-sided)
    Alpha: 0.05

    fisher1925: Fisher's z (1925)
      z = -0.7756, p-value = 0.7810
      Null hypothesis retained

    zou2007: Zou's (2007) confidence interval
      95% confidence interval for r1.jk - r2.hm: -1.1095 0.4142
      Null hypothesis retained (Lower boundary <= 0)
...