Ecological not social factors explain brain size in cephalopods.
9 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 13 matches
- [1] § STAR★Methods › Quantification and statistical analysis › Miscalculation in chung et al. (2023) › Variable definitions ↔ consensus_analyses.R, lines 41 to 128 · score 0.72 · matage.max, matage.min, minimum age, sexual maturity, st.cephdat, species · block
oscr:b:ABVVMNRHMNWG1-B· Report a mismatch - [2] § STAR★Methods › Quantification and statistical analysis › Miscalculation in chung et al. (2023) › Variable definitions ↔ plots_nov24.R, lines 390 to 464 · score 0.70 · matage.max, matage.min, minimum age, sexual maturity, st.cephdat, Variable · block
oscr:b:5P0WMRN8EB2KW-H· Report a mismatch - [3] § STAR★Methods › Method details ↔ consensus_analyses.R, lines 1 to 39 · score 0.69 · maximum clade credibility, correlations matrices, consensus, tree, phylogeny, cephalopod · block
oscr:b:8A5BJ3466YPBZ-2· Report a mismatch - [4] § STAR★Methods › Method details ↔ sensitivity-checks/supplement_sensitivitychecks.R, lines 1 to 51 · score 0.68 · maximum clade credibility, correlations matrices, tree, consensus, phylogeny, cephalopod · block
oscr:b:CDA8C7KWT137G-N· Report a mismatch - [5] § STAR★Methods › Quantification and statistical analysis › Causal graph ↔ dataprep_cephs.R, lines 17 to 105 · score 0.66 · encompasses cognition, adjustmentSets, cephdag, exposure, defense, foraging · block
oscr:b:J7C27PZPJC413-T· Report a mismatch - [6] § STAR★Methods › Quantification and statistical analysis › Additional analyses › Age at sexual maturity ↔ sensitivity-checks/supplement_sensitivitychecks.R, lines 53 to 91 · score 0.64 · sexual maturity, maximum age, sensitivity checks, somewhat, sociality, species · block
oscr:b:JKEGJVJNPTDSV-9· Report a mismatch - [7] § STAR★Methods › Quantification and statistical analysis › Additional analyses › Dietary breadth and predation pressure ↔ consensus_analyses.R, lines 217 to 266 · score 0.61 · Dietary breadth, diet breadth, predator breadth, interaction, predictor, benthic · block
oscr:b:2C7EZSVEWGJDB-V· Report a mismatch - [8] § STAR★Methods › Quantification and statistical analysis › Additional analyses › Age at sexual maturity ↔ consensus_analyses.R, lines 41 to 128 · score 0.56 · sexual maturity, maximum age, sociality, species, CNS, brain · block
oscr:b:ABVVMNRHMNWG1-B· Report a mismatch - [9] § STAR★Methods › Quantification and statistical analysis ↔ consensus_analyses.R, lines 1 to 39 · score 0.56 · consensus phylogeny, correlation matrix, bf, brms, Cormat, Models · block
oscr:b:8A5BJ3466YPBZ-2· Report a mismatch - [10] § STAR★Methods › Quantification and statistical analysis ↔ sensitivity-checks/supplement_sensitivitychecks.R, lines 378 to 438 · score 0.56 · diet breadth, Sensitivity checks, predator breadth, age, species · block
oscr:b:J9YZN0WZPHEPS-2· Report a mismatch - [11] § STAR★Methods › Quantification and statistical analysis ↔ sensitivity-checks/supplement_sensitivitychecks.R, lines 1 to 51 · score 0.54 · consensus phylogeny, correlation matrix, Cormat, ML, CNS, brain · block
oscr:b:CDA8C7KWT137G-N· Report a mismatch - [12] § STAR★Methods › Quantification and statistical analysis › Additional analyses › Behavioral repertoire ↔ consensus_analyses.R, lines 167 to 215 · score 0.52 · foraging repertoire, defense repertoire · block
oscr:b:A3W1R587DXDMV-X· Report a mismatch - [13] § STAR★Methods › Quantification and statistical analysis › Miscalculation in chung et al. (2023) › Variable definitions ↔ consensus_analyses.R, lines 217 to 266 · score 0.52 · diet.breadth, Dietary breadth, family, st.cephdat, Cephalopods · block
oscr:b:2C7EZSVEWGJDB-V· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 468 lines · 23 KB · no license · 7 matches
- #using consensus phylogeny for all models, with the updated dataset April 10, 2024 excluding I. paradoxus
- #UPDATING november 19, 2024 with corrected depth data----
- #load packages----
- library(brms)
- library(ape)
- library(mice)
- library(tidyverse)
- library(cmdstanr)
- library(dagitty)
- options(scipen=999) #turn off scientific notation
- #set working directory----
- setwd("/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/ceph-brain-evolution")
- getwd()
- #read in data and phylogenies
- cephtreeMCC <- read.nexus("cephtreeMCC.tree") #consensus (maximum clade credibility) tree
- cormat <- vcv(cephtreeMCC, corr=TRUE) #correlation matrix for consensus phylogeny
- st.cephdat <- read.csv("st.cephdat.csv") #logged and standardized data
- st.cephdat$benthic <- factor(st.cephdat$benthic)
- st.cephdat$sociality.bin <- factor(st.cephdat$sociality.bin)
- st.cephdat$sociality.3 <- factor(st.cephdat$sociality.3)
- st.cephdat$habitat3 <- factor(st.cephdat$habitat3)
- st.cephdat$depth_cat <- factor(st.cephdat$depth_cat)
- #ML baseline----
- m.MLst <- brm(bf(CNS.1 ~ mi(ML.1) + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.MLst)
- save(m.MLst, file="m.MLst.rda")
- #age of sexual maturity----
- ## with maximum age of sexual maturity and lifespan----
- m.smmax <- brm(bf(CNS.1 ~ mi(ML.1) + mi(lifespan.max) + mi(matage.max) + WoS + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(matage.max | mi() ~ 1 + mi(ML.1) + mi(lifespan.max) + WoS + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(lifespan.max | mi() ~ 1 + mi(ML.1) + WoS + benthic + depth.mean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species, cov=cormat))),
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,0.5), class = Intercept),
- prior(normal(0,0.5), class = b)),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend="cmdstanr", cores=4)
- summary(m.smmax)
- save(m.smmax, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.smmax.rda")
- 0.33/0.75 #0.33 instead of 0.3 mean
- ## minimum age----
- m.smmin <- brm(bf(CNS.1 ~ mi(ML.1) + mi(lifespan.min) + mi(matage.min) + WoS + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(matage.min | mi() ~ 1 + mi(ML.1) + mi(lifespan.min) + WoS + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(lifespan.min | mi() ~ 1 + mi(ML.1) + WoS + benthic + depth.mean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species, cov=cormat))),
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend="cmdstanr", cores=4)
- summary(m.smmin)
- save(m.smmin, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.smmin.rda")
- -0.11/0.75
- m.smmean <- brm(bf(CNS.1 ~ mi(ML.1) + mi(lifespan.mean) + mi(matage.mean) + WoS + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(matage.mean | mi() ~ 1 + mi(ML.1) + mi(lifespan.mean) + WoS + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(lifespan.mean | mi() ~ 1 + mi(ML.1) + WoS + benthic + depth.mean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species, cov=cormat))),
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend="cmdstanr", cores=4)
- summary(m.smmean)
- save(m.smmean, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.smmean.rda")
- 0.26 /0.75 #instead of 0.18
- #sociality----
- ## binary----
- m.soc <- brm(bf(CNS.1 ~ mi(ML.1) + sociality.bin + WoS + benthic + depth.mean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + (1|gr(phy.species, cov=cormat))),
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend="cmdstanr", cores=4)
- summary(m.soc)
- save(m.soc, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.soc.rda")
- -0.26/0.75 #-0.26 instead of -0.21
- ## 3 category----
- m.soc3 <- brm(bf(CNS.1 ~ mi(ML.1) + sociality.3 + WoS + benthic + depth.mean + (1|gr(phy.species,cov=cormat)))+
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + (1|gr(phy.species, cov=cormat))),
- data=st.cephdat,
- data2=list(cormat=cormat),
- family=gaussian("identity"),
- prior = c(prior(normal(0, 1), class = Intercept),
- prior(normal(0, 1), class = b)),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend="cmdstanr", cores=4)
- summary(m.soc3)
- save(m.soc3, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.soc3.rda")
- ## sociality decapodiformes only----
- decadat <- read.csv("decadat.csv")
- m.socdec <- brm(bf(CNS.1 ~ mi(ML.1) + sociality.bin + WoS + benthic + depth.mean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + (1|gr(phy.species, cov=cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data=decadat,
- data2=list(cormat=cormat),
- backend="cmdstanr", cores=4)
- summary(m.socdec)
- save(m.socdec, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/ceph-brain-evolution/nov2024_fits/m.socdec.rda")
- # behavioral complexity----
- #TB's constrained imputation function
- constrained_imputation <- function(model, vars) {
- # Extract and edit Stan code
- scode <- capture.output(stancode(model))
- # Initialize imp_code as empty
- imp_code <- scode
- for (var in vars) {
- # Match brms var name
- brms_var <- gsub("[\\._]", "", var)
- stan_var <- paste0("Ymi_", brms_var)
- # Find lower and upper bounds from the data
- lower_bound <- min(model$data[[var]], na.rm = TRUE)
- upper_bound <- max(model$data[[var]], na.rm = TRUE)
- # Amend Stan code and set lower and upper bounds on the imputed variable
- imp_code <- gsub(paste0("vector[Nmi_", brms_var, "] ", stan_var, ";"),
- paste0("vector<lower=", lower_bound, ", upper=", upper_bound, ">[Nmi_", brms_var, "] ", stan_var, ";"),
- imp_code, fixed = TRUE)
- }
- # Replace and compile the model object with the amended Stan code
- attributes(model$fit)$CmdStanModel <- cmdstan_model(write_stan_file(imp_code))
- # Fit to data with modified model
- model_constrain <- update(model,
- cores = 4, chains = 4, iter = 8000,
- recompile = FALSE,
- control = list(adapt_delta = 0.95))
- return(model_constrain)
- }
- ## combined cognition----
- m.cog.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(cog2) + benthic + articles.read + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat)))+
- bf(cog2 | mi() ~ 1 + benthic + articles.read + (1|gr(phy.species,cov=cormat))),
- family=gaussian,
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- backend="cmdstanr",
- chains = 0)
- m.cog.constrained <- constrained_imputation(model = m.cog.empty,
- vars = c("ML.1", "cog2"))
- summary(m.cog.constrained)
- save(m.cog.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.cog.rda")
- ## defense repertoire----
- m.def.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(defense.repertoire) + articles.read + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat)))+
- bf(defense.repertoire | mi() ~ 1 + benthic + articles.read + (1|gr(phy.species,cov=cormat))),
- family=gaussian,
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- chains = 0,
- backend="cmdstanr")
- m.def.constrained <- constrained_imputation(model = m.def.empty, vars = "defense.repertoire")
- summary(m.def.constrained)
- save(m.def.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.def.rda")
- ## foraging repertoire----
- m.hunt.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(foraging.repertoire) + articles.read + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat)))+
- bf(foraging.repertoire | mi() ~ 1 + benthic + articles.read + (1|gr(phy.species,cov=cormat))),
- family=gaussian,
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- chains=0,
- backend="cmdstanr")
- m.hunt.constrained <- constrained_imputation(model = m.hunt.empty,
- vars = c("ML.1", "foraging.repertoire"))
- summary(m.hunt.constrained)
- save(m.hunt.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.hunt.rda")
- #ecological richness----
- ## dietary breadth----
- m.diet.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(diet.breadth) + articles.read + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(diet.breadth | mi() ~ 1 + mi(ML.1) + articles.read + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))),
- family=gaussian,
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- chains = 0,
- backend="cmdstanr")
- m.diet.constrained <- constrained_imputation(model = m.diet.empty,
- vars = c("diet.breadth"))
- summary(m.diet.constrained)
- save(m.diet.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/ceph-brain-evolution/nov2024_fits/m.diet.rda")
- ## diet-benthic interaction----
- m.dhab.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(diet.breadth)*benthic + depth.mean + pos.latmean + articles.read + (1|gr(phy.species,cov=cormat))) +
- bf(diet.breadth | mi() ~ 1 + mi(ML.1) + articles.read + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1|gr(phy.species,cov=cormat))),
- family=gaussian,
- data=st.cephdat,
- data2=list(cormat=cormat),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- chains=0,
- backend="cmdstanr", cores=4)
- m.dhab.constrained <- constrained_imputation(model = m.dhab.empty, vars = "diet.breadth")
- summary(m.dhab.constrained)
- save(m.dhab.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.dhab.rda")
- ## number of predator groups----
- m.preds.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(predator.breadth) + depth.mean + benthic + articles.read + (1 | gr(phy.species, cov = cormat))) +
- bf(predator.breadth | mi() ~ 1 + mi(ML.1) + depth.mean + benthic + articles.read + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + (1 | gr(phy.species, cov = cormat))),
- family = gaussian,
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- chains=0,
- backend = "cmdstanr", cores = 4)
- m.preds.constrained <- constrained_imputation(model = m.preds.empty, vars = "predator.breadth")
- summary(m.preds.constrained)
- 0.08/0.75
- save(m.preds.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.preds.rda")
- ## predators-benthic interaction----
- m.phab.empty <- brm(bf(CNS.1 ~ mi(ML.1) + mi(predator.breadth)*benthic + articles.read + depth.mean + pos.latmean + (1 | gr(phy.species, cov = cormat))) +
- bf(predator.breadth | mi() ~ 1 + mi(ML.1) + articles.read + benthic + depth.mean + pos.latmean + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + benthic + depth.mean + pos.latmean + (1 | gr(phy.species, cov = cormat))),
- family = gaussian,
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat=cormat),
- chains=0,
- backend = "cmdstanr", cores = 4)
- m.phab.constrained <- constrained_imputation(model = m.phab.empty, vars = "predator.breadth")
- summary(m.phab.constrained)
- save(m.phab.constrained, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.phab.rda")
- ## habitat binary----
- m.benth <- brm(bf(CNS.1 ~ mi(ML.1) + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + WoS + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0, 1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.benth)
- save(m.benth, file="m.benth.rda")
- 0.58/0.75
- ## habitat 3 category----
- m.hab <- brm(bf(CNS.1 ~ mi(ML.1) + habitat3 + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + WoS + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0, 1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat=cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.hab)
- save(m.hab, file="m.hab.rda")
- ## latitude range----
- m.latrange <- brm(bf(CNS.1 ~ mi(ML.1) + lat.range + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + lat.range + benthic + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat=cormat),
- backend = "cmdstanr",
- iter=4000,
- cores = 4)
- summary(m.latrange)
- ## distance from equator----
- # rerunning August 2024 for distance from equator not mean
- m.eqdist <- brm(bf(CNS.1 ~ mi(ML.1) + eq.dist + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + pos.latmean + benthic + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat=cormat),
- backend = "cmdstanr",
- iter=4000,
- cores = 4)
- summary(m.eqdist)
- #and that's still nothing
- save(m.eqdist, file="m.eqdist.rda")
- ## mean depth----
- m.meandepth <- brm(bf(CNS.1 ~ mi(ML.1) + depth.mean + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.meandepth)
- save(m.meandepth, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.meandepth.rda")
- load(file="m.meandepth.rda")
- ## maximum depth----
- m.maxdepth <- brm(bf(CNS.1 ~ mi(ML.1) + depth.max + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.maxdepth)
- save(m.maxdepth, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.maxdepth.rda")
- 10/75 #instead of -0.22
- ## minimum depth----
- m.mindepth <- brm(bf(CNS.1 ~ mi(ML.1) + depth.min + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.mindepth)
- save(m.mindepth, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.mindepth.rda")
- -0.17/0.75 #instead of -0.14
- ## benthic*depth----
- m.maxdb <- brm(bf(CNS.1 ~ mi(ML.1) + depth.max*benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.maxdb)
- save(m.maxdb, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.maxdb.rda")
- m.mindb <- brm(bf(CNS.1 ~ mi(ML.1) + depth.min*benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.mindb)
- save(m.mindb, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.mindb.rda")
- m.meandb <- brm(bf(CNS.1 ~ mi(ML.1) + depth.mean*benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat = cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.meandb)
- save(m.meandb, file="/Users/kiranbasava/nonhumans/di_cephproject/analyses/cephalopod_analyses/nov2024_fits/m.meandb.rda")
- ## depth categories----
- m.depthcat <- brm(bf(CNS.1 ~ mi(ML.1) + depth_cat + benthic + WoS + (1 | gr(phy.species, cov = cormat))) +
- bf(ML.1 | mi() ~ 1 + depth_cat + benthic + (1 | gr(phy.species, cov = cormat))),
- prior = c(prior(normal(0,1), class = Intercept),
- prior(normal(0,0.5), class = b)),
- data = st.cephdat,
- data2 = list(cormat=cormat),
- iter = 8000, chains = 4,
- control = list(adapt_delta = 0.89),
- backend = "cmdstanr",
- cores = 4)
- summary(m.depthcat)
- save(m.depthcat, file="m.depthcat.rda")
- #ASR and signal----
- library(phytools)
- library(mice)
- getwd()
- #decomposition of phylogenetic distance matrix into orthogonal vectors (PVRs)
- phylo.vectors = PVR::PVRdecomp(cephtreeMCC)
- cephdat <- read.csv("cephdat.csv")
- ML.dat <- cephdat[c("phy.species", "CNS.1", "ML.1")]
- ML.dat$CNS.1 <- log(ML.dat$CNS.1)
- ML.dat$ML.1 <- log(ML.dat$ML.1)
- ML.dat <- complete(mice(ML.dat)) #imputation
- #calculate EQ
- ML.dat$EQ <- ML.dat$CNS.1/ML.dat$ML.1
- logEQ <- as.vector(ML.dat$EQ)
- names(logEQ) <- ML.dat$phy.species
- #ancestral state reconstruction and plot
- ASR <- contMap(cephtreeMCC, logEQ, plot=FALSE)
- length(ASR$cols)
- ASR$cols[1:1001]<-colorRampPalette(c("#feba2c","#d6556d","#2a0593"))(1001)
- plot(ASR)
- # Plot the mapped characters with the new colors
- plot(ASR, type="fan", outline=FALSE, legend = 0.7*max(nodeHeights(cephtreeMCC)),
- fsize = c(0.5, 0.7))
- save(ASR, file="ASR.rda")
- load(file="ASR.rda")
- plot(ASR)
consensus_analyses.R at commit a0ed371, no license · at the source
Overview
- University of Oxford, Oxford, UK
- University of Arizona, Tucson, CA, USA
- Aarhus University, Aarhus, Denmark
- London School of Economics and Political Science, London, UK
- University of Lethbridge, Lethbridge, AB, Canada
- New York University, New York, NY, USA
Abstract
Social factors have been argued to be the main selection pressure for the evolution of large brains and complex behavior, but many cephalopods live largely solitary, semelparous, short lives. This suggests that the large brains found in cephalopods are not the result of social selection pressures. Here, we derive specific, preregistered predictions from the “Asocial Brain Hypothesis” (ABH; an untested extension of the cultural brain hypothesis formal model), and evaluate those predicted associations using a new comparative dataset on brain size alongside social, ecological, and life history factors. Consistent with the ABH and other hypotheses predicting that ecological factors should be the primary selection pressure with larger brains in more calorie-rich complex ecologies, we find that shallower and benthic (seafloor) habitats are associated with larger brain sizes, and that measures of sociality are not. Our findings are not interpreted as causal, but are consistent with ecological hypotheses for brain evolution.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 13 matches between paragraphs and lines of code.
kcbasava/ceph-brain-evolution
a0ed3711e8999c7bf390304926617e957fd77483, 6 February 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
5 files
- consensus_analyses.R, R, 468 lines
- dataprep_cephs.R, R, 106 lines
- plots_nov24.R, R, 464 lines
- sensitivity-checks/
supplement_sensitivitych , R, 438 linesecks.R - README.md, Text, 1 line
drepanosaur/ceph-brain-evolution
a0ed3711e8999c7bf390304926617e957fd77483, 6 February 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
5 files
- consensus_analyses.R, R, 468 lines, 7 matches
- dataprep_cephs.R, R, 106 lines, 1 match
- plots_nov24.R, R, 464 lines, 1 match
- sensitivity-checks/
supplement_sensitivitych , R, 438 lines, 4 matchesecks.R - README.md, Text, 1 line
kcbasava/ceph-brain-evolution.•All
Availability: 1 check, the latest on 27 September 2026: the link is dead
- 27 September 2026: the link is dead
kcbasava/ceph-brain-evolution.•Any
Availability: 1 check, the latest on 27 September 2026: the link is dead
- 27 September 2026: the link is dead
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 8 scripts, each with its path and the digest of its content;
- 13 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data and code availability
• All data have been deposited on GitHub and are publicly available as of the date of publication at www.github.com/
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 3 keywords, 1 funder, 72 references.
Cite
This paper
Basava, K., Bendixen, T., Leonhard, A., George, N. L., Vanhersecke, Z., Omotosho, J., Mather, J., & Muthukrishna, M. (2026). Ecological not social factors explain brain size in cephalopods. iScience, 29(7), 116324. https://
BibTeX
@article{basava2026ecolo
author = {Basava, Kiran and Bendixen, Theiss and Leonhard, Alexander and George, Nicole Lauren and Vanhersecke, Zoé and Omotosho, Joshua and Mather, Jennifer and Muthukrishna, Michael},
title = {{Ecological not social factors explain brain size in cephalopods}},
journal = {iScience},
year = {2026},
month = jul,
volume = {29},
number = {7},
pages = {116324},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/
url = {https://
pmid = {42422194},
pmcid = {PMC13343137}
}
RIS
TY - JOUR
AU - Basava, Kiran
AU - Bendixen, Theiss
AU - Leonhard, Alexander
AU - George, Nicole Lauren
AU - Vanhersecke, Zoé
AU - Omotosho, Joshua
AU - Mather, Jennifer
AU - Muthukrishna, Michael
TI - Ecological not social factors explain brain size in cephalopods
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/
VL - 29
IS - 7
SP - 116324
SN - 2589-0042
PB - Elsevier
DO - 10.1016/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1016/
"type": "article-journal",
"title": "Ecological not social factors explain brain size in cephalopods",
"container-title": "iScience",
"author": [
{
"family": "Basava",
"given": "Kiran"
},
{
"family": "Bendixen",
"given": "Theiss"
},
{
"family": "Leonhard",
"given": "Alexander"
},
{
"family": "George",
"given": "Nicole Lauren"
},
{
"family": "Vanhersecke",
"given": "Zoé"
},
{
"family": "Omotosho",
"given": "Joshua"
},
{
"family": "Mather",
"given": "Jennifer"
},
{
"family": "Muthukrishna",
"given": "Michael"
}
],
"container-title-short":
"volume": "29",
"issue": "7",
"page": "116324",
"DOI": "10.1016/
"PMID": "42422194",
"PMCID": "PMC13343137",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
1
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1371/journal.pone.0270771 [code]
- Problems with using comparative analyses of avian brain size to test hypotheses of cognitive evolution.Journal: PloS oneIn common: ggplot2, tidyverse, other, 10 references
- [2] doi:10.1002/ece3.9273 [code]
- Using relative brain size as predictor variable: Serious pitfalls and solutions.Journal: Ecology and evolutionIn common: Stan, 9 references
- [3] doi:10.1098/rstb.2021.0296 [code]
- Socioecological complexity in primate groups and its cognitive correlates.Journal: Philosophical transactions of the Royal Society of London. Series B, Biological sciencesIn common: 10 references
- [4] doi:10.1038/s41562-024-01887-8 [code]
- Evolutionary-development
al (evo-devo) dynamics of hominin brain size. Journal: Nature human behaviourIn common: 9 references - [5] doi:10.1098/rstb.2024.0114 [code]
- Why did the human brain size evolve? A way forward.Journal: Philosophical transactions of the Royal Society of London. Series B, Biological sciencesIn common: 9 references
- [6] doi:10.1093/sysbio/syac075 [code]
- Both Diet and Sociality Affect Primate Brain-Size Evolution.Journal: Systematic biologyIn common: patchwork, ggplot2, tidyverse, 7 references
- [7] doi:10.1098/rstb.2020.0529 [code]
- The evolution of quantitative sensitivity.Journal: Philosophical transactions of the Royal Society of London. Series B, Biological sciencesIn common: Stan, ggplot2, tidyverse, 6 references
- [8] doi:10.1093/beheco/arae026 [code]
- Social complexity affects cognitive abilities but not brain structure in a Poeciliid fish.Journal: Behavioral ecology : official journal of the International Society for Behavioral EcologyIn common: ggplot2, tidyverse, 7 references
- [9] doi:10.1098/rsos.231541
- Short-term memory, attentional control and brain size in primates.Journal: Royal Society open scienceIn common: 8 references
- [10] doi:10.1098/rspb.2025.1169 [code]
- Social fish have larger brains and greater relative telencephalon sizes: support for the social brain hypothesis from wild, intraspecific comparisons.Journal: Proceedings. Biological sciencesIn common: other, 7 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 4 repositories of the authors' code, each at its verified commit and with its license, 8 scripts, and 13 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:50cd1a44795684b7…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1016/j.isci.2026.116324)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1016/j.isci.2026.116324.svg
:target: https://openscicode.org/badge/doi/10.1016/j.isci.2026.116324
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1016/j.isci.2026.116324"><img src="https://openscicode.org/badge/doi/10.1016/j.isci.2026.116324.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
