简体   繁体   English

从重复的检验中提取p值

[英]Extractin p.values from a replicated cor.test

I have performed a correlation test to a randomized set of variables. 我已经对一组随机变量进行了相关性测试。

replicate(1000, cor.test(sample(v1),sample(v2))) 复制(1000,cor.test(sample(v1),sample(v2)))

I would like to obtain the p.values from each test in a vector for further analysis, how can I do so? 我想从向量中的每个测试中获取p.value进行进一步分析,我该怎么做?

Thanks a lot! 非常感谢!

If you only need the p values of the replications you can just index it in the replications. 如果只需要复制的p值,则可以在复制中为其建立索引。 replicate will simplify the results in an array (vector here) by default: 默认情况下, replicate将简化数组中的结果(此处为向量):

replicate(1000, cor.test(sample(rnorm(100)),sample(rnorm(100)))$p.value)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM