r语言 - 系统发育相关性检验



我需要在两个变量之间执行相关测试(返回r,t和p.value(,以解释个体之间的系统发育相关结构。在 R 中有什么简单的方法可以做到这一点吗?

ape包中,特别是?ape::pic("系统发育独立的对比"(:

library(ape)
cat("((((Homo:0.21,Pongo:0.21):0.28,",
"Macaca:0.49):0.13,Ateles:0.62):0.38,Galago:1.00);",
file = "ex.tre", sep = "n")
tree.primates <- read.tree("ex.tre")
X <- c(4.09434, 3.61092, 2.37024, 2.02815, -1.46968)
Y <- c(4.74493, 3.33220, 3.36730, 2.89037, 2.30259)
names(X) <- names(Y) <- c("Homo", "Pongo", "Macaca", "Ateles", "Galago")
pic.X <- pic(X, tree.primates)
pic.Y <- pic(Y, tree.primates)
cor.test(pic.X, pic.Y)
# Pearson's product-moment correlation
# 
# data:  pic.X and pic.Y
# t = -0.85623, df = 2, p-value = 0.4821
# alternative hypothesis: true correlation is not equal to 0
# 95 percent confidence interval:
# -0.9874751  0.8823934
# sample estimates:
# cor 
# -0.5179156 

如果你打算做大部分这项工作,你可能想得到Paradis的R系统发育和进化分析,并查看系统发育任务视图。

最新更新