我正在尝试循环 2 个对象来计算与表示列值的对象之一的相关性

问题描述 投票:0回答:1

我正在尝试将 TRE、Run-in 和 Control 的列关联在一起。但是,我想通过另一列的值来完成此操作(因此它一次只会关联某些行)

这是我的数据:

change<-structure(list(Subject.ID = c(168236L, 168236L, 168236L, 168236L, 
168236L, 168236L, 168236L, 168236L, 168236L, 168695L, 168695L, 
168695L, 168695L, 168695L, 168695L, 168695L, 168695L, 168695L, 
168695L, 168696L, 168696L, 168696L, 168696L, 168696L, 168696L, 
168696L, 168696L, 168696L, 168696L, 168914L, 168914L, 168914L, 
168914L, 168914L, 168914L, 168914L, 168914L, 168914L, 169242L, 
169242L, 169242L, 169242L, 169242L, 169242L, 169242L, 169242L, 
169242L, 169242L, 169728L, 169728L, 169728L, 169728L, 169728L, 
169728L, 169728L, 169728L, 169728L, 169728L, 170992L, 170992L, 
170992L, 170992L, 170992L, 170992L, 170992L, 170992L, 170992L, 
170992L, 172482L, 172482L, 172482L, 172482L, 172482L, 172482L, 
172482L, 172482L, 172482L, 172482L, 172483L, 172483L, 172483L, 
172483L, 172483L, 172483L, 172483L, 172483L, 172483L, 172483L, 
172490L, 172490L, 172490L, 172490L, 172490L, 172490L, 172490L, 
172490L, 172490L, 172490L), Result.Test.Mnemonic = c("Glucose", 
"Chol", "Trig", "HDL", "LDL Direct", "NONHDLCHOL", "VLDL C", 
"High Sens CRP", "Insulin Fasting", "Glucose", "Chol", "Trig", 
"HDL", "LDL Direct", "NONHDLCHOL", "VLDL C", "High Sens CRP", 
"Insulin Fasting", "C Peptide", "Glucose", "Chol", "Trig", "HDL", 
"LDL Direct", "VLDL C", "NONHDLCHOL", "High Sens CRP", "Insulin Fasting", 
"C Peptide", "Glucose", "Chol", "Trig", "HDL", "LDL Direct", 
"NONHDLCHOL", "VLDL C", "High Sens CRP", "Insulin Fasting", "Glucose", 
"Chol", "Trig", "HDL", "LDL Direct", "NONHDLCHOL", "VLDL C", 
"High Sens CRP", "Insulin Fasting", "C Peptide", "Glucose", "Chol", 
"Trig", "HDL", "LDL Direct", "NONHDLCHOL", "VLDL C", "High Sens CRP", 
"Insulin Fasting", "C Peptide", "Glucose", "Chol", "Trig", "HDL", 
"LDL Direct", "VLDL C", "NONHDLCHOL", "High Sens CRP", "Insulin Fasting", 
"C Peptide", "Glucose", "Chol", "Trig", "HDL", "LDL Direct", 
"NONHDLCHOL", "VLDL C", "High Sens CRP", "Insulin Fasting", "C Peptide", 
"Glucose", "Chol", "Trig", "HDL", "LDL Direct", "VLDL C", "NONHDLCHOL", 
"High Sens CRP", "Insulin Fasting", "C Peptide", "Glucose", "Chol", 
"Trig", "HDL", "LDL Direct", "NONHDLCHOL", "VLDL C", "High Sens CRP", 
"Insulin Fasting", "C Peptide"), `Run-in` = c(83, 137, 68, 50, 
79, 87, 8, 1.3, 10, 96, 149, 96, 57, 78, 92, 14, 4.6, 12, 2.2, 
99, 203, 68, 65, 129, 9, 138, 6.3, 10, 1.5, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, 84, 141, 119, 38, 87, 103, 16, 0.9, 15, 2.6, 
90, 163, 77, 48, 103, 115, 12, NA, 9, 1.9, 102, 177, 126, 38, 
118, 21, 139, 2.9, 18, 3, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, 122, 207, 144, 36, 152, 19, 171, 4, 55, 4.4, 100, 186, 247, 
39, 111, 147, 36, 3.5, 24, 3.1), TRE = c(NA, NA, NA, NA, NA, 
NA, NA, NA, NA, 91, 149, 80, 57, 80, 92, 12, 5.4, 7, 1.7, 98, 
181, 80, 52, 117, 12, 129, 1, 14, 1.7, 95, 274, 228, 46, 197, 
228, 31, 3, 24, 88, 123, 82, 39, 77, 84, 7, 0.7, 16, 2.3, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, 101, 172, 83, 44, 117, 11, 
128, 11.3, 14, 1.9, 87, 175, 127, 46, 109, 129, 20, 1.7, 10, 
2.1, 111, 201, 94, 37, 150, 14, 164, 3.6, 37, 3.3, 98, 200, 344, 
39, 109, 161, 52, 3.2, 21, 2.6), Control = c(NA, NA, NA, NA, 
NA, NA, NA, NA, NA, 96, 140, 59, 55, 75, 85, 10, 3.2, 8, 1.8, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, 93, 137, 79, 39, 90, 98, 8, 1, 24, 2.5, 93, 152, 
60, 49, 94, 103, 9, NA, 6, 1.5, 106, 167, 90, 42, 112, 13, 125, 
17, 13, 2, 86, 165, 112, 52, 102, 113, 11, 1.6, 19, 2.2, 107, 
188, 104, 34, 137, 17, 154, 4.6, 36, 3.6, 104, 188, 403, 37, 
97, 151, 54, 6, 35, 3.4), Change_Run_Control = c(NA, NA, NA, 
NA, NA, NA, NA, NA, NA, 0, 9, 37, 2, 3, 7, 4, 1.4, 4, 0.4, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, 9, 4, 40, 1, 3, 5, 8, 0.1, 9, 0.1, 3, 11, 17, 1, 9, 12, 
3, NA, 3, 0.4, 4, 10, 36, 4, 6, 8, 14, 14.1, 5, 1, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, 15, 19, 40, 2, 15, 2, 17, 0.6, 19, 
0.8, 4, 2, 156, 2, 14, 4, 18, 2.5, 11, 0.3), Change_Run_TRE = c(NA, 
NA, NA, NA, NA, NA, NA, NA, NA, 5, 0, 16, 0, 2, 0, 2, 0.800000000000001, 
5, 0.5, 1, 22, 12, 13, 12, 3, 9, 5.3, 4, 0.2, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, 4, 18, 37, 1, 10, 19, 9, 0.2, 1, 0.3, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1, 5, 43, 6, 1, 10, 11, 8.4, 
4, 1.1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 11, 6, 50, 1, 
2, 5, 7, 0.4, 18, 1.1, 2, 14, 97, 0, 2, 14, 16, 0.3, 3, 0.5), 
    Change_Control_TRE = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    5, 9, 21, 2, 5, 7, 2, 2.2, 1, 0.1, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5, 14, 
    3, 0, 13, 14, 1, 0.3, 8, 0.2, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, 5, 5, 7, 2, 5, 2, 3, 5.7, 1, 0.1, 1, 10, 15, 
    6, 7, 16, 9, 0.0999999999999999, 9, 0.1, 4, 13, 10, 3, 13, 
    3, 10, 1, 1, 0.3, 6, 12, 59, 2, 12, 10, 2, 2.8, 14, 0.8)), row.names = c(NA, 
-98L), class = c("tbl_df", "tbl", "data.frame"))

