Monday, September 9, 2013

To see if the geometric mean could be used to predict body size, I performed a phylogenetic regression.

Here is the following script used to generate the data for the paper:
(start with body_size.csv).

library (caper)
#make a comparative data frame
data<-comparative.data(phy=tree,data=collapsed.babbler,names.col=matched.tip )

#make two different models; one using maximum likelihood and one using browning motion
mod1<-pgls(log(mean.mass)~log(mean.gm),data, lambda = "ML")
mod2<-pgls(log(mean.mass)~log(mean.gm),data)

#compare the two models using log likelihood
logLik(mod1)
logLik(mod2)

#results of ML model

#results of brownian motion model


#when comparing the two models, compare the LL--since very close, use simpler model (Brownian motion)

Here is the ggplot2 code to generate the scatterplot:
library(ggplot2)
qplot(log(mean.gm),log(mean.mass), data=new,xlab = "Geometric Mean (log)", ylab = "Body Mass (log)",  size = I(7))+theme_bw()+theme(text = element_text(size=30))+ geom_abline(intercept=-1.82487, slope=2.28979)

Monday, September 2, 2013

babblersPCA.csv is the data to be used for analysis for publication

babblers.csv was the file used without any imputation or editing yet