[R-sig-phylo] 99 Ways to ruin an open source project

2016-11-03 Thread Joseph W. Brown
Here is a cheeky post  by Brandon 
Keepers on how to do things wrong when developing open source software. Lots of 
good stuff in there!

JWB

Joseph W. Brown
Post-doctoral Researcher, Smith Laboratory
University of Michigan
Department of Ecology & Evolutionary Biology
Room 2071, Kraus Natural Sciences Building
Ann Arbor MI 48109-1079
josep...@umich.edu




[[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] simulate tree by specifying taxa distance

2016-11-03 Thread Yu, Guangchuang
Dear all,

I want to simulate tree with restricted taxa distances (e.g. all taxa
distance should be less than 0.1). Is there any R package can do this?

Best wishes,
Guangchuang
-- 
--~--~-~--~~~---~--~~
Guangchuang Yu, PhD Candidate
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
www: https://guangchuangyu.github.io
-~--~~~~--~~--~--~---

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

Re: [R-sig-phylo] simulate tree by specifying taxa distance

2016-11-03 Thread Giulio V. Dalla Riva
Dear Guangchuang,


Wouldn't that require that the distance between root and current time is, at 
most, 0.05 (= 0.1 /2) ?

In that case, I believe you just need to rescale the tree you simulated. That 
can be done in a number of way according to which package you use, e.g., in 
phytool:

pbtree(n=1000,scale=0.05)


Best,

Giulio Valentino Dalla Riva

Beaty Biodiversity Research Centre
University of British Columbia
Vancouver, Canada

From: R-sig-phylo  on behalf of Yu, 
Guangchuang 
Sent: November 3, 2016 5:02:25 AM
To: r-sig-phylo@r-project.org
Subject: [R-sig-phylo] simulate tree by specifying taxa distance

Dear all,

I want to simulate tree with restricted taxa distances (e.g. all taxa
distance should be less than 0.1). Is there any R package can do this?

Best wishes,
Guangchuang
--
--~--~-~--~~~---~--~~
Guangchuang Yu, PhD Candidate
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
www: https://guangchuangyu.github.io
-~--~~~~--~~--~--~---

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


Re: [R-sig-phylo] simulate tree by specifying taxa distance

2016-11-03 Thread Yu, Guangchuang
Dear Guilio,

Thank you! I will try phytools.

Best wishes,
Guangchuang

On Thu, Nov 3, 2016 at 11:57 PM, Giulio V. Dalla Riva 
wrote:

> Dear Guangchuang,
>
>
> Wouldn't that require that the distance between root and current time is,
> at most, 0.05 (= 0.1 /2) ?
>
> In that case, I believe you just need to rescale the tree you simulated.
> That can be done in a number of way according to which package you use,
> e.g., in phytool:
>
> pbtree(n=1000,scale=0.05)
>
>
> Best,
> Giulio Valentino Dalla Riva
>
> Beaty Biodiversity Research Centre
> University of British Columbia
> Vancouver, Canada
> --
> *From:* R-sig-phylo  on behalf of Yu,
> Guangchuang 
> *Sent:* November 3, 2016 5:02:25 AM
> *To:* r-sig-phylo@r-project.org
> *Subject:* [R-sig-phylo] simulate tree by specifying taxa distance
>
> Dear all,
>
> I want to simulate tree with restricted taxa distances (e.g. all taxa
> distance should be less than 0.1). Is there any R package can do this?
>
> Best wishes,
> Guangchuang
> --
> --~--~-~--~~~---~--~~
> Guangchuang Yu, PhD Candidate
> State Key Laboratory of Emerging Infectious Diseases
> School of Public Health
> The University of Hong Kong
> Hong Kong SAR, China
> www: https://guangchuangyu.github.io
> -~--~~~~--~~--~--~---
>
> [[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-ph...@r-project.org/
>



-- 
--~--~-~--~~~---~--~~
Guangchuang Yu, PhD Candidate
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
www: https://guangchuangyu.github.io
-~--~~~~--~~--~--~---

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