这是其中一个相关性在循环之外的样子(及其功能):

cor.test(change$`Run-in`[change$Result.Test.Mnemonic== "C Peptide"] , change$Control[change$Result.Test.Mnemonic== "C Peptide"])

我无法让我的循环工作。这是我到目前为止所拥有的:


# Define phases and variables
phases <- c("`Run-in`", "Control", "TRE")
variables <- c(unique(change$Result.Test.Mnemonic))


# Loop over phases and variables
for (variable in variables) {
  for (i in 1:(length(phases)-1)) {
    for (j in (i+1):length(phases)) {
      (paste0("correlation<-cor.test(",
        "change$", phases[i], "[change$Result.Test.Mnemonic == '", variable, "'],change$", phases[j],
        "[change$Result.Test.Mnemonic== '", variable, "'])"))
    }
  }
}

语法似乎可以运行,但它不会输出任何我可以直观看到的内容来评估相关性。我认为这与我使用paste0函数的方式有关。但我不确定我做错了什么。

我尝试在 cor.test 函数内部使用 Paste0 函数(在相关性的每一侧使用两次)。但这没有用。它似乎抛出了一个错误,因为 cor.test 需要给它提供数字数据。

r for-loop correlation
1个回答
0
投票

尝试类似这样的操作,将结果存储在

list()
中并将每个字符串作为表达式求值:

phases <- c("`Run-in`", "Control", "TRE")
variables <- c(unique(change$Result.Test.Mnemonic))
list_results <- list()

# Loop over phases and variables
for (variable in variables) {
  for (i in 1:(length(phases)-1)) {
    for (j in (i+1):length(phases)) {
      x <- (eval(str2lang(paste0("correlation<-cor.test(",
              "change$", phases[i], "[change$Result.Test.Mnemonic == '", variable, "'],change$", phases[j],
              "[change$Result.Test.Mnemonic== '", variable, "'])"))))
      list_results <- append(list_results, list(x))
    }
  }
}

