[R-sig-phylo] Applying standard error in phylogenetic signal measurement using lambda

2017-04-27 Thread Chen, Ting-Wen
Dear all,

I’m measuring phylogenetic signal for a set of continuous traits using the 
function “phylosig”. I try to apply standard error of measurements in Pagel’s 
lambda, but the R gives this error message:

'Error in solve.default(V) :
  Lapack routine dgesv: system is exactly singular: U[1,1] = 0’

It seems to be a problem when the function tries to invert the matrix? Does 
anybody know how to solve this problem? I have tried to multiply all trait 
values and standard errors by e.g. 100, and for some traits it works but for 
some not…

Any suggestion will be very appreciated. Thank you!

All the best
Ting-Wen

--
Ting-Wen Chen
Animal Ecology (AG Scheu)
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Göttingen
Untere Karspüle 2
D-37073 Göttingen, Germany


[[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] bonferroni corrections in Blomberg's K and Pagel's lambda

2016-12-16 Thread Chen, Ting-Wen
Hi Carmelo,

thank you so much for the suggestions. =)

All the best
Ting-Wen


--
Ting-Wen Chen
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Goettingen
Berliner Str. 28
D-37073 Goettingen, Germany
Tel: +49-55139-10943

r-sig-phylo-requ...@r-project.org 於 
2016年12月16日 19:00 寫道:

Message: 5
Date: Fri, 16 Dec 2016 05:02:23 +0100
From: Carmelo Fruciano >
To: r-sig-phylo@r-project.org
Subject: Re: [R-sig-phylo] bonferroni corrections in Blomberg's K and
Pagel's lambda
Message-ID: 
<20161216050223.47442dfb1b3g9...@webmail.unict.it>
Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed"

Hi Ting-Wen,
as Ted pointed out, if and how one has to correct for multiple tests
is a huge topic. Perhaps looking at the literature and making your own
opinion on this matter would be the best choice (for example, Perneger
1998 - British Medical Journal and Garcia 2004 - Oikos, present two
different points of view in a very accessible way).

A few extra points:
- There are other methods that are generally less conservative than
the Holm procedure ("Sequential Bonferroni"); these include the
Benjamini-Hochberg procedure (Benjamini & Hochberg 1995 - Journal of
the Royal Statistical Society; see also Benjamini & Yekutieli 2001 -
The Annals of Statistics) and other more recent procedures (such as
Carvajal-Rodriguez & de Una-Alvarez 2011 - Plos One); most of these
are worth checking out, making your opinion on them and, possibly,
using them (most of them have R implementations)

- If your dataset is multidimensional/multivariate in nature, you
might want to consider using multivariate approaches for estimating
and testing for phylogenetic signal (e.g., Adams 2014 - Systematic
Biology), rather than many univariate tests

- If your dataset/hypothesis is multivariate in nature, testing
individual PCs separately might be a poor choice (especially for PCs
of order higher than 1), if it is not multivariate in nature, there
might be no reason to use PCA

I hope this is of some help.
Best,
Carmelo



--
Carmelo Fruciano
Postdoctoral Fellow - Queensland University of Technology - Brisbane,
Australia
Honorary Fellow - University of Catania - Catania, Italy
e-mail c.fruci...@unict.it
http://www.fruciano.it/research/


