Re: [R-sig-phylo] Phylogenetic PCA and measurement error

2018-03-12 Thread Rafael S Marcondes
Thank you very much to everyone that replied. R-sig-phylo, as usual, a very helpful and friendly community! I got everything to work now. Jonathan Drury also replied off-list with a similar approach in function form. Cheers, Rafael *--* *Rafael Sobral Marcondes* PhD Candidate (Systematics,

Re: [R-sig-phylo] Phylogenetic PCA and measurement error

2018-03-12 Thread Liam J. Revell
Graham's right of course. Sorry about that. You might do something like: Si<-(Xi-matrix(1,nrow(Xi),1)%*%phyl.vcv(Xm,vcv(tree), 1)$alpha[,1])%*%pca$Evec I also agree with Joe that you can take the phylogeny into account whilst accounting for sampling error using his approach or that of

Re: [R-sig-phylo] Phylogenetic PCA and measurement error

2018-03-12 Thread Graham Slater
Hi Rafael, You need to mean-center your traits before multiplying by the matrix of eigenvectors. Compute the vector of phylogenetic means (under BM or Pagel’s lambda), subtract each value from the relevant column of Xm and then compute Si. The result should be identical to the scores from your

Re: [R-sig-phylo] Phylogenetic PCA and measurement error

2018-03-12 Thread Joe Felsenstein
Rafael and Liam -- > > So far as I know, there is currently no way to explicitly take into account > sampling error in computing principal components while also accounting for > the phylogeny. However, it is relatively straightforward to compute scores > for individuals from a PCA conducted on

Re: [R-sig-phylo] Phylogenetic PCA and measurement error

2018-03-11 Thread Liam J. Revell
Hi Rafael. So far as I know, there is currently no way to explicitly take into account sampling error in computing principal components while also accounting for the phylogeny. However, it is relatively straightforward to compute scores for individuals from a PCA conducted on species means.

[R-sig-phylo] Phylogenetic PCA and measurement error

2018-03-11 Thread Rafael S Marcondes
Dear all, Does anyone have any advice on how to calculate measurement error in an analysis using phylogenetic principal components? Or, in other words, after I run a phylogenetic PCA on species-level data, how can I "project" my individual-level data into the phylogenetic PCs so I can calculate a