[R-sig-phylo] phylogenetic covariance matrix

2009-02-23 Thread Santiago Claramunt

Hi all,

I'm having problems calculating the the phylogenetic covariance matrix  
of simulated trees.


tree1 - birthdeath.tree(b=1, d=0, taxa.stop=8) # creates an  
ultrametric tree with 8 species

plot(tree1)

vcv.phylo(tree1, cor=F)  #phylogenetic covariance matrix
vcv.phylo(tree1, cor=T)  #phylogenetic correlation matrix?

In most cases, the resultant matrix does not make sense: some closely  
related species have zero covariance, and some off diagonal elements  
are higher than the diagonal elements. Also, what's the meaning of the  
correlation matrix in vcv.phylo()? Is it the covariance matrix divided  
by the total time?


I'll appreciate any help with this.


Santiago




Santiago Claramunt

Museum of Natural Science,
119 Foster Hall,
Louisiana State University,
Baton Rouge, LA70803
scla...@lsu.edu
http://www.museum.lsu.edu/Claramunt/Home.html

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


[R-sig-phylo] yule.cov

2009-06-03 Thread Santiago Claramunt

Hi all,

I'm using the yule.cov function to investigate the relationship  
between a morphological variable and diversifficaiton using a dataset  
of ca. 300 species. The morphological variable was log-transformed and  
scaled, and ancestral reconstruction ran smoothly.


When I run the yule.cov function I get the results with all the  
information excepto for the StdErr, and I do get a warning message:


The likelihood gradient seems flat in at least one dimension (null  
gradient):

cannot compute the standard-errors of the transition rates.

I wonder if anybody has some insights on why this is happening.


The oder issue is that the Log-likelihoods I obtained are smaller than  
for simple yule model fitted using yule(). Is ape reporting -LogLiks?



Thanks in advance,

Santiago



Santiago Claramunt
Museum of Natural Science,
119 Foster Hall,
Louisiana State University,
Baton Rouge, LA70803
scla...@tigers.lsu.edu
http://www.museum.lsu.edu/Claramunt/Home.html

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


[R-sig-phylo] inverting C matrices from Yule trees

2009-11-04 Thread Santiago Claramunt

Hi all,

I'm having problems computing the inverse of the expected variance- 
covariance evolutionary matrix (C) on simulated trees generated with  
birthdeath.tree().


 solve(vcv.phylo(birthdeath.tree(1,0, taxa.stop=10)))

These matrices seem to be singular!
Matrices generated using rtree() and rcoal() are fine.

Any insights on this?

Cheers,

Santiago


Santiago Claramunt
Museum of Natural Science,
119 Foster Hall,
Louisiana State University,
Baton Rouge, LA70803
scla...@tigers.lsu.edu
http://www.museum.lsu.edu/Claramunt/Home.html

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


[R-sig-phylo] RelTime algorithm

2014-03-13 Thread Santiago Claramunt
Does anyone know of an imlplementation of the RelTime algorithm (

   1. Tamura K,
   2. Battistuzzi FU,
   3. Billing-Ross P,
   4. Murillo O,
   5. Filipski A,
   6. Kumar S

. Estimating divergence times in large molecular phylogenies. Proc Natl
Acad Sci U S A.2012;109:19333-19338.) in R?

Santiago

[[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] axisChrono and axisPhylo

2015-03-02 Thread Santiago Claramunt
Hi Jacob,

What I do is to use the basic axis() function. The trick is to transform the 
scale by subtracting the depth of your tree like this:

axis(1, at=max(branching.times(tree))-0:10, labels=0:10)

Best,

Santiago


On Mar 2, 2015, at 4:38 PM, Jacob Berv jakeberv.r.sig.ph...@gmail.com wrote:

 Greetings R-sig-phylo,
 This is my first post but happy to join this community
 
 I have been having some trouble with the axisChrono of the phyloch package 
 and axisPhylo functions of the ape package that I was hoping someone might be 
 able to help me with.
 
 When using either function, the spacing between ticks on the scale is too 
 large for the figure I’m trying to generate. I have tried passing variations 
 of at=c(1,2,3,4,5), or at=seq(0,10,1) etc, but for either function I get the 
 following error:
 
 Error in axis(side = side, at = c(maxi - x), labels = abs(x * fact), ...) : 
 formal argument “at matched by multiple actual arguments
 
 Does anyone know how I might be able to specify the tick marks that I want 
 for these particular functions?
 
 Best,
 
 Jacob Berv
 
 Ph.D. Student
 Lovette Lab
 Cornell Laboratory of Ornithology
 
 ___
 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/



Santiago Claramunt, Ph.D.

Research Associate
Department of Ornithology
American Museum of Natural History

sclaram...@amnh.org
https://sites.google.com/site/sclaramuntuy/

___
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] Non Parametric PGLS

