Most modern mammals, including strictly diurnal species, exhibit sensory adaptations to nocturnal activity that are thought to be the result of a prolonged nocturnal phase or ‘bottleneck’ during early mammalian evolution. Nocturnality may have allowed mammals to avoid antagonistic interactions with diurnal dinosaurs during the Mesozoic. However, understanding the evolution of mammalian activity patterns is hindered by scant and ambiguous fossil evidence. While ancestral reconstructions of behavioural traits from extant species have the potential to elucidate these patterns, existing studies have been limited in taxonomic scope. Here, we use an extensive behavioural dataset for 2,415 species from all extant orders to reconstruct ancestral activity patterns across Mammalia. We find strong support for the nocturnal origin of mammals and the Cenozoic appearance of diurnality, although cathemerality (mixed diel periodicity) may have appeared in the late Cretaceous. Simian primates are among the earliest mammals to exhibit strict diurnal activity, some 52–33 million years ago. Our study is consistent with the hypothesis that temporal partitioning between early mammals and dinosaurs during the Mesozoic led to a mammalian nocturnal bottleneck, but also demonstrates the need for improved phylogenetic estimates for Mammalia.
Species exhibit characteristic patterns of activity distribution over the 24 h (diel) cycle and, as environmental conditions may change radically yet predictably between day and night, activity patterns allow individuals to anticipate fluctuations and time activity optimally1,2. Physiological and behavioural adaptations to different activity patterns are important contributors to individual fitness3 and therefore to species evolutionary success4,5. Moreover, long-term shifts in activity patterns may reveal shifts in selectiveregimes caused by changes in biotic and abiotic conditions5,6,7. Although mammals exhibit striking morphological, behavioural and ecological niche diversity8, the distribution of mammalian activity patterns is strongly biased towards nocturnality9.Additionally, most mammalian species, including strictly diurnal ones, exhibit visual adaptations to nocturnal activity that are similar to those of nocturnal birds and reptiles10. For example, mammals (except Haplorrhine primates) lack a fovea—an area in the retina that enables very high visual acuity found in fish, reptiles and birds that are diurnal visual predators11. Most mammalian eyes have high ratios of corneal diameter to axial ocular length, which favour sensitivity to low light over visual acuity and are comparable to those found in nocturnal reptiles and birds10. Compared with all other vertebrates, mammals also exhibit reduced diversity of active photoreceptors for colour perception in bright environments12,13. Many day-active mammals (for example, ungulates and carnivores) have rod-dominated retinae; that is, they have eyes better suited for low-light conditions (night vision), although retinal rod-to-cone ratios show high interspecific variability14. There is also evidence that enhanced olfactory sensitivity15, broader frequency range hearing16 and sophisticated whisker-mediated tactile perception17 may have evolved in mammals to compensate for insufficient visual information10,13.
In his seminal work, Walls11 noted the differences between mammals and other (mostly diurnal) amniotes in eye shape, retinal composition and visual pathways. He proposed that the predominance of nocturnal adaptations in mammals may be the result of a prolonged nocturnal phase in the early stages of mammalian evolution, after which emerged the more diverse patterns observed today11,13. This ‘nocturnal bottleneck’ hypothesis suggests that mammals were restricted to nocturnal activity by antagonistic interactions with the ecologically dominant diurnal dinosaurs during the Mesozoic11,13,18.The Cretaceous–Palaeogene (K–Pg) mass extinction event circa 66 million years ago (Ma) led to the extinction of all non-avian dinosaurs along with the marine and flying reptiles and the majority of other vertebrate, invertebrate and plant taxa19,20. This event marks the end of the Mesozoic ‘reign of dinosaurs’ and the transition to the mammal-dominated Cenozoic fauna. If an antagonistic interaction with dinosaurs was an important factor in restricting early mammals to nocturnal activity, the vast majority of Mesozoic mammals—if not all of them—are expected to have been nocturnal, and diurnal mammals would have only appeared after the K–Pg mass extinction event.
Support for the nocturnal bottleneck hypothesis is drawn from anatomical and morphological studies10,11 and, increasingly, from molecular studies12,13, but remains indirect. For example, some Synapsids—the non-mammalian lineage ancestral to mammals—were adapted to nocturnal activity > 300 Ma, suggesting that nocturnality—a relatively rare state in amniotes—may have already characterized the Palaeozoic precursors of mammals21. However, inferring activity patterns from fossil morphology may be unreliable22,23, particularly as all modern mammals (except Haplorrhine primates) have nocturnal-type ocular and cranial morphologies (for example, high corneal diameter to axial length ratios and a large binocular visual field overlap) regardless of their activity pattern10,23. Evidence from histological and molecular studies of the evolutionary development of mammalian eyes indicates that nocturnal adaptations preceded diurnal ones12,24, but this does not help elucidate questions around the timing of these adaptations.
Ancestral reconstructions of behavioural traits using a phylogenetic comparative approach may help us to understand both the pattern and timing of the evolution of activity patterns in mammals, since activity patterns have been shown to be genetically determined25 yet responsive to selective pressures2. However, phylogenetic studies of mammalian activity patterns so far have mostly focused on two mammalian orders—primates26,27,28 and rodents29. Primate activity patterns have been studied extensively and some evidence suggests that primate diurnality originated in the most recent common ancestor (MRCA) of the suborder Haplorrhini(all monkeys, apes and tarsiers)5 in the Mesozoic30,31. It is conceivable, although thus far not tested, that diurnal diversifications in other orders of Mesozoic origin, for example, Scandentia (tree shrews), Macroscelidea (elephant shrews) and Rodentia, could have occurred before the extinction of dinosaurs, calling for a wider examination of how activity patterns evolved across mammals.
Here, we use an extensive dataset of activity patterns for 2,415 mammal species, representing 135 of the 148 extant families and all extant orders (Supplementary Table 1) to investigate ancestral activity patterns in mammals and to understand the timings of the appearance of mammal diurnality. We assign species to one of five activity patterns: (1) nocturnal—active only or mostly in the dark; (2) diurnal—active only or mostly during daylight hours; (3) cathemeral—active both during the day and during the night; (4) crepuscular—active only at twilight, around sunrise and/or sunset; and (5) ultradian—active in cycles of a few hours (see Methods). We map the three main activity patterns (nocturnal, cathemeral and diurnal) onto two phylogenetic frameworks representing two of the main hypotheses of mammalian evolutionary history for our analyses, termed here short fuse (SF), following ref. 31 updated by ref. 32, and long fuse (LF) (adapted from ref. 30) phylogenies (Fig. 1). We then use reversible-jump Markov chain Monte Carlo (rjMCMC) methods33 to estimate transition rates between different activity states and to infer the posterior probability (PP) of character states at each node in the phylogenies. This allows us to examine the evolution of activity patterns of mammals and to test the main predictions of the nocturnal bottleneck hypothesis: (1) the MRCA to all extant mammals was nocturnal and (2) mammal diurnality first emerged in the Cenozoic.
We found that the modal values of PPNoct (PP of nocturnality) at the ancestral node of extant mammals were 0.74 (95% credible interval (CrI): 0.71–0.76) and 0.59 (CrI: 0.54–0.64) for SF and LF phylogenies, respectively, offering support for a noctural ancestor (Fig. 2). In contrast, a cathemeral or diurnal ancestral state was much less well supported: modal values of PPCath (PP of cathemerality) were 0.24 (CrI: 0.23–0.26) and 0.31 (CrI: 0.29–0.33) for SF and LF, respectively, and for PPDiur (PP of diurnality) they were 0.02 (CrI: 0.01–0.03) for SF and 0.1 (CrI: 0.07–0.14) for LF (Fig. 2). The narrow and non-overlapping distributions of PP values across the activity pattern reconstructions indicate that our results are consistent and robust across samples of the rjMCMC chains, although the distributions were wider using the LF phylogeny (Fig. 2).
The first strong evidence (where the reconstructed activity pattern was supported by modal PP values > 0.67) in mammals of an expansion of temporal niche into cathemerality is in the early Palaeogene (Cenozoic) for the SF phylogeny (no later than 65.8 Ma) or in the Late Cretaceous (Mesozoic) for the LF phylogeny (no later than 74.7 Ma) (Figs. 3 and 4). Although the LF phylogeny supports a Mesozoic shift to cathemerality, the modal PP values of the remaining 41 Mesozoic nodes were either nocturnal (23 nodes) or unclear—where all three activity patterns were supported by modal PP values < 0.67 (18 nodes). Using the SF phylogeny, we reconstructed the first transition to cathemerality in the MRCA of the order Cetartiodactyla (cetaceans and even-toed ungulates). This taxon was likely to be cathemeral (PPCath = 0.79, CrI: 0.72–0.87) and almost certainly exhibited considerable daytime activity (PPNoct = 0.02, CrI: 0.01–0.04) (Fig. 3). Using the LF phylogeny, the first cathemeral transition was in the MRCA of the families Soricidae (shrews) and Talpidae (moles) (PPCath = 0.81, CrI: 0.61–0.91; PPDiur = 0.07, CrI: 0.03–0.15) (Fig. 4).
Evidence of the evolution of diurnality (modal PP values > 0.67) first appears in the early Palaeogene (no later than 52.4 Ma for the SF phylogeny or 63.8 Ma for the LF phylogeny) (Figs. 3 and 4). Using the SF phylogeny, we reconstructed the transition to diurnality in the MRCA of the Simiiformes (all monkeys and apes) (PPDiur = 0.76, CrI: 0.75–0.78; PPCath = 0.23, CrI: 0.22–0.25) (Fig. 3). Using the LF phylogeny, the first taxon to exhibit diurnal activity was the MRCA of the family Macroscelididae (elephant shrews) (PPDiur = 0.77, CrI: 0.76–0.80; PPCath = 0.22, CrI: 0.19–0.23; 63.8 Ma), followed by the MRCA of the families Ctenodactylidae (comb rats, Rodentia) (PPDiur = 0.76, CrI: 0.73–0.78; 61.6 Ma), Camelidae (Cetartiodactyla) (PPDiur = 0.74, CrI: 0.72–0.77; 59.6 Ma) and Tupaiidae (tree shrews, Scandentia) (PPDiur = 0.99, CrI: 0.99-0.99; 51.1 Ma), in rapid succession (Fig. 4).
For both SF and LF phylogenies, we found that transition rates from a cathemeral pattern to either noctural or diurnal were about three times higher than the transition rates from either nocturnal or diurnal to cathemeral (Table 1). Furthermore, the transition rates in the SF reconstruction were three orders of magnitude lower than the respective rates in the LF reconstruction.
We have shown that extant mammals probably originated from a nocturnal ancestor and that these ancestors remained nocturnal throughout the Mesozoic until either 9 million years before the K–Pg event (LF reconstruction) or just after it (SF reconstruction). On balance, our evidence suggests that mammals remained nocturnal throughout the Mesozoic, as nocturnal activity is strongly supported at most Mesozoic nodes in both SF and LF reconstructions. We found strong evidence that the shift to strict diurnality occurred after the K–Pg event (both SF and LF reconstructions), although cathemerality may have appeared in the Late Cretaceous (74.7 Ma in the LF reconstruction). Combined with other sources of evidence, such as the morphology of mammalian eyes10,23, the composition and reduced diversity of retinal photoreceptors12, 13,24,34 and the emphasis on alternative sensory systems11,15,16,17, our analysis helps to further establish the nocturnal ancestry of mammals and that diurnality only originated in mammals after the disapearance of the dinosaurs, as predicted by the nocturnal bottleneck hypothesis.
Even if we accept the appearance of cathemeral mammals as an expansion of the temporal niche before the K–Pg event, it does not necessarily provide strong evidence against the nocturnal bottleneck hypothesis. Declines in dinosaur diversity long before the K–Pg event have been suggested, either globally, starting at least 40 million years before the K–Pg event35, or locally—herbivorous dinosaurs in present-day North America were declining for up to 15 million years before the event20. In contrast, fossils show that mammals had evolved considerable eco-morphological diversity as early as the mid-Jurassic period (174–164 Ma) and diversified along all axes of the ecological niche36,37 except the temporal axis. Moreover, extensive mammal radiations occurred following the Cretaceous Terrestrial Revolution (120–80 Ma), whereby angiosperms rose to dominate the global flora and revolutionized eco-space30,38,39. Under such conditions, a partial invasion of mammals into the temporal niche of declining dinosaurs does not violate the assumption of temporal partitioning. Indeed, evidence of a shift in retinal opsin sensitivity (linked to more diurnal activity patterns) in some mammalian clades (cetartiodactyls, primates, carnivores and some Afrotheria orders) more than 70 Ma24,34 offers further support for a transition occurring during this period.
The MRCA of the infraorder Simiiformes (monkeys and apes) was among the first taxa to evolve diurnality (52.4 Ma in the SF reconstruction) and this is consistent with their evolution of diurnally adapted vision—specifically trichromacy and a low ratio of corneal diameter to axial length10,12,23, which is unique in mammals. Other diurnal clades, such as squirrels (Sciuridae) and elephant shrews (Macroscelididae), evolved at about the same time as the Simiiformes30,31 and presumably had similar opportunity to evolve comparable visual adaptations to diurnality. However, these groups rely on high ratios of retinal cones to rods for daylight vision14, suggesting that diurnality in Simiiformes may have evolved considerably earlier than the minimum date of 52.4 Ma. Simiiformes lie on an evolutionary branch that originated 83.2 Ma (SF), when they diverged from tarsiers—their closest living relatives in the suborder Haplorrhini. Tarsiers are strictly nocturnal, but share with the Simiiformes several adaptations for high visual acuity that are typical to diurnal vision28,40. The morphological and physiological adaptations to nocturnality in tarsiers are unlike those of any other nocturnal primate, suggesting that tarsiers originated from a diurnal ancestor—the MRCA of Haplorrhini—and secondarily adapted to nocturnal life5,6. The haplorrhine MRCA was a Mesozoic species that lived until 83.2 Ma (SF) or 78.1 Ma (LF). This would imply that Mesozoic mammals were able to break out of the nocturnal bottleneck and endure direct interactions with dinosaurs following the Cretaceous Terrestrial Revolution. Nevertheless, both reconstructions here, as well as other reconstructions of primate activity patterns based on different sets of data, including data on visual physiology, find weak or no evidence of the diurnality of the haplorrhine MRCA26,27,28.
There are other uncertainties around the dates for three of the four taxa identified as shifting to diurnality within 7 million years of the K–Pg in the LF reconstruction (Macroscelididae, Ctenodactylidae and Camelidae). This is due to how we re-scaled the terminal branches from ref. 30 to produce the species-level LF phylogeny. However, according to the dates given in ref. 30 and additional studies supporting the LF hypothesis41,42,43,44, these families originated in the Cenozoic, so our prediction of Cenozoic origins to mammal diurnality remains intact. The MRCA of Tupaiidae (Scandentia) and their closest living relative—the nocturnal Ptilocercidae (pen-tailed tree shrews, a monotypic family)—has been placed in the Cenozoic, 60.1 Ma (ref. 30). The LF reconstruction shows that this species was probably diurnal or cathemeral, but neither pattern was supported by PP values > 0.67.
On both SF and LF reconstructions, the rates of transition from cathemeral activity to either nocturnal or diurnal imply that the diurnal and nocturnal niches may be more favourable for mammals. However, our results unequivocally support the persistence of cathemerality in mammals since the K–Pg. In primates, it has been argued that cathemerality is adaptive under fluctuating environmental conditions26,45 and cathemeral species show higher speciation rates (although lower overall diversification rates) compared with nocturnal and diurnal species27. If these patterns are also true for the rest of Mammalia, they could explain the persistence of mammal cathemerality against the net outflow of species and slow diversification rates. In Lepidoptera (moths and butterflies), it has been argued that the persistence of a mixed (cathemeral) diel activity pattern is the result of conflicting predation pressures (from bats during the night and birds during the day)46. Hence, cathemeral activity may be preferred when strong selective forces are acting in opposite directions. The appearance of mammal cathemerality may have been due to high nocturnal predation risk on one side (perhaps from other mammals, making the nocturnal niche less advantageous) and the difficulties of adapting to a diurnal niche on the other.
The higher transition rates for the LF tree are probably a result of the method we used to construct the species-level LF phylogeny; that is, re-scaling the branch lengths of species-level clades from the SF phylogeny31 to maintain the length of the corresponding terminal branch provided by ref. 30. SF branch lengths were usually scaled down in this process because the SF generally estimates older divergence dates than the LF, reflecting the difference between the two phylogenetic models. A consequence of our grafting procedure is that a band of artificially short branches is formed near these graft points, which implies rapid change. Higher rates allow for more change along tree branches and reduce the precision of the results, which probably contributed to our LF reconstruction yielding fewer decisive predictions and lower statistical support compared with the SF reconstruction (Figs. 2–4). While a direct comparison of transition rates between the two phylogenetic hypotheses is therefore precluded, the broad pattern of transitions (that is, low transition rates into cathemerality and high transition rates out of it in either direction) is supported in both analyses, as is the general pattern of temporal niche evolution that emerges from the node reconstructions.
Although we have demonstrated the importance of the phylogenetic comparative approach to the investigation of the evolution of behavioural traits in mammals, ancestral reconstruction methods rely heavily on the accuracy of phylogenetic estimates. The LF hypothesis of mammalian evolutionary history is well supported30,41,44, but phylogenetic estimates are only available at the family level and further modification was required to add the species-level information for our analysis. Despite the attention attracted recently by studies of mammalian phylogenies30,41,44,47, only the SF hypothesis is represented by a species-level phylogeny, making the incorporation of the LF hypothesis and the explosive model problematic for phylogenetic comparative analyses that are based on detailed species-level data.
In conclusion, we argue that the activity patterns of Mesozoic mammals are consistent with the prediction of temporal partitioning and that the gradual acquisition of daytime activity in mammals (first cathemerality then diurnality) coincided with the decrease in pressure from dinosaurs, whether due to their decline or extinction. Given the current evidence, temporal partitioning within Mesozoic amniotes mostly followed the phylogenetic (mammal–archosaur) division, but while some dinosaurs invaded the nocturnal niche22, we find little support for Mesozoic mammals invading the diurnal niche. The constraints on mammals becoming diurnal during the Mesozoic would have been strong enough to counteract the ecological pressure to diversify, following at least 100 million years of mammalian sensory and eco-morphological radiations that sub-divided their nocturnal niches. Mammals diversified rapidly once they expanded outside the nocturnal niche, but whether invading the diurnal niche facilitated mammals’ Cenozoic success remains to be answered.
We collated activity records for 2,415 mammalian species, representing all 29 extant orders and 135 of 148 extant families from the PanTHERIA database8, as well as from published sources such as research articles, field guides and encyclopaedias (Supplementary Table 1). To achieve maximal representation of taxonomic diversity, we specifically targeted under-represented orders and repeated the process for under-represented families. Nonetheless, any records we found in this process were incorporated into our dataset, whether of a target taxon or not, unless a similar record (same species and activity pattern) was previously obtained. Although activity pattern data were only available for just under half (44.6%) of all known species48, 91.2% of families were represented in the database. The most under-represented taxa were the largest orders (Rodentia: 59% missing species; Chiroptera: 74%; Soricomorpha: 82%). Bats are almost entirely nocturnal and Soricomorpha is predominantly cathemeral (except the nocturnal Erinaceomorpha). In rodents too, activity patterns closely follow phylogeny29. Therefore, the inclusion of the missing species would probably have had only a minor effect, if any, on the character transition rate matrix and the overall reconstruction results.
We assigned each species to one of five activity patterns: (1) nocturnal—active only or mostly in the dark; (2) diurnal—active only or mostly during daylight hours; (3) cathemeral—active both during the day and during the night; (4) crepuscular—active only at twilight, around sunrise and/or sunset; and (5) ultradian—active in cycles of a few hours. We considered species nocturnal or diurnal based on qualitative descriptions in sources, as precise quantitative measurements are rare, where species described as ‘nocturnal’ or ‘active at night’ were assigned to nocturnal and species described as ‘diurnal’ or ‘active during daylight’ were assigned to diurnal. We also assigned species to these two categories if those descriptions were preceded by ‘only’, ‘exclusively’, ‘strictly’, ‘mostly’, ‘predominantly’, 'almost exclusively’ or ‘mainly'. Species that were described as ‘nocturnal and diurnal’, ‘active day and night’, ‘active at all hours’, ‘arrhythmic’ or ‘nocturnal in summer and diurnal in winter’ were assigned as having a cathemeral activity pattern. Crepuscular activity was assigned to species described as ‘mostly or mainly or predominantly crepuscular’, ‘active at dusk’, ‘active at dusk and dawn’, ‘around sunrise and sunset’ or ‘activity peaks in late afternoon or early evening’. Ultradian patterns were assigned when species were described as ‘ultradian’ or the source described several rhythmic cycles of activity and rest over a 24 h period. We follow the taxonomy and species binomials in Mammal Species of the World 3rd Edn.48, with one exception: we used Cetartiodactyla instead of the separate orders Artiodactyla and Cetacea, following refs 49,50. We resolved conflicts where sources disagreed on the species activity pattern as follows: (1) records of crepuscular activity (dusk or dawn), when in conjunction with nocturnal or diurnal activity, were changed to nocturnal or diurnal, respectively; (2) records from compiled sources were preferred over localized studies (which are prone to idiosyncrasies); and (3) records from more recent sources were preferred. This left 29 species unresolved and these species were excluded from subsequent analyses, giving a total of 2,386 species (1,426 nocturnal, 615 diurnal, 322 cathemeral, 22 crepuscular and 1 ultradian species).
We used two phylogenetic frameworks representing two of the main hypotheses of mammalian evolutionary history for our analyses: the SF hypothesis is represented by the species-level 'best dates' supertree31 updated from ref. 32 and the LF hypothesis is represented by the amino acid supermatrix phylogeny30 (Fig. 1). The SF hypothesis asserts that the MRCA of all extant mammals diverged into its daughter lineages (Prototheria and Theria) in the mid-Jurassic 166.2 Ma, whereas according to the LF hypothesis this divergence took place in the Late-Triassic 217.8 Ma. Both hypotheses agree that multiple extant lineages diverged in the Cretaceous and survived the K–Pg event (Fig. 1), but the SF hypothesis posits that intra-ordinal divergence of placental mammals had already begun before the K–Pg event, while the LF hypothesis places intra-ordinal divergence in the Cenozoic. A third evolutionary hypothesis—the explosive model—is supported by fossil evidence and morphological data47, but has been criticized for implying impossibly high rates of evolution in the early-Cenozoic radiation of placental mammals, as well as other problems41,51, so we do not consider it here.
Here, we represent the LF hypothesis using the family-level supermatrix phylogeny30 (downloaded from TreeBASE: http://purl.org/phylo/treebase/phylows/study/TB2:S11872 on 1 March 2015). For our analyses, we rendered it ultrametric; that is, all the tips (species) of the tree are equidistant from the root, so that branch lengths are proportional to time. The LF hypothesis has recently gained support from several studies41,42,43,44, but it lacks species-level resolution, which is essential for our analysis. We therefore used each terminal branch of the supermatrix phylogeny (representing a taxonomic family) as a root branch onto which we appended the internal branching pattern of the family, as given in ref. 31 updated from ref. 32. To retain the original LF timeline, we scaled the appended branching pattern to 85% of its original supermatrix phylogeny branch length, and the root branch completed the remaining 15%. Other proportions (for example 70:30 or 50:50 branch scaling) would have compressed intra-family branching patterns, resulting in branch lengths that were very different from their original values. For this process, we used functions from the packages ape52 and phangorn53 in R version 3.2.3 (ref. 54). Species that we had data for but that were absent from the phylogenetic frameworks were omitted from the analyses: 33 species from the SF phylogeny and an additional 38 species and 3 families from the LF phylogeny, as families Aotidae, Pitheciidae and Lepilemuridae (Primates) were not originally included in the supermatrix phylogeny30. It is unlikely that the omission of these three families would have had an impact on our analysis as Pitheciidae and Lepilrmuridae are entirely diurnal and nocturnal, respectively, and conform to the activity pattern of the respective clades within which they are nested. Aotidae, on the other hand, is nocturnal. While this could potentially have altered the ancestral reconstruction results, Aotidae is nested within the otherwise exclusively diurnal Platyrrhini (new world monkeys)27, so its effect on the LF reconstruction would be minimal beyond the node immediately ancestral to Aotidae.
We used BayesTraits version 3 (ref. 33) to reconstruct the evolution of mammalian activity patterns. BayesTraits implements MCMC methods to sample from the posterior distributions of transition rates for a transition matrix describing the evolution of a discrete character. The obtained posterior distribution allows the user to infer the PP of each character state at the root and at each internal node of the phylogeny. By employing rjMCMC, BayesTraits is also able to sample from the posterior distribution of model configurations and optimize the number of parameters in the model. This removes the need for comparing models with different numbers of parameters by sampling from model space and parameter space concurrently55.
We only considered the three main activity patterns across mammals in our analysis (nocturnal, diurnal and cathemeral) in order to reduce the complexity of the model and increase its biological interpretability (four transition rates instead of 16). Additionally, we removed ultradian activity patterns as these are mostly found in polar and subterranean species, where the 24 h cycle is of reduced importance. This meant that the total number species used was 2,330 from 135 families (nocturnal: 1,399; diurnal: 610; cathemeral: 321) for the SF analysis, and 2,292 species from 132 families (nocturnal species: 1,384; diurnal: 588; cathemeral: 320) for the LF analysis. We use an ordered model of trait evolution: nocturnal ↔ cathemeral ↔ diurnal, whereby direct nocturnal ↔ diurnal transitions are not allowed (set to zero). A transition from diurnal to nocturnal (or vice versa) would therefore involve at least two ‘steps’, passing through cathemeral, although both steps may occur along the same branch. This ordered model reflects the continuous and mutually exclusive nature of morphological and histological adaptations to diurnality and nocturnality (for example, the retinal-rod-to-cone ratio, corneal-diameter-to-axial-length ratio and front-facing versus lateral-facing eye sockets), while cathemerality involves an intermediate state of the relevant phenotypes23,56. Our underlying hypothesis is that during shifts from diurnality to nocturnality (and vice versa) species go through a phase of cathemeral capability during which they are equally well adapted to both. All other transition rates were free to take any value. We used rjMCMC to estimate the optimal model configuration55. As activity pattern in our analyses was not a binary trait, we used the ‘multistate’ mode of BayesTraits to sample from the posterior distribution of transition rates between activity pattern categories. For each phylogeny, we opted for the rjMCMC procedure and set a wide uniform prior bounded between 0 and 100 for all transition rates to ensure that our prior did not have a strong effect on the nature of the posterior. Each rjMCMC chain was run until convergence was reached (at least one million iterations), after which the chains were sampled every 4,000 iterations until a posterior of 1,000 samples was obtained. We chose this wide sampling interval to minimize autocorrelation in our posterior samples. We ran 12 replicates of each chain (corresponding to a phylogeny) to ensure consistency and that each independent run converged on the same posterior distribution. The marginal likelihoods of each chain were calculated using the stepping stone sampler57 as implemented in BayesTraits (500 stones, 1,000 iterations per stone) and compared between independent replicates to ensure consistency.
To estimate the character state at each internal node, we used the modal value of the PP of each character state, calculated as the peak value of the kernel density of each posterior distribution. For each PP distribution, we reported the 95% CrI—the highest density interval covering 95% of the posterior distribution. We used the R package phytools58 to plot the PP values of each node on the mammal phylogenies (Figs. 3 and 4). To measure the accumulation of mammalian temporal niches over time, we calculated the running total of nodes (lineages) where an activity pattern was supported with PP > 0.67, and plotted this along the mammal evolution timeline (Figs. 3 and 4). A confidence threshold of 0.67 meant that the PP values of the best-supported state were at least 0.34 higher (or twice as likely) than the second most probable state. The PP distributions of either state would have to be extremely flat to make the difference between two peak values smaller than two standard deviations. The threshold of 0.67 thus ensures small to no overlap between two distributions.
Estimates of character transition rates and reconstructions of ancestral states can be inaccurate if certain character states lead to very different diversification rates59, and methods such as BayesTraits do not account for the effects of character states on diversification rates. We reanalysed our data to investigate the robustness of our analysis with an additional method, multistate speciation and extinction (MuSSE60), to control for differences in diversification rates. However, this method requires fully bifurcating phylogenetic trees or, if polytomies are present, that all branches in the phylogenies descending from them are collapsed60. To enable a MuSSE reconstruction, we used maximum clade credibility, implemented in the R package phangorn53, to summarize a single, fully bifurcating tree from a distribution of 100 fully bifurcating trees61 randomly derived from the SF phylogeny used in the BayesTraits analysis. We could only perform this analysis on the SF phylogeny as the mosaic nature of the LF phylogeny meant that the resulting tree from random resolution was very similar to the SF tree. We acknowledge that random resolution of polytomies may result in unlikely topologies and incorrect branch lengths, but that is a pragmatic solution to the incompleteness of mammalian phylogenetic information available. As the results of the MuSSE reconstruction were very similar to those obtained by the BayesTraits analysis and did not change our overall conclusions (Supplementary Fig. 1 and Supplementary Table 2), our results are likely robust to the differential diversification rates in activity patterns.
Life Sciences Reporting Summary
Further information on experimental design and reagents is available in the Life Sciences Reporting Summary.
Computer code essential for replicating the results in this study is available on Figshare (doi: 10.6084/m9.figshare.4797367).
The authors declare that all data supporting the findings of this study are available within the paper and its Supplementary Information files. All data are available on Figshare (doi: 10.6084/m9.figshare.4775416; doi: 10.6084/m9.figshare.4774648).
Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
We thank T. C. D. Lucas, S. Meiri, E. E. Dyer, O. Comay and I. Pizer-Mason for technical assistance and providing data, and N. Kronfeld-Schor for discussion. This work was funded with support from Israel Science Foundation grant 785/09 (to T.D.), the Tel Aviv University Global Research and Training Fellowship fund and Naomi Kadar Foundation (to R.M.), and a NERC Open CASE PhD studentship (NE/H018565/1) (to H.F.-G.).