cor.mtest function

It is correct the following script to extract p value from cor function?

matrix_pvalue = cor(c_tnf, use = "pairwise.complete.obs", method = c("spearman")) %>% cor.mtest(conf.level = 0.95)

I believe there are some inconsistencies with the p value matrix generated by the corr.test function, is this possible?
Can someone help me?
Thank you!

1 Like

It is very hard to answer your question without more information. If you don't get any error with the code, what about the result makes you suspect there is a problem? What is the nature of your data? Can you post some or all of the data?
The dput() function gives output that allows others to copy your data. If you run

dput(c_tng)

and post the output here, other people can make a copy of your c_tng matrix.

Thanks for your reply!
Here, some more info for help:

dput(c_tnf)
structure(list(sars.t0TNF_miR07 = c(19.65, NA, 18.72, 20.2, 13.86,
10.57, 14.08, 24.44, 12.81, 13.67, 4.57, 16.61, 1.01, 19.11,
20.24, 14.06, 19.54, 20.95, 16.12, 17.97, 10.68, 18.02, 14.35,
15.68), sars.t0TNF_SVRNA1 = c(18.32, NA, 17.46, 18.44, 10.38,
15.11, 16.45, 22.32, 10.6, 15.61, 5.73, 13.27, 17.82, 15.73,
13.95, 7.47, 14.32, 19.03, 11.05, 1.1, 1.1, 14.25, 12.33, 1.1
), sars.t0TNF_SVRNA2 = c(19.06, NA, 19, 20.72, 17.86, 15.56,
20.18, 21.42, 9.5, 17.2, 5.9, 15.08, 18.58, 18.59, 19.88, 10.26,
19.44, 19.95, 1.1, 17.78, 1.1, 14.77, 12.61, 16.69), sars.t0TNF_SERINC5 = c(0.02,
NA, 0.02, 0.02, 0.15, 0.12, 0.12, 0.1, 0.15, 0.02, 0.02, 0.15,
0.16, 0.14, 0.02, 0.14, 0.1, 0.02, 0.02, 0.2, 0.14, 0.25, 0.15,
0.02), sars.t0TNF_IFN = c(4.001667, NA, 0.671667, 1.561667, 2.841667,
0.051667, 0.251667, 0.14833, 2.521667, 1.331667, 1.131667, 2.481667,
2.581667, 1.641667, 0.491667, 3.721667, 2.901667, 0.901667, 2.061667,
4.891667, 1.191667, 4.751667, 2.801667, 4.201667), sars.t0TNF_ISG20 = c(0.1666623346364,
NA, 0.0375511265477141, 0.00135734201156478, 3.64177167673255e-05,
5.60443356810879e-06, 0.000122494109925476, 0.00411469154669858,
0.000400752738677, 0.00778547080334271, 0.000222331502341791,
0.000223877940235516, 4.15995686594108e-06, 0.0074683227937011,
0.00016275618616836, 0.0399682994149197, 0.0627169842818439,
0.00163669362239833, 0.00239625972119883, 0.0868698887401459,
0.0352801376501915, 0.157672176103906, 0.181117769319359, 0.0284584322997493
), sars.t0TNF_CCL20 = c(25.085, NA, 22.655, 22.585, 19.535, 18.445,
21.625, 16.425, 18.525, 20.625, 21.815, 20.305, 21.655, 18.745,
19.565, 16.655, 20.075, 20.345, 23.365, 21.175, 20.615, 20.335,
21.235, 22.405)), class = "data.frame", row.names = c(NA, -24L
))

matrix_pvalue = cor(c_tnf, use = "pairwise.complete.obs", method = c("spearman")) %>% cor.mtest(conf.level = 0.95)
matrix_pvalue
$p
sars.t0TNF_miR07 sars.t0TNF_SVRNA1 sars.t0TNF_SVRNA2 sars.t0TNF_SERINC5 sars.t0TNF_IFN sars.t0TNF_ISG20
sars.t0TNF_miR07 0.00000000 0.0545512616 0.0193225652 0.06020105 0.1352046192 0.88469298
sars.t0TNF_SVRNA1 0.05455126 0.0000000000 0.0008013381 0.07346774 0.0008958375 0.14428290
sars.t0TNF_SVRNA2 0.01932257 0.0008013381 0.0000000000 0.07851395 0.0071831480 0.18219763
sars.t0TNF_SERINC5 0.06020105 0.0734677374 0.0785139492 0.00000000 0.1113690103 0.76853293
sars.t0TNF_IFN 0.13520462 0.0008958375 0.0071831480 0.11136901 0.0000000000 0.08023793
sars.t0TNF_ISG20 0.88469298 0.1442829041 0.1821976328 0.76853293 0.0802379285 0.00000000
sars.t0TNF_CCL20 0.88515556 0.9302839117 0.8203544053 0.16960666 0.9929011574 0.73300307
sars.t0TNF_CCL20
sars.t0TNF_miR07 0.8851556
sars.t0TNF_SVRNA1 0.9302839
sars.t0TNF_SVRNA2 0.8203544
sars.t0TNF_SERINC5 0.1696067
sars.t0TNF_IFN 0.9929012
sars.t0TNF_ISG20 0.7330031
sars.t0TNF_CCL20 0.0000000

cor.test( x = sars$t0TNF_SVRNA2, y = sars$t0TNF_miR07, alternative = c("two.sided"), method = c("spearman"), exact = F, conf.level = 0.95)

Spearman's rank correlation rho

data: sars$t0TNF_SVRNA2 and sars$t0TNF_miR07
S = 667.66, p-value = 0.0004679
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.670126

many thanks