2015-06-19 Thread Santiago Claramunt
Hi Julien,

Mosimann’s method was proposed for the study of allometry, so it would be 
strange if it only applies to isometric cases. Can you provide further details 
or suggest readings?

Cheers,

Santiago

On Jun 18, 2015, at 7:06 PM, Julien Clavel julien.cla...@hotmail.fr wrote:

 Hi Sergio,
 
 Just to precise that you have to keep in mind that Mosimann ratio (if you are 
 speaking about the Mosimann shape ratio, e.g. with the geometric mean) 
 applies only when there is an isometric relationship (as for most analysis 
 based on ratio). You should check first, otherwise the resulting standardized 
 values will be biased. Although the residuals solution is probably not the 
 best, there is no magic solution to size standardization... 
 By the way remember that on log spaces isometry is represented by a slope of 
 1, and on arithmetic scales by an intercept of zero. The resulting bias in 
 the ratio are thus different.
 
 Best,
 
 Julien
 
  From: sclaramunt...@gmail.com
  Date: Thu, 18 Jun 2015 12:52:11 -0500
  To: r-sig-phylo@r-project.org
  Subject: Re: [R-sig-phylo] Non Parametric PGLS
  
  Hi Sergio,
  If what you want to do is to partition your morphometric data into size and 
  shape components, then you can use Mosimann’s methods which do not require 
  regressions or phylogenetic corrections.
  
  Mosimann, J. E. 1970. Size allometry: size and shape variables with charac- 
  terization of the lognormal and generalized gamma distributions. J. Am. 
  Stat. Assoc. 65:930–945.
  Mosimann, J. E., and F. C. James. 1979. New statistical methods for 
  allometry with application to Florida red-winged blackbirds. Evolution 
  33:444– 459.
  
  here is how I used them:
  
  Claramunt, S. (2010). Discovering exceptional diversifications at 
  continental scales: the case of the endemic families of Neotropical 
  suboscine passerines. Evolution, 64(7), 2004-2019.
  
  Cheers,
  
  Santiago
  
  
  On Jun 18, 2015, at 11:55 AM, Sergio Ferreira Cardoso 
  sff.card...@campus.fct.unl.pt wrote:
  
   Hi Liam,
   
   Again, thank you for the answer. Yes, I'm aware that they are
   phylogenetically correlated and that they need to be subsequently analysed
   with methods such as PGLS. In fact, when I apply a normality test to (
   chol(solve(vcv(tree)))%*%residuals(fit))the transformed residuals are
   normally distributed. But I understand that the residuals I need to use as
   size-corrected traits are the ones without the transformation (that, in my
   case, aren't normal, and that's why I was a bit worried).
   Thanks a lot for the help.
   
   Cheers,
   Sérgio.
   
   2015-06-18 15:54 GMT+01:00 Liam J. Revell liam.rev...@umb.edu:
   
   Hi Sérgio.
   
   What Simon ( I, in my blog post) suggested is that to test the 
   'normality
   assumption' you need to first transform the residuals with the inverse
   Cholesky decomposite matrix. This will give you a vector in which the
   values should be normal  independent (assuming that the correlation
   structure of the residuals is properly given by the tree). However these
   values are no longer associated with species(!) so they cannot be used in
   subsequent among-species analyses. So, basically, yes - you should use 
   the
   residuals before transformation in cross-species analyses (for instance, 
   as
   'size corrected' trait values); however you need to remember that they 
   are
   still phylogenetically correlated. I hope that's clear enough.
   
   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/18/2015 6:16 AM, Sergio Ferreira Cardoso wrote:
   
   Hello again,
   
   Thanks for your help. This kind of solved my problem. I normally use
   some kind of test (shapiro or komolgorov) to test for normality. I know
   histograms or qqnorm plots a more helpful, but they are more
   vulnerable to each others interpretation.
   So, just to make clear one thing: these kind of analysis of the residual
   error
   (
   http://blog.phytools.org/2013/02/a-comment-on-distribution-of-residuals.html
   )
   has nothing to do with phylogenetic residuals taken from a regression
   (in order to obtain relative values - size-correction as in Revell, L.
   J. (2009). Size‐correction and principal components for interspecific
   comparative studies. Evolution, 63(12), 3258-3268.). So even if
   residuals from a PGLS aren't normal, this means I can still use them as
   size-corrected values for a certain trait, correct?
   Once again, thank you very much for your advices.
   
   Best regards,
   Sérgio.
   
   2015-06-18 4:56 GMT+01:00 Simon Blomberg s.blombe...@uq.edu.au
   mailto:s.blombe...@uq.edu.au:
   
   
   Hi Sérgio.
   
   Liam is right. But we do expect the normalised residuals to be
   approximately Normal. You can calculate the normalised residuals by
   pre-multiplying the raw 

