Re: [R-sig-phylo] test random drift only?

2016-03-04 Thread Alejandro Gonzalez Voyer
Hello Franz,

I don’t come with a solution but rather a suggestion, you should look at this 
paper:

Revell, Harmon and Collar 2008 Phylogenetic signal, evolutionary process and 
rate. Systematic Biology 57: 591-601

In brief the authors of that paper point out that comparative methods analyzing 
trait evolution provide information about patterns in the data, however there 
may be different evolutionary processes that can lead to highly similar 
patterns in the data, thus it is hard to conclude anything about evolutionary 
processes only from information about evolutionary patterns.

Cheers

Alejandro
___
Dr Alejandro Gonzalez Voyer

Laboratorio de Conducta Animal
Instituto de Ecología
Circuito Exterior S/N
Ciudad Universitaria
Universidad Nacional Autónoma de México
México, D.F.
04510
México

Tel: +52 55 5622 9044
E-mail: alejandro.gonza...@iecologia.unam.mx
Web: www.alejandrogonzalezvoyer.com

> El 04/03/2016, a las 11:00, f.k...@mailbox.org escribió:
> 
> Dear everyone,
> 
> I want to test if a trait evolved by random drift only without selection.
> My hypothesis regarding a specific trait - I don’t want to tell which if it 
> turns out to be a good idea ;-) - is, 
> that there is no selection acting on it and it is evolving by random 
> mutations only. Thus u can see phenotypic differences between the species 
> but without selection advantage or disadvantage for the species. 
> 
> So now I’m looking for models and R packages.
> I first thought about diversitree. make.quasse with and without drift and 
> compare the models…
> However, the problem is, that my data is a discrete multitrait and not 
> continuous. Thus I think brownian motion models are not the right thing to 
> look at?
> 
> Then I thought about just testing for clustering in the tips and compare with 
> a random distribution of the trait…
> But since its its a multitrait and the phylogeny is not super big, I think 
> this method is not good for discriminating the randomness…
> 
> I really hope anyone can give me some advice which methods might be suitable. 
> Are there any at all? 
> It seems its not easy since the only thing I really found was brownian 
> motion...
> 
> Cheers,
> Franz
> 
> 
> 
> Franz-Sebastian Krah
> PhD student, Fungal Ecology and Evolution
> Plant Biodiversity Research Group
> Technische Universität München (TUM)
> Mobile: 0170 5221189
> Personal Website  and University Website 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   [[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/


[[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] test random drift only?

2016-03-04 Thread f.k...@mailbox.org
Dear everyone,

I want to test if a trait evolved by random drift only without selection. 
My hypothesis regarding a specific trait - I don’t want to tell which if it 
turns out to be a good idea ;-) - is, 
that there is no selection acting on it and it is evolving by random mutations 
only. Thus u can see phenotypic differences between the species 
but without selection advantage or disadvantage for the species. 

So now I’m looking for models and R packages.
I first thought about diversitree. make.quasse with and without drift and 
compare the models…
However, the problem is, that my data is a discrete multitrait and not 
continuous. Thus I think brownian motion models are not the right thing to look 
at?

Then I thought about just testing for clustering in the tips and compare with a 
random distribution of the trait…
But since its its a multitrait and the phylogeny is not super big, I think this 
method is not good for discriminating the randomness…

I really hope anyone can give me some advice which methods might be suitable. 
Are there any at all? 
It seems its not easy since the only thing I really found was brownian motion...

Cheers,
Franz



Franz-Sebastian Krah
PhD student, Fungal Ecology and Evolution
Plant Biodiversity Research Group
Technische Universität München (TUM)
Mobile: 0170 5221189
Personal Website  and University Website 










[[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] How to use categorical vectors in package ape for phylogenetic independent contrasts

2016-03-04 Thread Theodore Garland Jr
Thanks for Emmanual.
Kate, I think the original explanation of dummy variables with independent 
contrasts is here:

Garland Jr. T., P.H. Harvey, and A.R. Ives. 1992. Procedures for the analysis 
of comparative data using phylogenetically independent contrasts. Systematic 
Biology 41:18–32.

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=en=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 Emmanuel 
Paradis [emmanuel.para...@ird.fr]
Sent: Friday, March 04, 2016 6:30 AM
To: Kate Boyce-Miles; r-sig-phylo@r-project.org
Subject: Re: [R-sig-phylo] How to use categorical vectors in package ape for 
phylogenetic independent contrasts

Hi Kate,

You can compute PICs for a categorical variable in the same way than
you enter it in a linear model, that is by first computing its
"contrasts" (this is different from the "P-I-Contrasts", though both
have some conceptual similarities). The easiest way to do it is to use
the function model.matrix. For instance, we generate a tree (tr) and two
variables simulated on that tree, one continuous (x) and one discrete
(z) with three levels:

tr <- rphylo(50, .1, 0)
x <- rTraitCont(tr)
z <- rTraitDisc(tr, k = 3)

We compute the PICs for x the usual way:

pic.x <- pic(x, tr)

And for z:

Z <- model.matrix(~ z)[, -1]
rownames(Z) <- names(z)
pic.z <- apply(Z, 2, pic, phy = tr)

Note that we drop the column with 1's, so Z is a matrix with 2 columns
(number of levels - 1). Thus, pic.z is a matrix with 49 rows (n - 1) and
2 columns. We can now perform a linear regression with the two sets of PICs:

lm(pic.x ~ pic.z - 1)

This should give you the same coefficients than a PGLS like this:

library(nlme)
gls(x ~ z, correlation = corBrownian(phy = tr))

A very nice explanation of this can be found in Blomberg et al. (2012,
Syst. Biol.).

The two columns in pic.z should not be considered separately, in the
same way than in an ANOVA where there are 2 df associated with a 3-level
factor.

HTH

Best,

Emmanuel

Le 04/03/2016 01:07, Kate Boyce-Miles a écrit :
>
> Hello
>
> I have been using numeric vectors to perform phylogenetic independent 
> contrasts of several ecological variables for the cat phylogeny, using the 
> ape package in r, and I was wondering how this can be done using categorical 
> values?
>
> Example of how I have been using numeric values:
>
> tree <- read.newick("phylogeny.txt")
>
> tree <- as.phylo(tree)
>
> tree <- root(tree,1)
>
> x<-c() # x would vectors, for instance rainfall. One value for each 
> operational taxonomic unit on the tree, and the same order as they appear in 
> the newick file.
>
> pic.rain <- pic(x, tree, scaled = T, var.contrasts = F, rescaled.tree = F) # 
> To generate the phylogenetic independent contrasts
>
> cor.test(pic.rain,pic.rain) # To test for a correlation, obviously for rain 
> and rain it would be 1.
>
> How can this be done using data such as habitat, i.e grassland/forest/desert, 
> or activity, i.e. nocturnal, diurnal etc?
>
> I would be very grateful for any suggestions.
>
> Kate.
>
>   [[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/
>
>
> Pour nous remonter une erreur de filtrage, veuillez vous rendre ici : 
> http://f.security-mail.net/301tdFND1Ht
>
>

___
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] How to use categorical vectors in package ape for phylogenetic independent contrasts

2016-03-04 Thread Emmanuel Paradis

Hi Kate,

You can compute PICs for a categorical variable in the same way than 
you enter it in a linear model, that is by first computing its 
"contrasts" (this is different from the "P-I-Contrasts", though both 
have some conceptual similarities). The easiest way to do it is to use 
the function model.matrix. For instance, we generate a tree (tr) and two 
variables simulated on that tree, one continuous (x) and one discrete 
(z) with three levels:


tr <- rphylo(50, .1, 0)
x <- rTraitCont(tr)
z <- rTraitDisc(tr, k = 3)

We compute the PICs for x the usual way:

pic.x <- pic(x, tr)

And for z:

Z <- model.matrix(~ z)[, -1]
rownames(Z) <- names(z)
pic.z <- apply(Z, 2, pic, phy = tr)

Note that we drop the column with 1's, so Z is a matrix with 2 columns 
(number of levels - 1). Thus, pic.z is a matrix with 49 rows (n - 1) and 
2 columns. We can now perform a linear regression with the two sets of PICs:


lm(pic.x ~ pic.z - 1)

This should give you the same coefficients than a PGLS like this:

library(nlme)
gls(x ~ z, correlation = corBrownian(phy = tr))

A very nice explanation of this can be found in Blomberg et al. (2012, 
Syst. Biol.).


The two columns in pic.z should not be considered separately, in the 
same way than in an ANOVA where there are 2 df associated with a 3-level 
factor.


HTH

Best,

Emmanuel

Le 04/03/2016 01:07, Kate Boyce-Miles a écrit :


Hello

I have been using numeric vectors to perform phylogenetic independent contrasts 
of several ecological variables for the cat phylogeny, using the ape package in 
r, and I was wondering how this can be done using categorical values?

Example of how I have been using numeric values:

tree <- read.newick("phylogeny.txt")

tree <- as.phylo(tree)

tree <- root(tree,1)

x<-c() # x would vectors, for instance rainfall. One value for each operational 
taxonomic unit on the tree, and the same order as they appear in the newick file.

pic.rain <- pic(x, tree, scaled = T, var.contrasts = F, rescaled.tree = F) # To 
generate the phylogenetic independent contrasts

cor.test(pic.rain,pic.rain) # To test for a correlation, obviously for rain and 
rain it would be 1.

How can this be done using data such as habitat, i.e grassland/forest/desert, 
or activity, i.e. nocturnal, diurnal etc?

I would be very grateful for any suggestions.

Kate.

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


Pour nous remonter une erreur de filtrage, veuillez vous rendre ici : 
http://f.security-mail.net/301tdFND1Ht




___
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] root in mvOU

2016-03-04 Thread Julien Clavel
Hi Jarod,

In fact you can either choose a fixed root, or a draw from a multivariate 
normal with the stationary covariance (random root).

I will change the name of the options in an upcoming release (and on gitHub) to 
make it more explicit and make it homogeneous with univariate implementations

HTH,

Julien


For instance for the univariate case, you will also find both parameterizations 
in the phylolm package (Ho & Ané, 2014):

library(mvMORPH)
library(phylolm)

set.seed(123)
tre = pbtree(n=100, scale=1)

# with phylolm
x <- rTrait(n=1, phy=tre, model="OU", 
parameters=list(optimal.value=2,sigma2=1,alpha=0.1))
phylolm(x~1,phy=tre,model="OUrandomRoot")
phylolm(x~1,phy=tre,model="OUfixedRoot")

# with mvMORPH
mvOU(tre, x,model="OU1", param=list(vcv="ouch"))
mvOU(tre, x,model="OU1", param=list(vcv="mvmorph"))




De : R-sig-phylo  de la part de Jarrod 
Hadfield 
Envoyé : vendredi 4 mars 2016 07:45
À : r-sig-phylo@r-project.org
Objet : [R-sig-phylo] root in mvOU

Hi,

I am unclear what assumptions are being made about the root values in
mvOU, and was wondering if someone could clarify? For ease, imagine an
OU1 model where there is one optimum per trait and so theta is a vector.
Is the root value assumed to be theta, or a draw from a multivariate
normal with expectation theta, and covariance matrix equal to the
stationary covariance?

Thanks for any help,

Jarrod

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___
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] standard error (NaN) in model ARD

2016-03-04 Thread Emmanuel Paradis

Hi Felipe,

You didn't tell us what function you used: I assumed it was ace() in ape.

Often, the fact that SEs cannot be computed by ace() means that the 
model is a poor fit and that a simpler model is better. You said that 
the LRT is significant (did you use anova() on the outputs of ace?), so 
maybe there is an intermediate model between ARD and ER that fits better.


Best,

Emmanuel

Le 29/02/2016 19:25, Felipe Rossetto a écrit :

Hello everyone,
I am estimating the ancestral state for a 3-state discrete character. The
log-likelihood test indicated the all rates different model (ARD) fits well
for this character, however, thre was message warning NANs were produced.
So, I looked for standard error typing the command:

ARDreconstruction$se

and only NaNs were detected:

[1] NaN NaN NaN NaN NaN NaN


  Then, that means there is not confidence in the recosntructed rates using
ARD model? Then is it better ER for estimating ancestral state for this
character?

Many thanks
Felipe Rossetto
Herbário FUEL
Departamento de Biologia Animal e Vegetal
Universidade Estadual de Londrina
Rodovia Celso Garcia Cid, PR 445 Km 380, Campus Universitário
Caixa postal 10.011
CEP: 86057-970
Londrina, Paraná, Brasil
CV: http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4211230P7

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