Re: [R-sig-phylo] phylogenetic correlation analysis

2021-06-13 Thread Cecile Ane
Rphylopars is an option too (https://github.com/ericgoolsby/Rphylopars)



[[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/


Re: [R-sig-phylo] phylogenetic correlation analysis

2021-06-13 Thread Joe Felsenstein
Whether one gets them from PGLS directly or from contrasts, one can
get correlations by just inferring the covariance matrix and then
calculating
r(x,y) =  Cov(x,y) / (Var(x) Var(y))^(1/2)
where of course Var(x) is also  Cov(x,x), and so on.
You would not need a separate run to get correlations.

Joe
--
Joe Felsenstein felse...@gmail.com,  j...@gs.washington.edu
 Department of Genome Sciences and Department of Biology,
 University of Washington, Box 355065, Seattle, WA 98195-5065 USA

___
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/


Re: [R-sig-phylo] phylogenetic correlation analysis

2021-06-13 Thread Theodore Garland
I'll just add one note of caution.  If you do the independent contrasts
calculations, make sure the package you use to compute correlations is
actually doing them through the origin.  In years past, I ran into stats
programs that would give you a regression through the origin (slope) as
requested, but would also report a correlation coefficient that was NOT
through the origin!  As always, trust but verify!
Cheers,
Ted

On Sun, Jun 13, 2021 at 7:04 AM Julien Clavel 
wrote:

> Dear Oliver,
>
> Yes, you can use the independent contrasts to estimate the
> correlations (e.g., assuming BM). Otherwise, you can compute the
> correlations
> directly from the models fit in mvMORPH.
>
> For instance, under BM you can use:
>
> fit_bm <- mvBM(tree, data)
> cov2cor(fit_bm$sigma) # marginal correlations
> cor2pcor(fit_bm$sigma) # partial correlations
>
> Under OU, you can also retrieve the correlations from the
> variance-covariance matrix
> (which depends on both the “sigma” and “alpha” parameters, and can be
> retrieved
> with the “stationary” function):
> fit_ou <- mvOU(tree, data)
> cov2cor(stationary(fit_ou$sigma)) # marginal correlations
> cor2pcor(stationary(fit_ou)) # partial correlations
>
>
> Alternatively, you can use the “mvgls” function to do it, e.g.:
>
> fit_bm2 <- mvgls(data~1, tree=tree, model="BM", method="LL")
> cov2cor(fit_bm2$sigma$Pinv) # marginal correlations
> cor2pcor(fit_bm2$sigma$Pinv) # partial correlations
>
> You can for instance use penalized likelihood to obtain a
> regularized estimate of the evolutionary correlations:
>
> fit_bm2 <- mvgls(data~1, tree=tree, model="BM", method="PL") # Ridge
> penalization by default
> cov2cor(fit_bm2$sigma$Pinv) # marginal correlations
> cor2pcor(fit_bm2$sigma$Pinv) # partial correlations
>
> With LASSO penalization, for instance, you can find a sparse
> estimate for the partial correlations. That is, you can directly select
> the “significant”
> partial correlations from the model fit:
>
> fit_bm2 <- mvgls(data~1, tree=tree, model="BM", method="PL",
> penalty="LASSO")
> cov2cor(fit_bm2$sigma$Pinv) # marginal correlations
> cor2pcor(fit_bm2$sigma$Pinv) # partial correlations
>
> Best wishes,
>
> Julien
>
>
>
> De : R-sig-phylo  de la part de Oliver
> Betz 
> Envoyé : dimanche 13 juin 2021 14:45
> À : r-sig-phylo@r-project.org 
> Objet : [R-sig-phylo] phylogenetic correlation analysis
>
> Dear all:
>
> I would like to perform a phylogenetic correlation analysis (simlar to
> PGLS, but correlation instead of regression), so that I get a
> correlation matrix, where all the Pearson or Spearman correlation
> coefficients between all of my variables are listed. One solution
> might be to calculate PICs and do standard correlation analyses on
> them, but there might be a more direct solution available?
>
> Which R package would you recommend for such analysis?
>
>
> Thank you very much,
>
> Oliver Betz
>
> ___
> 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/
>

[[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/


Re: [R-sig-phylo] phylogenetic correlation analysis

2021-06-13 Thread Julien Clavel
Dear Oliver, 
 
Yes, you can use the independent contrasts to estimate the
correlations (e.g., assuming BM). Otherwise, you can compute the correlations
directly from the models fit in mvMORPH. 
 
For instance, under BM you can use: 
 
fit_bm <- mvBM(tree, data) 
cov2cor(fit_bm$sigma) # marginal correlations 
cor2pcor(fit_bm$sigma) # partial correlations 
 
Under OU, you can also retrieve the correlations from the variance-covariance 
matrix
(which depends on both the “sigma” and “alpha” parameters, and can be retrieved
with the “stationary” function): 
fit_ou <- mvOU(tree, data) 
cov2cor(stationary(fit_ou$sigma)) # marginal correlations 
cor2pcor(stationary(fit_ou)) # partial correlations 
 
 
Alternatively, you can use the “mvgls” function to do it, e.g.: 

fit_bm2 <- mvgls(data~1, tree=tree, model="BM", method="LL") 
cov2cor(fit_bm2$sigma$Pinv) # marginal correlations 
cor2pcor(fit_bm2$sigma$Pinv) # partial correlations 
 
You can for instance use penalized likelihood to obtain a
regularized estimate of the evolutionary correlations: 
 
fit_bm2 <- mvgls(data~1, tree=tree, model="BM", method="PL") # Ridge 
penalization by default
cov2cor(fit_bm2$sigma$Pinv) # marginal correlations 
cor2pcor(fit_bm2$sigma$Pinv) # partial correlations 
 
With LASSO penalization, for instance, you can find a sparse
estimate for the partial correlations. That is, you can directly select the 
“significant”
partial correlations from the model fit: 
 
fit_bm2 <- mvgls(data~1, tree=tree, model="BM", method="PL",
penalty="LASSO") 
cov2cor(fit_bm2$sigma$Pinv) # marginal correlations 
cor2pcor(fit_bm2$sigma$Pinv) # partial correlations 
 
Best wishes, 
 
Julien 



De : R-sig-phylo  de la part de Oliver Betz 

Envoyé : dimanche 13 juin 2021 14:45
À : r-sig-phylo@r-project.org 
Objet : [R-sig-phylo] phylogenetic correlation analysis 
 
Dear all:

I would like to perform a phylogenetic correlation analysis (simlar to  
PGLS, but correlation instead of regression), so that I get a  
correlation matrix, where all the Pearson or Spearman correlation  
coefficients between all of my variables are listed. One solution  
might be to calculate PICs and do standard correlation analyses on  
them, but there might be a more direct solution available?

Which R package would you recommend for such analysis?


Thank you very much,

Oliver Betz

___
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] phylogenetic correlation analysis

2021-06-13 Thread Oliver Betz

Dear all:

I would like to perform a phylogenetic correlation analysis (simlar to  
PGLS, but correlation instead of regression), so that I get a  
correlation matrix, where all the Pearson or Spearman correlation  
coefficients between all of my variables are listed. One solution  
might be to calculate PICs and do standard correlation analyses on  
them, but there might be a more direct solution available?


Which R package would you recommend for such analysis?


Thank you very much,

Oliver Betz

___
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/