Re: [R-sig-phylo] Non Parametric PGLS

2015-06-18 Thread Santiago Claramunt
Hi Sergio,
If what you want to do is to partition your morphometric data into size and 
shape components, then you can use Mosimann’s methods which do not require 
regressions or phylogenetic corrections.

Mosimann, J. E. 1970. Size allometry: size and shape variables with charac- 
terization of the lognormal and generalized gamma distributions. J. Am. Stat. 
Assoc. 65:930–945.
Mosimann, J. E., and F. C. James. 1979. New statistical methods for allometry 
with application to Florida red-winged blackbirds. Evolution 33:444– 459.

here is how I used them:

Claramunt, S. (2010). Discovering exceptional diversifications at continental 
scales: the case of the endemic families of Neotropical suboscine passerines. 
Evolution, 64(7), 2004-2019.

Cheers,

Santiago


On Jun 18, 2015, at 11:55 AM, Sergio Ferreira Cardoso 
sff.card...@campus.fct.unl.pt wrote:

 Hi Liam,
 
 Again, thank you for the answer. Yes, I'm aware that they are
 phylogenetically correlated and that they need to be subsequently analysed
 with methods such as PGLS. In fact, when I apply a normality test to (
 chol(solve(vcv(tree)))%*%residuals(fit))the transformed residuals are
 normally distributed. But I understand that the residuals I need to use as
 size-corrected traits are the ones without the transformation (that, in my
 case, aren't normal, and that's why I was a bit worried).
 Thanks a lot for the help.
 
 Cheers,
 Sérgio.
 
 2015-06-18 15:54 GMT+01:00 Liam J. Revell liam.rev...@umb.edu:
 
 Hi Sérgio.
 
 What Simon ( I, in my blog post) suggested is that to test the 'normality
 assumption' you need to first transform the residuals with the inverse
 Cholesky decomposite matrix. This will give you a vector in which the
 values should be normal  independent (assuming that the correlation
 structure of the residuals is properly given by the tree). However these
 values are no longer associated with species(!) so they cannot be used in
 subsequent among-species analyses. So, basically, yes - you should use the
 residuals before transformation in cross-species analyses (for instance, as
 'size corrected' trait values); however you need to remember that they are
 still phylogenetically correlated. I hope that's clear enough.
 
 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/18/2015 6:16 AM, Sergio Ferreira Cardoso wrote:
 
 Hello again,
 
 Thanks for your help. This kind of solved my problem. I normally use
 some kind of test (shapiro or komolgorov) to test for normality. I know
 histograms or qqnorm plots a more helpful, but they are more
 vulnerable to each others interpretation.
 So, just to make clear one thing: these kind of analysis of the residual
 error
 (
 http://blog.phytools.org/2013/02/a-comment-on-distribution-of-residuals.html
 )
 has nothing to do with phylogenetic residuals taken from a regression
 (in order to obtain relative values - size-correction as in Revell, L.
 J. (2009). Size‐correction and principal components for interspecific
 comparative studies. Evolution, 63(12), 3258-3268.). So even if
 residuals from a PGLS aren't normal, this means I can still use them as
 size-corrected values for a certain trait, correct?
 Once again, thank you very much for your advices.
 
 Best regards,
 Sérgio.
 
 2015-06-18 4:56 GMT+01:00 Simon Blomberg s.blombe...@uq.edu.au
 mailto:s.blombe...@uq.edu.au:
 
 
Hi Sérgio.
 
Liam is right. But we do expect the normalised residuals to be
approximately Normal. You can calculate the normalised residuals by
pre-multiplying the raw residuals by the inverse of the Cholesky
decomposition of the phylogenetic variance-covariance matrix, and
then dividing by the estimate of the residual standard deviation (ie
sigma). You may have to plug in a value for any parameters that are
co-estimated along with the regression (Pagel's lambda, etc.). If
you use the gls function in the nlme package to fit your model, then
it's all easy:
 
fit - gls(response~explanatory, correlation=corPagel(1,
phy=my.tree), data=dat))
res - residuals(fit, type=normalized)
 
Then you can do some test for normality on those (I don't ordinarily
recommend such things, although
SnowsPenultimateNormalityTest in the TeachingDemos package is the
best I have seen). More usefully, you can do a normal
quantile-quantile plot to graphically see whether your normalised
residuals are normal enough:
 