[[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] bonferroni corrections in Blomberg's K and Pagel's lambda

2016-12-13 Thread Chen, Ting-Wen
Dear Ted, dear Fabio,

thank you so much for your suggestions. I found that people applied bonferroni 
corrections in p-values in Pagel’s lambda, as shown in this paper: 
http://www.pnas.org/content/106/43/18097.abstract

In my case, I decide to use p.adjust (x,method=“holm”,n=length(x)) to correct 
the p-values, hope this would be better. I also did some PCA to reduce the 
trait dimensions and to avoid trait correlation with each other, and then 
tested phylogenetic signal for the first several PCs.

All the best
Ting-Wen

--
Ting-Wen Chen
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Goettingen
Berliner Str. 28
D-37073 Goettingen, Germany
Tel: +49-55139-10943

r-sig-phylo-requ...@r-project.org<mailto:r-sig-phylo-requ...@r-project.org> 於 
2016年12月13日 19:00 寫道:

Send R-sig-phylo mailing list submissions to
r-sig-phylo@r-project.org<mailto:r-sig-phylo@r-project.org>

To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
or, via email, send a message with subject or body 'help' to
r-sig-phylo-requ...@r-project.org

You can reach the person managing the list at
r-sig-phylo-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-phylo digest..."


Today's Topics:

  1. Re: bonferroni corrections in Blomberg's K and Pagel's lambda
 (F?bio Machado)


--

Message: 1
Date: Tue, 13 Dec 2016 08:49:59 -0200
From: F?bio Machado <macfa...@gmail.com>
To: "r-sig-phylo@r-project.org" <r-sig-phylo@r-project.org>
Subject: Re: [R-sig-phylo] bonferroni corrections in Blomberg's K and
Pagel's lambda
Message-ID: <bc3b8326-2692-44b9-94ae-56fc2d28b...@gmail.com>
Content-Type: text/plain; charset="UTF-8"

Recently I came across a similar issue, but I had a far greater number of 
repeated tests, 595 actually. If i used 10.000 permutations to access 
significance, I noticed that I could never reject the null hypothesis. That is 
because for 10.000 permutations, the minimum p value is 1e-04 and the 
bonferroni adjusted value is 0.0595. So, instead of using any multiple test 
corrections, I simply rejected the null-hypothesis when the observed statistic 
fell completely outside the distribution constructed by simulation. This 
produced nearly identical results to a parametric approach with bonferroni 
correction (I was analyzing correlations in that case).

I don?t know if that adds to the question initially raised, since for 18 tests, 
the minimum adjusted pvalues are still lower than 0.05, but this experience led 
me to believe that applying bonferroni correction to non-parametric p-value 
estimates is not that straightforward. I don?t know if another multiple-test 
correction method is more adequate for these cases. Any thoughts would be 
appreciated.

best regards,

Fabio Andrade Machado
Laborat?rio de Evolu??o de Mam?feros
Departamento de Gen?tica e Biologia Evolutiva- USP
f.mach...@usp.br <mailto:f.mach...@usp.br> ; macfa...@gmail.com 
<mailto:macfa...@gmail.com>
+55 11 982631029
skype: fabio_a_machado

Lattes: http://lattes.cnpq.br/3673327633303737 
<http://lattes.cnpq.br/3673327633303737>
Google Scholar: http://scholar.google.com/citations?hl=en=2l6-VrQJ 
<http://scholar.google.com/citations?hl=en=2l6-VrQJ>
ResearchGate: https://www.researchgate.net/profile/Fabio_Machado2 
<https://www.researchgate.net/profile/Fabio_Machado2>
On Dec 11, 2016, at 21:55, Theodore Garland <theodore.garl...@ucr.edu> wrote:

Dear Ting-Wen,

This is a question about statistical philosophy in general, not specific to
tests for phylogenetic signal.  How best to correct for making multiple
tests with related data is a huge and complicated topic.  Another issue is
whether your traits are correlated with each other, which would affect
views on what would be best to do.  In any case, beware that
simple Bonferroni correction is probably overly conservative, so perhaps at
least try something like sequential Bonferroni correction, if you do
attempt correction.

(Aside from the points above, I am assuming that the 18 compounds do not
add up to 100% of the sample.  If they do, then you would only want to
analyze 17 of them.)

Sincerely,
Ted Garland

On Sun, Dec 11, 2016 at 2:06 PM, Chen, Ting-Wen <
ting-wen.c...@biologie.uni-goettingen.de> wrote:

Dear all,

I?m analysing some chemical compositions of species and considering them
as ?traits?, let?s say, 18 different compounds concentration in 37 species.
I test phylogenetic signals in the percentage concentration of these
compounds using Blomberg?s K and Pagel?s lambda using the function
?phylosig". In Blomberg?s K I apply randomisation for the traits values on
the tree to have a p-value for the corresponding trait and in Pagel?s
lambda using likelihood test to get the p-value, re

[R-sig-phylo] error when using function read.GenBank in ape

2016-11-10 Thread Chen, Ting-Wen
Dear all,

recently I got an error when downloading sequences in R using MacOS 10.12 (but 
no problem when using WIndows 7). I was using the function read.GenBank in 
package ape and pretty sure my laptop was connecting to the internet. Following 
is how the error looks like:

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
...
[R.app GUI 1.68 (7288) x86_64-apple-darwin13.4.0]

> library(ape)
> read.GenBank("U15717")
Error in file(file, "r") : cannot open the connection

Does anybody know how to solve this problem?

All the best
Ting-Wen

--
Ting-Wen Chen
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Goettingen
Berliner Str. 28
D-37073 Goettingen, Germany
Tel: +49-55139-10943

___
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 signal test for discrete trait

2016-11-03 Thread Chen, Ting-Wen
Dear all,

I would like to test for phylogenetic signal in a discrete trait with 3 states 
(trait “str”) and another discrete trait with 7 states (trait “hab") using 
Pagel’s lambda. I have tried to apply  the function “fitDiscrete” in geiger to 
my data, but not sure whether this is correct or not: 

I first compared which of the 3 models (ER, SYM, ARD) fits to the trait data, 
and ER model is accepted for “str”, while ARD for “hab". Then I used the same 
function but set transform=“lambda” to get the likelihood based on the original 
tree, and compared it with the likelihood based on a lambda 0 tree, which was 
transformed to a star-like tree using the function “rescale”. For the “str" 
trait, the str_ER_lambda$opt says lambda is 1 (original tree), while the 
str_ER_lambda_0$opt says lambda approximates to 0 (lambda 0 tree). It’s clear 
that “str” shows phylogenetic signal, as indicated by the likelihood ratio 
test. But in the other trait “hab”, although the likelihood ratio test rejects 
lambda 0 tree, hab_ARD_lambda$opt$lambda is 0.216 (original tree), and 
hab_ARD_lambda_0$opt$lambda is 0.545 (lambda 0 tree). What does the lambda 
value mean in the returned list of fitDiscrete? Is the lambda value here 0.216 
based on the original tree still indicates the “hab” trait with phylogenetic 
signal, because the likelihood ratio test says so? Following are the scripts 
for testing “str” trait. It would be very helpful if I can receive some 
suggestions from you. Also it would be nice to know whether there is any other 
method to test phylogenetic signal for categorical traits. Thanks!

# the phylogenetic tree in use
phy2<-phy.chr.str4
phy2_0 <- rescale(phy.chr.str4, model = "lambda", 0) # lambda transform tree to 
star like

# load trait data
trait<-read.csv("traitdata.csv",row.names=1)

# lambda 1 and lambda 0 trees combined with trait data
trait_geiger <- treedata(phy2,trait)
trait_geiger_0 <- treedata(phy2_0,trait)

# Comparison of different models for trait evolution
# stratification
str_ER <- fitDiscrete(trait_geiger$phy, trait_geiger$data[,2], type="discrete", 
model = "ER", niter = 1000) 
str_SYM <- fitDiscrete(trait_geiger$phy, trait_geiger$data[,2], 
type="discrete", model = "SYM", niter = 1000) 
str_ARD <- fitDiscrete(trait_geiger$phy, trait_geiger$data[,2], 
type="discrete", model = "ARD", niter = 1000) 

str_d_ER_vs_SYM <- abs(2*(str_ER$opt$lnL-str_SYM$opt$lnL)) # 1.543
str_p_value_ER_vs_SYM <- pchisq(str_d_ER_vs_SYM, 3-1, lower.tail=FALSE) # 0.462 
-- Not rejects ER-model

str_d_ER_vs_ARD <- abs(2*(str_ER$opt$lnL-str_ARD$opt$lnL)) # 8.855
str_p_value_ER_vs_ARD <- pchisq(str_d_ER_vs_ARD, 6-1, lower.tail=FALSE) # 0.114 
-- Not rejects ER-model

str_ER # we accept the ER model for "stratification"

# phylogenetic signal test for trait stratification, using Pagel's lambda
str_ER_lambda <- fitDiscrete(trait_geiger$phy,trait_geiger$data[,2], 
type="discrete", model = "ER", transform = "lambda", niter = 1000) #AICc = 
129.778
str_ER_lambda_0 <- fitDiscrete(trait_geiger_0$phy,trait_geiger_0$data[,2], 
type="discrete", model = "ER", transform = "lambda", niter = 1000) #AICc = 
167.906
str_d_our_tree_vs_lambda_0 <- 
abs(2*(str_ER_lambda_0$opt$lnL-str_ER_lambda$opt$lnL)) # 38.127
str_p_our_tree_vs_lambda_0 <- pchisq(str_d_our_tree_vs_lambda_0, 1, 
lower.tail=FALSE) # 6.626e-10 -- Rejects no signal model, stratification has 
phylogenetic signal

All the best
Ting-Wen
--
Ting-Wen Chen
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Goettingen
Berliner Str. 28
D-37073 Goettingen, Germany
Tel: +49-55139-10943

___
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] When we say a trait is phylogenetically labile

2016-07-11 Thread Chen, Ting-Wen
Dear experts,

I am new in the comparative phylogenetic methods. By reading papers, when there 
is a term saying a trait is "phylogenetically labile”, does it mean that the 
trait is phylogenetically “convergent", with similar values for species from 
distantly related clades, or does it mean “random” values, irrespectively of 
phylogenetic relatedness? 

Another question related to this term, would you treat intraspecific variation, 
e.g. color variations of different individuals, or phenotypic plasticity, as a 
kind of phylogenetically labile, no matter whether there is a genetic basis or 
not?

Thanks a lot!

All the best
Ting-Wen

--
Ting-Wen Chen
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Goettingen
Berliner Str. 28
D-37073 Goettingen, Germany
Tel: +49-55139-10943

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