[英]R variable correlation
對於此數據集,基線:t3的值是腫瘤大小,我想看看一個對象的腫瘤大小變化與PCR值之間的關系(PCR = 0表示仍有活躍的癌細胞,PCR = 1表示癌症細胞都消失了)。
基本上我想看看腫瘤大小變化與PCR值之間是否有任何相關性。
感謝幫助!
SUBJECTID Baseline t1 t2 t3 PCR
1001 88 78 30 14 0
1002 29 26 66 16 0
1003 50 64 54 46 0
1004 91 90 99 43 0
1005 98 109 60 42 0
1007 100 100 54 0
1008 45 49 47 32 0
1009 75 66 57 7 0
1010 60 52 20 3 1
1011 68 68 56 47 1
1012 78 84 56 57 0
1013 71 70 8 5 0
1015 79 50 11 3 1
1016 73 60 57 36 0
1017 54 27 16 0
1018 50 37 33 26 0
1019 115 68 33 67 0
1021 63 55 0 0 1
1022 98 91 76 75 0
1024 76 76 0 0
1025 47 45 42 42
1026 32 25 14 0 1
1027 40 37 65 0
1028 60 110 110 0 0
看起來像t檢驗就足夠了。 由於數據參差不齊,因此需要輸入一些額外的數據:
dput(dfrm)
structure(list(SUBJECTID = c(1001L, 1002L, 1003L, 1004L, 1005L,
1007L, 1008L, 1009L, 1010L, 1011L, 1012L, 1013L, 1015L, 1016L,
1017L, 1018L, 1019L, 1021L, 1022L, 1024L, 1025L, 1026L, 1027L,
1028L), Baseline = c(88L, 29L, 50L, 91L, 98L, 100L, 45L, 75L,
60L, 68L, 78L, 71L, 79L, 73L, 54L, 50L, 115L, 63L, 98L, 76L,
47L, 32L, 40L, 60L), t1 = c(78L, 26L, 64L, 90L, 109L, 100L, 49L,
66L, 52L, 68L, 84L, 70L, 50L, 60L, 27L, 37L, 68L, 55L, 91L, 76L,
45L, 25L, 37L, 110L), t2 = c(30L, 66L, 54L, 99L, 60L, NA, 47L,
57L, 20L, 56L, 56L, 8L, 11L, 57L, 16L, 33L, 33L, 0L, 76L, 76L,
42L, 14L, 65L, 110L), t3 = c(14L, 16L, 46L, 43L, 42L, 54L, 32L,
7L, 3L, 47L, 57L, 5L, 3L, 36L, NA, 26L, 67L, 0L, 75L, 0L, 42L,
0L, NA, 0L), PCR = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L,
0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L)), .Names = c("SUBJECTID",
"Baseline", "t1", "t2", "t3", "PCR"), class = "data.frame", row.names = c(NA,
-24L))
> t.test(dfrm$t3[dfrm$PCR==0], dfrm$t3[dfrm$PCR==1] )
Welch Two Sample t-test
data: dfrm$t3[dfrm$PCR == 0] and dfrm$t3[dfrm$PCR == 1]
t = 2.0916, df = 7.3971, p-value = 0.07267
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.658325 47.575972
sample estimates:
mean of x mean of y
33.05882 10.60000
這實際上不是“相關性”,而是由PCR定義的兩組中平均大小的兩組比較。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.