list_results
#> [[1]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Glucose"] and change$Control[change$Result.Test.Mnemonic == "Glucose"]
#> t = 3.193, df = 4, p-value = 0.03312
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.1150259 0.9829707
#> sample estimates:
#>       cor 
#> 0.8474749 
#> 
#> 
#> [[2]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Glucose"] and change$TRE[change$Result.Test.Mnemonic == "Glucose"]
#> t = 7.2959, df = 4, p-value = 0.001876
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.703402 0.996239
#> sample estimates:
#>       cor 
#> 0.9644203 
#> 
#> 
#> [[3]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "Glucose"] and change$TRE[change$Result.Test.Mnemonic == "Glucose"]
#> t = 3.9877, df = 4, p-value = 0.0163
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.2997933 0.9884098
#> sample estimates:
#>       cor 
#> 0.8938744 
#> 
#> 
#> [[4]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Chol"] and change$Control[change$Result.Test.Mnemonic == "Chol"]
#> t = 6.6847, df = 4, p-value = 0.002604
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6583485 0.9955516
#> sample estimates:
#>      cor 
#> 0.958039 
#> 
#> 
#> [[5]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Chol"] and change$TRE[change$Result.Test.Mnemonic == "Chol"]
#> t = 4.2587, df = 4, p-value = 0.01307
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.3526332 0.9896963
#> sample estimates:
#>       cor 
#> 0.9051543 
#> 
#> 
#> [[6]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "Chol"] and change$TRE[change$Result.Test.Mnemonic == "Chol"]
#> t = 8.0578, df = 4, p-value = 0.001288
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.7487535 0.9968957
#> sample estimates:
#>       cor 
#> 0.9705506 
#> 
#> 
#> [[7]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Trig"] and change$Control[change$Result.Test.Mnemonic == "Trig"]
#> t = 6.9099, df = 4, p-value = 0.002301
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6759846 0.9958250
#> sample estimates:
#>       cor 
#> 0.9605728 
#> 
#> 
#> [[8]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Trig"] and change$TRE[change$Result.Test.Mnemonic == "Trig"]
#> t = 4.6785, df = 4, p-value = 0.009458
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.4253719 0.9913137
#> sample estimates:
#>       cor 
#> 0.9195057 
#> 
#> 
#> [[9]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "Trig"] and change$TRE[change$Result.Test.Mnemonic == "Trig"]
#> t = 18.708, df = 4, p-value = 4.806e-05
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.9468272 0.9994091
#> sample estimates:
#>      cor 
#> 0.994334 
#> 
#> 
#> [[10]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "HDL"] and change$Control[change$Result.Test.Mnemonic == "HDL"]
#> t = 6.3865, df = 4, p-value = 0.003085
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6329137 0.9951470
#> sample estimates:
#>       cor 
#> 0.9543003 
#> 
#> 
#> [[11]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "HDL"] and change$TRE[change$Result.Test.Mnemonic == "HDL"]
#> t = 3.8004, df = 4, p-value = 0.0191
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.2603709 0.9873808
#> sample estimates:
#>       cor 
#> 0.8849385 
#> 
#> 
#> [[12]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "HDL"] and change$TRE[change$Result.Test.Mnemonic == "HDL"]
#> t = 4.7233, df = 4, p-value = 0.00915
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.4325193 0.9914639
#> sample estimates:
#>       cor 
#> 0.9208482 
#> 
#> 
#> [[13]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "LDL Direct"] and change$Control[change$Result.Test.Mnemonic == "LDL Direct"]
#> t = 9.5007, df = 4, p-value = 0.000685
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.8112529 0.9977474
#> sample estimates:
#>      cor 
#> 0.978553 
#> 
#> 
#> [[14]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "LDL Direct"] and change$TRE[change$Result.Test.Mnemonic == "LDL Direct"]
#> t = 9.6744, df = 4, p-value = 0.0006388
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.8172278 0.9978258
#> sample estimates:
#>       cor 
#> 0.9792925 
#> 
#> 
#> [[15]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "LDL Direct"] and change$TRE[change$Result.Test.Mnemonic == "LDL Direct"]
#> t = 6.1285, df = 4, p-value = 0.003592
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6087787 0.9947513
#> sample estimates:
#>       cor 
#> 0.9506571 
#> 
#> 
#> [[16]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "NONHDLCHOL"] and change$Control[change$Result.Test.Mnemonic == "NONHDLCHOL"]
#> t = 7.6117, df = 4, p-value = 0.001599
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.7234910 0.9965341
#> sample estimates:
#>       cor 
#> 0.9671709 
#> 
#> 
#> [[17]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "NONHDLCHOL"] and change$TRE[change$Result.Test.Mnemonic == "NONHDLCHOL"]
#> t = 5.725, df = 4, p-value = 0.004608
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.5665669 0.9940305
#> sample estimates:
#>       cor 
#> 0.9440503 
#> 
#> 
#> [[18]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "NONHDLCHOL"] and change$TRE[change$Result.Test.Mnemonic == "NONHDLCHOL"]
#> t = 6.7526, df = 4, p-value = 0.002508
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6638006 0.9956367
#> sample estimates:
#>       cor 
#> 0.9588273 
#> 
#> 
#> [[19]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "VLDL C"] and change$Control[change$Result.Test.Mnemonic == "VLDL C"]
#> t = 6.7504, df = 4, p-value = 0.002511
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6636268 0.9956340
#> sample estimates:
#>       cor 
#> 0.9588023 
#> 
#> 
#> [[20]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "VLDL C"] and change$TRE[change$Result.Test.Mnemonic == "VLDL C"]
#> t = 3.7879, df = 4, p-value = 0.0193
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.2576597 0.9873077
#> sample estimates:
#>       cor 
#> 0.8843066 
#> 
#> 
#> [[21]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "VLDL C"] and change$TRE[change$Result.Test.Mnemonic == "VLDL C"]
#> t = 7.5296, df = 4, p-value = 0.001666
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.7184565 0.9964608
#> sample estimates:
#>       cor 
#> 0.9664869 
#> 
#> 
#> [[22]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "High Sens CRP"] and change$Control[change$Result.Test.Mnemonic == "High Sens CRP"]
#> t = 0.1571, df = 3, p-value = 0.8851
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  -0.8605146  0.9008071
#> sample estimates:
#>        cor 
#> 0.09033273 
#> 
#> 
#> [[23]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "High Sens CRP"] and change$TRE[change$Result.Test.Mnemonic == "High Sens CRP"]
#> t = -0.17785, df = 4, p-value = 0.8675
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  -0.8397710  0.7789816
#> sample estimates:
#>         cor 
#> -0.08857772 
#> 
#> 
#> [[24]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "High Sens CRP"] and change$TRE[change$Result.Test.Mnemonic == "High Sens CRP"]
#> t = 5.2691, df = 4, p-value = 0.006216
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.5112962 0.9930266
#> sample estimates:
#>       cor 
#> 0.9349158 
#> 
#> 
#> [[25]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Insulin Fasting"] and change$Control[change$Result.Test.Mnemonic == "Insulin Fasting"]
#> t = 2.3747, df = 4, p-value = 0.07643
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  -0.1231010  0.9726627
#> sample estimates:
#>       cor 
#> 0.7648743 
#> 
#> 
#> [[26]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "Insulin Fasting"] and change$TRE[change$Result.Test.Mnemonic == "Insulin Fasting"]
#> t = 6.449, df = 4, p-value = 0.002976
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.6384538 0.9952362
#> sample estimates:
#>       cor 
#> 0.9551233 
#> 
#> 
#> [[27]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "Insulin Fasting"] and change$TRE[change$Result.Test.Mnemonic == "Insulin Fasting"]
#> t = 3.1432, df = 4, p-value = 0.03474
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.1018870 0.9825158
#> sample estimates:
#>      cor 
#> 0.843686 
#> 
#> 
#> [[28]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "C Peptide"] and change$Control[change$Result.Test.Mnemonic == "C Peptide"]
#> t = 3.3098, df = 4, p-value = 0.02966
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.1450989 0.9839733
#> sample estimates:
#>       cor 
#> 0.8558752 
#> 
#> 
#> [[29]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$`Run-in`[change$Result.Test.Mnemonic == "C Peptide"] and change$TRE[change$Result.Test.Mnemonic == "C Peptide"]
#> t = 4.1196, df = 4, p-value = 0.01462
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.3261270 0.9890636
#> sample estimates:
#>       cor 
#> 0.8995915 
#> 
#> 
#> [[30]]
#> 
#>  Pearson's product-moment correlation
#> 
#> data:  change$Control[change$Result.Test.Mnemonic == "C Peptide"] and change$TRE[change$Result.Test.Mnemonic == "C Peptide"]
#> t = 6.0162, df = 4, p-value = 0.003844
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  0.5976075 0.9945642
#> sample estimates:
#>       cor 
#> 0.9489383

创建于 2024-03-20,使用 reprex v2.1.0

© www.soinside.com 2019 - 2024. All rights reserved.