[R-sig-phylo] phyres function R package caper

2015-06-24 Thread Sergio Ferreira Cardoso
Dear all,

When I try to get a list os phylogenetic residuals using phyres function
from R package I get this message: Error: could not find function phyres.
Does anyone know how to solve this problem?

 phyres(fit.gls1)
Error: could not find function phyres

​Best regards,
Sérgio.​

-- 
Com os melhores cumprimentos,
Sérgio Ferreira Cardoso.



Best regards,
Sérgio Ferreira Cardoso




MSc. Paleontology candidate
Departamento de Ciências da Terra - FCT /Universidade Nova de Lisboa
Geociências - Universidade de Évora

Lisboa, Portugal

[[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] phyres function R package caper

2015-06-24 Thread Theodore Garland Jr
Hi All,

I am going to suggest that when people want any sort of phylogenetic 
residuals they do some checking on their own to try to verify what, exactly, 
they are getting.  Here's one check you can do.  Compute phylogenetically 
independent contrasts for two traits.  Perform a regression (through the 
origin, of course) of one trait on the other.  Save the residuals.  Compare 
them with the phylogenetic residuals you get from some other program that 
does a PGLS regression (not with any transformation of the branch lengths).  
Let us know what you find!

Cheers,
Ted

Theodore Garland, Jr., Professor
Department of Biology
University of California, Riverside
Riverside, CA 92521
Office Phone:  (951) 827-3524
Facsimile:  (951) 827-4286 (not confidential)
Email:  tgarl...@ucr.edu
http://www.biology.ucr.edu/people/faculty/Garland.html
http://scholar.google.com/citations?hl=enuser=iSSbrhwJ

Director, UCR Institute for the Development of Educational Applications

Editor in Chief, Physiological and Biochemical Zoology

Fail Lab: Episode One
http://testtube.com/faillab/zoochosis-episode-one-evolution
http://www.youtube.com/watch?v=c0msBWyTzU0


From: R-sig-phylo [r-sig-phylo-boun...@r-project.org] on behalf of Sergio 
Ferreira Cardoso [sff.card...@campus.fct.unl.pt]
Sent: Wednesday, June 24, 2015 9:21 AM
To: R phylo mailing list mailing list
Subject: [R-sig-phylo] phyres function R package caper

Dear all,

When I try to get a list os phylogenetic residuals using phyres function
from R package I get this message: Error: could not find function phyres.
Does anyone know how to solve this problem?

 phyres(fit.gls1)
Error: could not find function phyres

​Best regards,
Sérgio.​

--
Com os melhores cumprimentos,
Sérgio Ferreira Cardoso.



Best regards,
Sérgio Ferreira Cardoso




MSc. Paleontology candidate
Departamento de Ciências da Terra - FCT /Universidade Nova de Lisboa
Geociências - Universidade de Évora

Lisboa, Portugal

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

Re: [R-sig-phylo] phyres function R package caper

2015-06-24 Thread Theodore Garland Jr
Thank you, Liam!

Cheers,
Ted

From: Liam J. Revell [liam.rev...@umb.edu]
Sent: Wednesday, June 24, 2015 10:24 AM
To: Theodore Garland Jr; Sergio Ferreira Cardoso; R phylo mailing list mailing 
list
Subject: Re: [R-sig-phylo] phyres function R package caper

Hi all.

To the original question, you should be able to get these values first
using gls(...,correlation=corBrownian(...)) in nlme  then applying
residuals to the fitted model returned by gls. For instance, for data
frame X with variables x  y, and ultrametric phylogeny tree, you might
compute:

library(ape)
library(nlme)
fit-gls(y~x,data=X,correlation=corBrownian(1,tree))
residuals(fit)

(phytools also has a function for this, phyl.resid, but it does exactly
the same thing as the code above, and thus there is really no reason to
prefer that function - except perhaps to cross-check your result for
errors.)

With regards to Ted's comment, indeed these are different quantities.
Though the fitted coefficients from a contrasts regression should be the
same as above, the residuals will be different (and there will be one
fewer of them, besides). These residuals, from the contrasts regression,
should be phylogenetically independent; however they are not longer
associated with species, but with 'contrasts' or nodes in the tree. To
obtain these residuals from a contrasts regression you should be able to
do something like:

X-X[tree$tip.label,] ## precautionary
pic.x-pic(X[,x],tree)
pic.y-pic(X[,y],tree)
fit-lm(pic.y~pic.x-1)
residuals(fit)

There is no particular reason to prefer one set of quantities over the
other - it just depends on what subsequent analyses are intended. In the
former case, the residuals are associated with species - but these
residuals consequently will be phylogenetically correlated  thus the
tree needs to be taken into consideration in any subsequent analysis.
The latter residuals are phylogenetically independent, but no longer
associated with species. (I hate to cite myself, but this is discussed
in my paper Revell 2009; Evolution.)

I hope this is of some help.

All the best, Liam

Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 6/24/2015 12:35 PM, Theodore Garland Jr wrote:
 Hi All,

 I am going to suggest that when people want any sort of phylogenetic 
 residuals they do some checking on their own to try to verify what, exactly, 
 they are getting.  Here's one check you can do.  Compute phylogenetically 
 independent contrasts for two traits.  Perform a regression (through the 
 origin, of course) of one trait on the other.  Save the residuals.  Compare 
 them with the phylogenetic residuals you get from some other program that 
 does a PGLS regression (not with any transformation of the branch lengths).  
 Let us know what you find!

 Cheers,
 Ted

 Theodore Garland, Jr., Professor
 Department of Biology
 University of California, Riverside
 Riverside, CA 92521
 Office Phone:  (951) 827-3524
 Facsimile:  (951) 827-4286 (not confidential)
 Email:  tgarl...@ucr.edu
 http://www.biology.ucr.edu/people/faculty/Garland.html
 http://scholar.google.com/citations?hl=enuser=iSSbrhwJ

 Director, UCR Institute for the Development of Educational Applications

 Editor in Chief, Physiological and Biochemical Zoology

 Fail Lab: Episode One
 http://testtube.com/faillab/zoochosis-episode-one-evolution
 http://www.youtube.com/watch?v=c0msBWyTzU0

 
 From: R-sig-phylo [r-sig-phylo-boun...@r-project.org] on behalf of Sergio 
 Ferreira Cardoso [sff.card...@campus.fct.unl.pt]
 Sent: Wednesday, June 24, 2015 9:21 AM
 To: R phylo mailing list mailing list
 Subject: [R-sig-phylo] phyres function R package caper

 Dear all,

 When I try to get a list os phylogenetic residuals using phyres function
 from R package I get this message: Error: could not find function phyres.
 Does anyone know how to solve this problem?

 phyres(fit.gls1)
 Error: could not find function phyres

 ​Best regards,
 Sérgio.​

 --
 Com os melhores cumprimentos,
 Sérgio Ferreira Cardoso.

 

 Best regards,
 Sérgio Ferreira Cardoso




 MSc. Paleontology candidate
 Departamento de Ciências da Terra - FCT /Universidade Nova de Lisboa
 Geociências - Universidade de Évora

 Lisboa, Portugal

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

Re: [R-sig-phylo] phyres function R package caper

2015-06-24 Thread Sergio Ferreira Cardoso
Thank you both.

Best regards,
Sérgio.
No dia 24 de Jun de 2015 18:30, Theodore Garland Jr 
theodore.garl...@ucr.edu escreveu:

 Thank you, Liam!

 Cheers,
 Ted

 From: Liam J. Revell [liam.rev...@umb.edu]
 Sent: Wednesday, June 24, 2015 10:24 AM
 To: Theodore Garland Jr; Sergio Ferreira Cardoso; R phylo mailing list
 mailing list
 Subject: Re: [R-sig-phylo] phyres function R package caper

 Hi all.

 To the original question, you should be able to get these values first
 using gls(...,correlation=corBrownian(...)) in nlme  then applying
 residuals to the fitted model returned by gls. For instance, for data
 frame X with variables x  y, and ultrametric phylogeny tree, you might
 compute:

 library(ape)
 library(nlme)
 fit-gls(y~x,data=X,correlation=corBrownian(1,tree))
 residuals(fit)

 (phytools also has a function for this, phyl.resid, but it does exactly
 the same thing as the code above, and thus there is really no reason to
 prefer that function - except perhaps to cross-check your result for
 errors.)

 With regards to Ted's comment, indeed these are different quantities.
 Though the fitted coefficients from a contrasts regression should be the
 same as above, the residuals will be different (and there will be one
 fewer of them, besides). These residuals, from the contrasts regression,
 should be phylogenetically independent; however they are not longer
 associated with species, but with 'contrasts' or nodes in the tree. To
 obtain these residuals from a contrasts regression you should be able to
 do something like:

 X-X[tree$tip.label,] ## precautionary
 pic.x-pic(X[,x],tree)
 pic.y-pic(X[,y],tree)
 fit-lm(pic.y~pic.x-1)
 residuals(fit)

 There is no particular reason to prefer one set of quantities over the
 other - it just depends on what subsequent analyses are intended. In the
 former case, the residuals are associated with species - but these
 residuals consequently will be phylogenetically correlated  thus the
 tree needs to be taken into consideration in any subsequent analysis.
 The latter residuals are phylogenetically independent, but no longer
 associated with species. (I hate to cite myself, but this is discussed
 in my paper Revell 2009; Evolution.)

 I hope this is of some help.

 All the best, Liam

 Liam J. Revell, Assistant Professor of Biology
 University of Massachusetts Boston
 web: http://faculty.umb.edu/liam.revell/
 email: liam.rev...@umb.edu
 blog: http://blog.phytools.org

 On 6/24/2015 12:35 PM, Theodore Garland Jr wrote:
  Hi All,
 
  I am going to suggest that when people want any sort of phylogenetic
 residuals they do some checking on their own to try to verify what,
 exactly, they are getting.  Here's one check you can do.  Compute
 phylogenetically independent contrasts for two traits.  Perform a
 regression (through the origin, of course) of one trait on the other.  Save
 the residuals.  Compare them with the phylogenetic residuals you get from
 some other program that does a PGLS regression (not with any transformation
 of the branch lengths).  Let us know what you find!
 
  Cheers,
  Ted
 
  Theodore Garland, Jr., Professor
  Department of Biology
  University of California, Riverside
  Riverside, CA 92521
  Office Phone:  (951) 827-3524
  Facsimile:  (951) 827-4286 (not confidential)
  Email:  tgarl...@ucr.edu
  http://www.biology.ucr.edu/people/faculty/Garland.html
  http://scholar.google.com/citations?hl=enuser=iSSbrhwJ
 
  Director, UCR Institute for the Development of Educational Applications
 
  Editor in Chief, Physiological and Biochemical Zoology
 
  Fail Lab: Episode One
  http://testtube.com/faillab/zoochosis-episode-one-evolution
  http://www.youtube.com/watch?v=c0msBWyTzU0
 
  
  From: R-sig-phylo [r-sig-phylo-boun...@r-project.org] on behalf of
 Sergio Ferreira Cardoso [sff.card...@campus.fct.unl.pt]
  Sent: Wednesday, June 24, 2015 9:21 AM
  To: R phylo mailing list mailing list
  Subject: [R-sig-phylo] phyres function R package caper
 
  Dear all,
 
  When I try to get a list os phylogenetic residuals using phyres function
  from R package I get this message: Error: could not find function
 phyres.
  Does anyone know how to solve this problem?
 
  phyres(fit.gls1)
  Error: could not find function phyres
 
  ​Best regards,
  Sérgio.​
 
  --
  Com os melhores cumprimentos,
  Sérgio Ferreira Cardoso.
 
  
 
  Best regards,
  Sérgio Ferreira Cardoso
 
 
 
 
  MSc. Paleontology candidate
  Departamento de Ciências da Terra - FCT /Universidade Nova de Lisboa
  Geociências - Universidade de Évora
 
  Lisboa, Portugal
 
   [[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