qqnorm(fit, form=~residuals(., type=n), abline=c(0,1))
 
See page 239 in Pinheiro and Bates (2000) Mixed-effects models in S
and S-PLUS.
 
Cheers,
 
Simon.
 
 
On 18/06/15 03:09, Liam J. Revell wrote:
 
Hi Sérgio.
 
It might be worth pointing out that we do not expect that the
residuals from a phylogenetic regression to be normal. I
described this with 

Re: [R-sig-phylo] Measurement error for tips with only 1 measured specimen (OUwie)

2016-08-16 Thread Santiago Claramunt
Hi Rafael,

Your method would underestimate the error associated with values derived from 
single specimens because those values would have the highest errors, not 
average errors.
What I have done in such cases is to estimate an average standard deviation 
across species and use that average standard deviation as the standard error of 
the species with single specimens.
I don't know of a formal description of this solution but it is mentioned in 
one of my papers: http://rspb.royalsocietypublishing.org/content/279/1733/1567

Best,

Santiago

Research Associate
Department of Ornithology
American Museum of Natural History
https://sites.google.com/site/sclaramuntuy/


> On Aug 16, 2016, at 4:34 PM, Rafael S. Marcondes  
> wrote:
> 
> Hi all,
> 
> I’m using OUwie to fit multi-optima OU models and I have a question about
> incorporating measurement error into my analyses.
> 
> I’m running my models with known measurement error (mserr=‘known’) and
> using the standard error (std.error()) as an estimate of it, as recommended
> by Ives et al (2007). However, for some (a minority) of my tips, I was only
> able to measure 1 specimen, so I have no standard error for them. So I’m
> not sure about how to deal with those. At first I thought about just
> setting their measurement error as 0, but then I figured that would
> introduce false confidence. So what I’m doing now is I’m setting
> measurement error for those tips as the mean of the errors of all the tips
> for which I did measure more than one specimen. I got that idea also from
> Ives et al when they mention averaging the error across species (jn the
> third-to-last paragraph), but that was in a different context. I can’t find
> any references that report dealing with the same problem, even though I
> assume it must not be an uncommon one. So I’m wondering if mine is really
> the best way to do it and, or if anyone has alternative suggestions?
> 
> i hope I’ve made my problem clear, and thanks in advance for any
> suggestions.
> 
> 
> *--*
> *Rafael Sobral Marcondes*
> 
> PhD Candidate (Systematics, Ecology and Evolution/Ornithology)
> Museum of Natural Science 
> Louisiana State University
> 119 Foster Hall
> Baton Rouge, LA 70803, USA
> 
> Twitter: @rafmarcondes 
> 
>   [[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] Maximum likelihood time-scaling

2018-02-07 Thread Santiago Claramunt
Does anyone know a maximum-likelihood implementation that uses molecular 
sequences to optimizes node ages instead of branch lengths (ala Felsenstein 
2008, p. 266)?
It sounds like nice idea for using in time calibrations.

Cheers,

Santiago



Santiago Claramunt

Associate Curator
Department of Natural History
Royal Ontario Museum
100 Queen’s Park Crescent
Toronto, ON, M5S 2C6
CANADA

(416) 586-5520
sclaram...@rom.on.ca<mailto:sclaram...@rom.on.ca>

&

Assistant Professor
Department of Ecology and Evolutionary Biology, University of Toronto












ON NOW
VIKINGS: The Exhibition, presented by Raymond James 
Ltd.<http://www.rom.on.ca/vikings>
Christian Dior<http://www.rom.on.ca/dior>
Wildlife Photographer of the Year<http://www.rom.on.ca/wpy>
Here We Are Here: Contemporary African Canadian 
Art<http://www.rom.on.ca/en/exhibitions-galleries/exhibitions/here-we-are-here-black-canadian-contemporary-

art>

COMING SOON
2 June | Iris van Herpen: Transforming Fashion
16 June | Spiders

À L’AFFICHE
VIKINGS : L'exposition, une présentation de Raymond James 
Ltée<http://www.rom.on.ca/fr/vikings>
Christian Dior<http://www.rom.on.ca/fr/dior>
Le Photographe naturaliste de 
l'année<https://www.rom.on.ca/fr/photographe-naturaliste>
Nous Sommes Ici, D'ici : L'art Contemporain des Noirs 
Canadiens<https://www.rom.on.ca/fr/expositions-et-galeries/expositions/nous-sommes-

ici-dici-lart-contemporain-des-noirs-canadiens>

À VENIR
2 juin | Iris van Herpen : Transformer la mode
16 juin | Les araignŽes

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