如何比较两个独立组的两个相关值?

How to compare twocorrelation values for two independenet groups?

我有来自两个独立群体的相关值

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

您必须使用 Fisher 的 z 检验。 cocor r 包具有使用相关值进行测试的功能。 cocor r package cran 从包中我们必须使用 cocor.indep.groups() 函数。我们以这种方式指定第一相关值、第二相关值、第一组大小、第二组大小、测试方向和 alpha 值 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)