R code for PGLS analysis and brain transformations # Regressions of brain volumes # Calculating relative brain size library("ape") library("geiger") library("caper") carnrbs <- read.csv("/Users/helen/OneDrive/Documents/RBSCarn.csv") mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") myframe <- data.frame(carnrbs) rownames(myframe) <- carnrbs$S name.check(mytree, myframe, data.names = myframe$S) matches<-match(mytree$tip.label, carnrbs$S, nomatch=0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) carn <- pgls(LogECV ~ LogMass, data = mycombi, lambda = "ML") residuals(carn) # Calculating relative neocortex size library("ape") library("geiger") library("caper") carnneo <- read.csv("/Users/helen/OneDrive/Documents/CarnNeo.csv") mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") myframe <- data.frame(carnneo) rownames(myframe) <- carnneo$S name.check(mytree, myframe, data.names = myframe$S) matches<-match(mytree$tip.label, carnneo$S, nomatch=0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) carnneo <- pgls(LogNeo ~ LogMass, data = mycombi, lambda = "ML") residuals(carnneo) # Calculating relative cerebellum size library("ape") library("geiger") library("caper") carncere <- read.csv("/Users/helen/OneDrive/Documents/CarnCere.csv") mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") myframe <- data.frame(carncere) rownames(myframe) <- carncere$S name.check(mytree, myframe, data.names = myframe$S) matches<-match(mytree$tip.label, carncere$S, nomatch=0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) carncere <- pgls(LogCere ~ LogM, data = mycombi, lambda = "ML") residuals(carncere) # Calculating EQ eq <- read.csv("/Users/helen/OneDrive/Documents/PrimRBS.csv") model.lm <- lm(LogECV ~ LogMass, data = eq) m = 10^(model.lm$coefficients) ## intercept e = model.lm$coefficients ##slope # Repeat all steps again using primate data # PGLS Models Primates # ECV Models # Social library("ape") library("geiger") library("caper") model1p <- read.csv("/Users/helen/OneDrive/Documents/Model1P.csv") myframe <- data.frame(model1p) rownames(myframe) <- model1p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogGS + SC, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC, data = mycombi, lambda = "ML" ) BIC(model1) #Ecological library("ape") library("geiger") library("caper") model1p <- read.csv("/Users/helen/OneDrive/Documents/Model1P.csv") model1p$D <- as.factor(model1p$D) myframe <- data.frame(model1p) rownames(myframe) <- model1p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) # Social & Ecological library("ape") library("geiger") library("caper") model1p <- read.csv("/Users/helen/OneDrive/Documents/Model1P.csv") model1p$D <- as.factor(model1p$D) myframe <- data.frame(model1p) rownames(myframe) <- model1p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) # Life History library("ape") library("geiger") library("caper") model1p <- read.csv("/Users/helen/OneDrive/Documents/Model1P.csv") myframe <- data.frame(model1p) rownames(myframe) <- model1p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # Combined library("ape") library("geiger") library("caper") model1p <- read.csv("/Users/helen/OneDrive/Documents/Model1P.csv") model1p$D <- as.factor(model1p$D) myframe <- data.frame(model1p) rownames(myframe) <- model1p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + SC + DB + LogHR + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + LogHR + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + LogHR + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # RBS Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model2p <- read.csv("/Users/helen/OneDrive/Documents/Model2P.csv") model2p$D <- as.factor(model2p$D) myframe <- data.frame(model2p) rownames(myframe) <- model2p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model2p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(RBS ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ SC + DB + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ LogGS + DB + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ LogGS + DB + LogGL + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ SC + DB + LogGL + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ SC + DB + LogGL + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ SC + DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ LogGS + DB + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ LogGS + DB + LogGL + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ SC + DB + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ LogGS + DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ LogGS + DB + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ SC + DB + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # EQ Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model3p <- read.csv("/Users/helen/OneDrive/Documents/Model3P.csv") model3p$D <- as.factor(model3p$D) myframe <- data.frame(model3p) rownames(myframe) <- model3p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model3p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(EQ ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ SC + DB + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ LogGS + DB + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ LogGS + DB + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ LogGS + DB + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ LogGS + DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ LogGS + DB + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ SC + DB + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ SC + DB + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ SC + DB + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ SC + DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # RNS Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model4p <- read.csv("/Users/helen/OneDrive/Documents/Model4P.csv") model4p$D <- as.factor(model4p$D) myframe <- data.frame(model4p) rownames(myframe) <- model4p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model4p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(RNS ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogHR + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogHR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogHR + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogHR + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogHR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ D + LogHR + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogHR + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogHR + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) # RCS Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model5p <- read.csv("/Users/helen/OneDrive/Documents/Model5P.csv") model5p$D <- as.factor(model5p$D) myframe <- data.frame(model5p) rownames(myframe) <- model5p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model5p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(RCS ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + D + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + D + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ D + LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ D + LogHR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ D + LogHR + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + D + LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + D + LogHR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ D + DB + LogHR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ D + DB + LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ D + LogHR + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + D + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ LogGS + D + LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) # Neo Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model6p <- read.csv("/Users/helen/OneDrive/Documents/Model6P.csv") model6p$D <- as.factor(model6p$D) myframe <- data.frame(model6p) rownames(myframe) <- model6p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model6p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogNeoROB ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogNeoROB ~ D + LogHR + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogNeoROB ~ SC + D + LogHR + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogNeoROB ~ LogGS + D + LogHR + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) # Cere Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model7p <- read.csv("/Users/helen/OneDrive/Documents/Model7P.csv") model7p$D <- as.factor(model7p$D) myframe <- data.frame(model7p) rownames(myframe) <- model7p$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model7p$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogCereROB ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ D + LogHR + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ D + LogHR + LogGL + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ LogGS + D + LogHR + LogGL + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ LogGS + D + LogHR + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ SC + D + LogHR + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ SC + D + LogHR + LogGL + LogML + LogWA, data = mycombi, lambda = "ML") BIC(model1) # PGLS Models Carnivores # ECV Models # Social library("ape") library("geiger") library("caper") model1c <- read.csv("/Users/helen/OneDrive/Documents/Model1C.csv") myframe <- data.frame(model1c) rownames(myframe) <- model1c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogGS + SC, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC, data = mycombi, lambda = "ML" ) BIC(model1) #Ecological library("ape") library("geiger") library("caper") model1c <- read.csv("/Users/helen/OneDrive/Documents/Model1C.csv") model1c$D <- as.factor(model1c$D) myframe <- data.frame(model1c) rownames(myframe) <- model1c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) # Social & Ecological library("ape") library("geiger") library("caper") model1c <- read.csv("/Users/helen/OneDrive/Documents/Model1C.csv") model1c$D <- as.factor(model1c$D) myframe <- data.frame(model1c) rownames(myframe) <- model1c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + D + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + HV, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + HV + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + DB + LogHR, data = mycombi, lambda = "ML" ) BIC(model1) # Life History library("ape") library("geiger") library("caper") model1c <- read.csv("/Users/helen/OneDrive/Documents/Model1C.csv") myframe <- data.frame(model1c) rownames(myframe) <- model1c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGL + LogML + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # Combined library("ape") library("geiger") library("caper") model1c <- read.csv("/Users/helen/OneDrive/Documents/Model1C.csv") model1c$D <- as.factor(model1c$D) myframe <- data.frame(model1c) rownames(myframe) <- model1c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model1c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogECV ~ LogMass + LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + DB + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + HV + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + LogGS + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(LogECV ~ LogMass + SC + LogF, data = mycombi, lambda = "ML" ) BIC(model1) # RBS Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model2c <- read.csv("/Users/helen/OneDrive/Documents/Model2C.csv") model2c$D <- as.factor(model2c$D) myframe <- data.frame(model2c) rownames(myframe) <- model2c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model2c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(RBS ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ DB + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ HV + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ DB + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ DB + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ HV + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ DB + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ HV + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RBS ~ HV + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # EQ Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model3c <- read.csv("/Users/helen/OneDrive/Documents/Model3C.csv") model3c$D <- as.factor(model3c$D) myframe <- data.frame(model3c) rownames(myframe) <- model3c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model3c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(EQ ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ HV + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ HV + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ HV + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(EQ ~ DB + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) # RNS Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model4c <- read.csv("/Users/helen/OneDrive/Documents/Model4C.csv") model4c$D <- as.factor(model4c$D) myframe <- data.frame(model4c) rownames(myframe) <- model4c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model4c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(RNS ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ LogHR + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ LogHR + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ HV + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogF + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ HV + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ HV + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ HV + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ DB + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ LogHR + LogF + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RNS ~ LogHR + LogF, data = mycombi, lambda = "ML" ) BIC(model1) # RCS Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model5c <- read.csv("/Users/helen/OneDrive/Documents/Model5C.csv") model5c$D <- as.factor(model5c$D) myframe <- data.frame(model5c) rownames(myframe) <- model5c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model5c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(RCS ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ LogGS + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + LogML, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + LogF, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ SC + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ LogGS + LogWA, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ LogGS + LogFR, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ LogGS + LogGL, data = mycombi, lambda = "ML" ) BIC(model1) model1 <- pgls(RCS ~ LogGS + LogF, data = mycombi, lambda = "ML" ) BIC(model1) # Neo Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model6c <- read.csv("/Users/helen/OneDrive/Documents/Model6C.csv") model6c$D <- as.factor(model6c$D) myframe <- data.frame(model6c) rownames(myframe) <- model6c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model6c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogNeoROB ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogNeoROB ~ LogHR + LogFR, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogNeoROB ~ LogHR + LogML + LogFR, data = mycombi, lambda = "ML") BIC(model1) # Cere Models # Repeat social, ecological, social & ecological, and life history models as outlined above # Combined library("ape") library("geiger") library("caper") model7c <- read.csv("/Users/helen/OneDrive/Documents/Model7C.csv") model7c$D <- as.factor(model7c$D) myframe <- data.frame(model7c) rownames(myframe) <- model7c$S mytree <- read.nexus("/Users/helen/OneDrive/Documents/Uphametal2019tree") matches <- match(mytree$tip.label, model7c$S, nomatch = 0) not<-subset(mytree$tip.label, matches==0) tree_pruned<-drop.tip(mytree, not) mycombi <- comparative.data(phy = tree_pruned, data = myframe, names.col = S, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) model1 <- pgls(LogCereROB ~ LogGS + SC + D + DB + HV + LogHR + LogGL + LogML + LogF + LogFR + LogWA, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ LogHR + LogGL + LogML + LogFR, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ LogHR + LogML + LogFR, data = mycombi, lambda = "ML") BIC(model1) model1 <- pgls(LogCereROB ~ LogHR + LogML + LogFR + LogWA, data = mycombi, lambda = "ML") BIC(model1) #All models run