Re: [R-sig-phylo] phylogenetic MANOVA

2014-03-06 Thread Luke Harmon
Hi all - 

Just a quick note to say that I tracked this down as a bug in GEIGER. The bug 
is specific to using Wilks’ lambda for a MANOVA test statistic, and results 
from the fact that the scale of Wilks’ lambda is reversed compared to other 
test statistics (e.g. smaller values = more difference among groups).

I have updated geiger on github, and we will post this update to CRAN as soon 
as we can. In the meantime, a fixed version of the function is pasted below.

Luke Harmon

aov.phylo=function(formula, phy, nsim=1000, test=c(Wilks, Pillai, 
Hotelling-Lawley, Roy), ...){
xx=lapply(all.vars(formula), get)
flag='formula' must be of the form 'dat~group', where 'group' is a named 
factor vector and 'dat' is a data matrix or named vector

if(!is.factor(xx[[2]])) stop(flag)
if(is.null(names(xx[[2]]))) stop(flag)

yy=merge(xx[[1]], xx[[2]], by=0)
if(nrow(yy)==0) stop(flag)
rownames(yy)=yy[,1]
yy=yy[,-1]

tmp-treedata(phy, yy, sort=TRUE)
phy=tmp$phy
yy=yy[phy$tip.label,]

group=structure(yy[,ncol(yy)], names=rownames(yy))
dat=as.matrix(yy[,-ncol(yy)])
rownames(dat)=rownames(yy)

s-ratematrix(phy, dat)
  
multivar=ifelse(ncol(dat)1, TRUE, FALSE)
if(multivar){
test=match.arg(test, c(Wilks, Pillai, Hotelling-Lawley, Roy))
m=summary.manova(mod-manova(dat~group), test=test)
f.data=m[[4]][1,2]
FUN=function(xx) summary.manova(manova(as.matrix(xx)~group), 
test=test)[[4]][1,2]
sims-sim.char(phy, s, nsim=nsim)
f.null-apply(sims, 3, FUN)
out=as.data.frame(m[[4]])
attr(out, heading)=c(Multivariate Analysis of Variance 
Table\n,Response: dat)
} else {
test=NULL
m=anova(mod-lm(dat~group))
f.data-m[1,4]
FUN=function(xx) anova(lm(xx~group))[1,4]
out=as.data.frame(m)
}
colnames(out)=gsub( , -, colnames(out))
sims-sim.char(phy, s, nsim=nsim)
f.null-apply(sims, 3, FUN)
if(test==Wilks) {
p.phylo = (sum(f.null  f.data) + 1)/(nsim + 1)
} else {
p.phylo = (sum(f.null  f.data) + 1)/(nsim + 1)
}
out$'Pr(phy)'=c(p.phylo, NA)
class(out) - c(anova, data.frame)
print(out, ...)
attr(mod, summary)=out
return(mod)
}

On Mar 6, 2014, at 11:54 AM, Anna Kostikova anna.kostik...@gmail.com wrote:

 Absolutely agree, but typically such effect (at least in multiple regression) 
 could be a result of multicollinearity, that's why I still proposed to check 
 PCs to make sure there is nothing unusual about them.
 
 Anna
 
 
 
 On 6 Mar 2014, at 20:35, Paolo Piras paolo.pi...@uniroma3.it wrote:
 
 PCscores coming from the same PCA are independent (orthogonal) by definition
 best
 paolo
 
 
 
 Da: r-sig-phylo-boun...@r-project.org r-sig-phylo-boun...@r-project.org 
 per conto di Anna Kostikova anna.kostik...@gmail.com
 Inviato: giovedì 6 marzo 2014 20.37
 A: Frédérich Bruno
 Cc: r-sig-phylo@r-project.org
 Oggetto: Re: [R-sig-phylo] phylogenetic MANOVA
 
 Hello Bruno,
 
 Could you check how much your individual PCs are correlated with each other? 
 What you see might be a result of (high) multicollinearity (negative or 
 positive) between predictors.
 
 Cheers,
 Anna
 
 
 On 6 Mar 2014, at 17:19, Frédérich Bruno bruno.freder...@ulg.ac.be wrote:
 
 Dear All,
 
 I am exploring body shape variation in a fish family, using shape variables 
 generated by landmark-based geometric morphometrics. To test shape 
 divergence among ecomorphs, I would like to perform a phylogenetic MANOVA.
 
 To perform such a test, the function aov.phylo in geiger is available.
 However, I think I have some troubles with it...
 
 Indeed, firstly, I performed phylo ANOVAs using phylANOVA function in 
 phytools on the three first PCs (explaining more than 70% of shape 
 variation) of my shape dataset and found highly significant differences 
 among ecomorphs for PC2 and PC3.
 
 Then, I applied a phylo MANOVA using aov.phylo including all the shape 
 variables and got a non-significant result (P-value = 1).
 
 So, according to my expectations and the univariate results from 
 phylANOVAs, the results of phylo MANOVA seems a little bit strange to me...
 
 Do someone have an explanation?
 Do you know another function than aov.phylo to perform a phyloMANOVA? (for 
 comparisons)
 
 Thank you in advance for your advices and your help!
 
 Best,
 
 Bruno
 
 --
 Dr. Bruno Frédérich
 Postdoctoral Researcher F.R.S.-FNRS
 Lab. of Functional and Evolutionary Morphology
 University of Liège, Institut de Chimie (B6c)
 4000 Liège, BELGIUM
 
 Phone: 003243665133
 Fax: 003243663715
 E-mail: bruno.freder...@ulg.ac.be
 Website: http://www2.ulg.ac.be/morfonct/
 
 Open Repository and Bibliography (ORBi) http://orbi.ulg.ac.be/
 Personal Publications (Open Access) http://tinyurl.com/Bruno-Reef
 
 
 [[alternative HTML version deleted]]
 
 

[R-sig-phylo] phyloxml

2014-03-06 Thread Ondřej Mikula
Dear all,
are you aware of any routine importing phylogenetic trees in .phyloxml
format into R?
Best wishes,
Ondřej

-- 
Ondřej Mikula

Institute of Animal Physiology and Genetics
Academy of Sciences of the Czech Republic
Veveri 97, 60200 Brno, Czech Republic

Institute of Vertebrate Biology
Academy of Sciences of the Czech Republic
Studenec 122, 67502 Konesin, Czech Republic

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