Hi,

Xavier: if I understand correctly what you describe, this can be done with:

V <- vcv(phy, corr = TRUE)
diag(V) <- 0

vcv() returns the expected variance-covariance matrix under Brownian motion for a given tree. If this tree is not ultrametric (I guess this is what you mean with "where the tips do not have the same lengths") then it is correct that the variances are not the same. Note that if a tree is rescaled (say by multiplying its branch lengths) then the result of vcv() will be different but vcv(, corr = TRUE) will return the same (correlation) matrix.

Anyway, if you really found some "wrong results", please report this.

Sandra: thanks for solving your problem by yourself _and_ giving some feedback on the list. I guess the information you needed can be found in the vignette delivered with ape.

Best,

Emmanuel

Le 01/08/2013 22:13, Xavier Prudent a écrit :
Salut Sandra,

I have experienced that the matrix given by vcv can lead to wrong results
if taken as a correlation matrix in the case of trees where the tips do not
have the same lengths.
I then built my own correlation, using the common branch length shared by
two tips, normalized by this same length plus the lengths of the last
branches of these tips.
The diagonals being forced to zero.

If you are interested in it, I can send you the code,
cheers,
Xavier


2013/8/1 sandra goutte <gou...@mnhn.fr>

Ok so i found out what i was doing wrong and i just answer my own post so
nobody will waste time answering me: i was not making a proper weight
matrix using vcv(), so i fixed the problem by using 1/distance matrix from
this variance-covariance matrix and then fixing the sum of each row to 1.
Now the Moran.I behaves as expected with random data for both OU and BM
models.

Sandra.



2013/7/29 sandra goutte <gou...@mnhn.fr>

Dear list,

I am trying to run a gls with an OU correlation structure using
corMartins. I first wanted to check whether i had a phylogenetic
autocorrelation in my trait, so i used the Moran's I index (Moran.I):

vcovm<-vcv(corMartins(1,tree, fixed=T))
Moran.I(trait, vcovm, alt="greater")

And i obtained a p-value equal to zero. Changing the alpha parameter, i
kept getting p-values=0. For the Brownian motion however, i got a
"normal"
p-value. I then tried with random values for my trait, and when for a
brownian correlation structure i get what i expect, that is most of the
time non-signiifcant autocorrelation, with the cor.Martins structure i
always get significant p-values (although not equal to zero).

In addition, if i run the GLS with the corMartins structure like this:

corm<-corMartins(1,phy=tree, fixed=T)
glsp<- gls(trait~var1+var2+var3, correlation=corm, data=data)

i get better and better AIC for increasing the alpha parameter
(indefinitely!), which would mean that the stronger the constraint on the
trait, the better is the fit.

Does anyone know why the corMartins is giving me these wierd results? Am
I
using this function in the wrong way or is it a bugg?

Thank you in advance for your help,
Sandra.



--
PhD Student
Muséum National d'Histoire Naturelle
Département Systématique et Évolution
USM 601 / UMR 7205 Origine, Structure et Évolution de la Biodiversité
Reptiles & Amphibiens - Case Postale 30
25 rue Cuvier
F-75005 Paris

Tel :      +33 (0) 1 40 79 34 90
Mobile: +33 (0) 6 79 20 29 99




--
PhD Student
Muséum National d'Histoire Naturelle
Département Systématique et Évolution
USM 601 / UMR 7205 Origine, Structure et Évolution de la Biodiversité
Reptiles & Amphibiens - Case Postale 30
25 rue Cuvier
F-75005 Paris

Tel :      +33 (0) 1 40 79 34 90
Mobile: +33 (0) 6 79 20 29 99

         [[alternative HTML version deleted]]


_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at
http://www.mail-archive.com/r-sig-phylo@r-project.org/






_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to