Search code examples
rregressioncorrelationweighted-average

How to compute the average of correlated values?


Let us assume the following vector:

x = c( 0.5, 0.4, 0.8 )

where the x[1] and x[2] values are correlated, with the correlation matrix:

     x[1]  x[2]  x[3]
x[1]  1    0.8    0
x[2]  0.8  1      0
x[3]  0    0      1

I want to compute the average of x, but taking in account the correlations.

I tried with a generalised least squares with lm(), but that implies to use an horizontal function, and lm() does not like it with poly(x,0). I looked for using a user-defined function, but it should return the parameter to be fitted…

As a concrete example, let us take three species from an evolution tree:

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

Any tip welcome!


Solution

  • The answer can be found in that CERN paper: preprint (HTTPS), preprint (FTP) or the published copy.

    The procedure is a generalised least square regression.

    See the equation (2) page (1) for the result.