[英]How to compute the average of correlated values?
讓我們假設以下向量:
x = c( 0.5, 0.4, 0.8 )
其中 x[1] 和 x[2] 值是相關的,相關矩陣為:
x[1] x[2] x[3]
x[1] 1 0.8 0
x[2] 0.8 1 0
x[3] 0 0 1
我想計算 x 的平均值,但要考慮相關性。
我嘗試使用 lm() 使用廣義最小二乘法,但這意味着使用水平 function,而 lm() 不喜歡使用 poly(x,0)。 我尋找使用用戶定義的function,但它應該返回要擬合的參數......
作為一個具體的例子,讓我們從進化樹中取出三個物種:
library(ape)
## The evolution tree
t=rtree(3)
## Plot it, you notice that two are closer to each other than the 3rd one
plot(t)
## Correlation matrix
vcv.phylo(t,corr=T)
t1 t3 t2
t1 1.0000000 0.4019544 0
t3 0.4019544 1.0000000 0
t2 0.0000000 0.0000000 1
歡迎任何提示!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.