Ecological and social pressures interfere with homeostatic sleep regulation in the wild

Sleep is fundamental to the health and fitness of all animals. The physiological importance of sleep is underscored by the central role of homeostasis in determining sleep investment – following periods of sleep deprivation, individuals experience longer and more intense sleep bouts. Yet, most sleep research has been conducted in highly controlled settings, removed from evolutionarily relevant contexts that may hinder the maintenance of sleep homeostasis. Using triaxial accelerometry and GPS to track the sleep patterns of a group of wild baboons (Papio anubis), we found that ecological and social pressures indeed interfere with homeostatic sleep regulation. Baboons sacrificed time spent sleeping when in less familiar locations and when sleeping in proximity to more group-mates, regardless of how long they had slept the prior night or how much they had physically exerted themselves the preceding day. Further, they did not appear to compensate for lost sleep via more intense sleep bouts. We found that the collective dynamics characteristic of social animal groups persist into the sleep period, as baboons exhibited synchronized patterns of waking throughout the night, particularly with nearby group-mates. Thus, for animals whose fitness depends critically on avoiding predation and developing social relationships, maintaining sleep homeostasis may be only secondary to remaining vigilant when sleeping in risky habitats and interacting with group-mates during the night. Our results highlight the importance of studying sleep in ecologically relevant contexts, where the adaptive function of sleep patterns directly reflects the complex trade-offs that have guided its evolution.


Introduction 75
Sleep is an important and understudied facet of animal lives, with every species, from honey 76 bees to humans, allocating a portion of every day to this period of rest (Cirelli & Tononi, 2008). The 77 universality of sleep reflects its central role in important physiological processes, including memory 78 consolidation, support of the central nervous system, energy conservation and physical restoration 79 (Chowdhury & Shafer, 2020;Gangwisch, 2014;Stickgold, 2005 (Siegel, 2008). 87 A strong focus on studying sleep in the laboratory or at the bedside, although revealing much 88 about the physiology of sleep, has inherently overlooked the ecological pressures that drive the 89 regulation and evolution of sleep (Rattenborg et al., 2017;Reinhardt, 2020). In the natural world, the 90 significance of sleep extends beyond its direct physiological impacts. Sleeping animals typically 91 cannot engage in other behaviors that are important to their survival (but see Rattenborg et al., 2016), 92 average, 15 minutes less than adults (LMM: juveniles: -0.32 [-1.12, 0.50]; subadults: -0.32 [-0.80, 166 0.14]). 167 The maintenance of homeostasis was not a strong driver of sleep patterns (Fig. 2). After 168 sleeping poorly (low total sleep time), baboons did not 'catch up' by napping more on the following 169 day (Table S6;  group members slept at the same site, distributed across ten adjacent yellow fever (Acacia 184 xanthophloea) trees (Fig. 3A). Individuals showed high fidelity to particular sleep trees ( Fig. S3; one-185 tailed two-sample Kolmogorov-Smirnov test: p < 1.0 x 10 -9 ), returning each night to one or a small set 186 of the available trees populated by the group. Not only did the choice of tree itself influence sleep 187 duration (Table S3 - This decrease in total sleep time following the change in sites was limited to the first night in the new 197 sleep site, after which sleep durations returned to normal ( Fig. 3D; Fig. S7). 198 [ Figure 3] 199 Sleeping in a social context also impacted sleep duration, as group-mates disrupted each 200 other's rest during the night. Contrary to predictions of the sentinel hypothesis, the proportion of the 201 night in which at least one individual was awake was significantly less than expected by chance (Fig. 202 4A; Fisher's exact test: p < 0.0001), suggesting that, rather than staggering periods of nocturnal 203 wakefulness, group-mates were actually synchronized in their sleep-wake patterns throughout the 204 night. Confirming this synchronization, we found that a significantly greater proportion of the group 205 exhibited the same simultaneous behavior, either being asleep or awake, than expected ( Fig. 4B; 206 Fisher's exact test: p < 0.0001). Group members showed a unique pattern of synchronized sleep and 207 wake bouts each night, and thus, synchronization was not a spurious result of a stereotyped schedule 208 of activity that happened to be consistent across baboons and across nights ( However, sleep studies have traditionally investigated sleep in highly controlled environments, where 237 the costs of investing in sleep are largely absent. Our findings suggest that, in the natural world, 238 "sleep need" may be a relatively flexible concept, with variation in sleep investment driven as much 239 by the opportunity costs of sleep as by its physiological benefits. 240 There are substantial opportunity costs of devoting a significant portion of every day to 241 sleeping. Sleeping animals are highly vulnerable to predation (Lima et al., 2005), and our results 242 suggest that individuals sleep less when the risk of predation is particularly high. Baboon group 243 members showed high fidelity to particular locations within their main sleep site, and individuals 244 sacrificed sleep both when sleeping in trees to which they did not show high fidelity as well as upon 245 moving to a new, less familiar sleep site following a leopard attack. Given that predation risk tends to 246 be greater in unfamiliar locations (Forrester et (Dunbar, 1992), they may actively sacrifice sleep in order to invest in these relationships at night. 304 Alternatively, social animals may wake in response to the periodic waking and repositioning of their 305 group-mates during the night, and thus, socially-disrupted sleep may be an inherent by-product of 306 sleeping in a group. Simply remaining in a cohesive group may therefore present a challenge to 307 obtaining sufficient sleep. 308 Social animals may jeopardize sleep homeostasis to maintain cohesion with their conspecifics 309 because remaining in close proximity to their group-mates during the sleep period could prove 310 essential to their fitness. Individuals likely benefit from the dilution of predation risk that is achieved 311 through group cohesion, particularly when they are sleeping and thus highly vulnerable to predators 312 (Lehtonen & Jaatinen, 2016). Collective vigilance may also reduce the risk of predation for group 313 members. Even in the absence of collective vigilance optimization via non-randomly staggered 314 wakefulness, the proportion of the night with at least one group member awake is still likely to be 315 substantially greater than any particular individual's investment in vigilance. In our study, at least one 316 individual in the group was awake for 394 ± 11 minutes (82% ± 2%) from 21:00 to 05:00, although 317 each individual was only awake for 79 ± 1 minutes (16% ± 0.2%) of the same period. Samson and 318 colleagues (2017) found high levels of collective vigilance during the night in a group of Hadza 319 hunter-gatherers, and they suggest that this collective vigilance may facilitate higher intensity sleep 320 (Samson & Nunn, 2015). Because accelerometry cannot measure sleep intensity, we were unable to 321 test whether collective vigilance allowed individuals sleeping close to group-mates to experience 322 more intense, albeit shorter, sleep. Future studies leveraging advances in polysomnography (i.e. EEG) 323 that may eventually allow its application in wild social animals could enable a test of this possibility. 324 Unexpectedly, we found that adult baboons slept longer than subadults and juveniles, and 325 males slept longer than females. This contrasts with previous research that found age differences in relationships to obtain resources that they would not be able to access based on social rank alone (Sick 346 et al., 2014). Further research is needed to investigate the extent to which these complex social 347 dynamics influence an individual's ability to obtain a preferred sleep location and, thus, a good 348 night's sleep. 349 In addition to highlighting social dynamics as a key driver of sleep patterns in group-living 350 species, our study provides important insights into selective pressures that may have shaped the 351 evolution of human sleep. The physiological requirements for sleep and the homeostatic mechanisms 352 that ensure this requirement is fulfilled have long been assumed to be the key drivers influencing the 353 way that our sleep has evolved and the characteristics of our sleep today. However, we suggest that we noted the age class and sex of each baboon, as well as whether the baboon was lactating. We fit 383 each individual with a GPS and accelerometry collar that recorded the baboon's GPS location at 1 Hz 384 sampling interval and continuous tri-axial accelerations at 12 Hz/axis from 06:00 to18:00. From 18:00 385 to 06:00, the collars recorded a 2.5-second burst of accelerations at 10 Hz/axis at the beginning of 386 every minute. The collars were programmed to collect data from August 1, 2012 to September 6, 387 2012, but due to a programming glitch, several collars stopped collecting data prematurely (Table S1). 388 In total, we collected 483 days of GPS data, and 506 nights of accelerometry data. We also collected 389 high-resolution drone imagery of the group's most commonly used sleep site (see Strandburg-Peshkin 390 et al., 2017 for details). 391

Sleep Analysis 392
We used the accelerometry data to classify sleep behavior by adapting a method presented in 393 van Hees et al. 2018 that was developed for extracting metrics of sleep in humans from wearable 394 accelerometry devices. The process of determining the sleep period, defined as the period from sleep 395 onset to waking, is summarized in Fig. 5. 396 To uniformize the accelerometry sampling schedule, we down-sampled and interpolated the 397 daytime accelerometry data such that it matched the 10 Hz bursts of accelerometry collected during 398 the night. We calculated the vectorial dynamic body acceleration (VeDBA) using a 0.7-second time-399 window and generated the log of the average VeDBA for the 2.5-second burst each minute. We then 400 calculated a rolling median of the log VeDBA with a 9-minute window. Following van Hees et al. times were reliably within the waking period (Fig. 1C), and using standardized times prevented a 420 spurious negative correlation between time spent sleeping during the waking period and total sleep 421 time during the sleep period that would result from the waking period prior to or following short sleep 422 periods having a greater number of potential epochs that could be considered sleep. 423 The accelerometer units occasionally failed to collect data according to their programmed 424 sampling schedule. Because insufficient data in a given day would prevent a reliable calculation of the 425 threshold value for the sleep classification and produce variability in the number of potential sleep 426 epochs, we did not include data for total sleep time, sleep onset time, waking time, or napping time 427 (both on the prior day and following day) from noon-to-noon periods missing at least 120 (8.3%) 428 accelerometry bursts, which decreased the number of baboon-nights from 491 to 368. We further 429 removed data for total sleep time, onset time, and waking time from noon-to-noon periods missing at 430 least 20 consecutive accelerometry bursts, as the determination of the sleep period is sensitive to gaps 431 between consecutive accelerometry bursts, resulting in a final number of 354 sleep periods analyzed. 432 We did not remove data for napping time on these days because measuring napping time did not 433 depend on the determination of the sleep period. 434

Validation of sleep classification algorithm 435
The algorithm from which the sleep classification technique is adapted is well-validated using  (Table S12; see Supplemental Information for further details of validation study). 449

Physical activity 450
Using the GPS data, we calculated each individual's daily travel distance. To avoid 451 accumulation of GPS positional error overestimating the actual daily travel distance, we calculated 452 daily travel distance only after discretizing the GPS data to 5-meter resolution (Strandburg-Peshkin et 453 al., 2017). We removed travel distance data on days on which a baboon's GPS collar first began 454 taking fixes later than 07:30 or took its last fix before 17:00. Between these times, the group was often 455 on the move, and thus delayed onset and premature offset of GPS devices that infringed upon this 456 period would likely underestimate travel distances. We further removed one individual's data from 457 the first half of the study due to a temporary collar malorientation that resulted in exaggerated GPS 458 error. 459 We also calculated cumulative activity during the day from the accelerometry data. Using the 460 continuous 12 Hz accelerometry data, we calculated VeDBA from 06:00 to 18:00 using a 0.5 second 461 time window, averaged VeDBA over each minute, and then summed these values to generate a 462 cumulative measure of activity during the day. As determining fidelity requires several nights of data, we did not include entropy values, either 497 empirical or permuted, from individuals with less than four nights of data. We also limited this 498 analysis of tree fidelity to the first 15 days of data, as the number of individuals on which we have 499 data decreases sharply after this day (Table S1), which decreases the possible permutations. 500 After determining that individuals showed non-random sleep tree selection (see Results), we 501 then calculated an individual-specific fidelity index for each tree. This fidelity index was measured as 502 the average number of nights an individual slept in a particular tree in the 1000 permutations 503 subtracted from the number of nights the individual actually slept in that particular tree. Again, we did 504 not calculate fidelity indices for individuals with less than four nights of data. 505 Pattern of sleep-wake behavior across the group 506 We tested whether individuals staggered their periods of nocturnal wakefulness or, 507 conversely, synchronized them beyond the level expected by chance. For this analysis, we subset the 508 data to times between 21:00 and 05:00, as these times consistently fell within the bounds of the sleep 509 period of all individuals. We calculated the proportion of minute epochs across all nights in which at 510 least one group member was awake and the proportion of the group that was synchronized in their 511 behavior (either sleep or wakefulness) during each minute epoch, averaging across all epochs. We 512 then calculated these same proportions, but after applying a random time shift to each individual's 513 time series of sleep-wake epochs on each night (Fig. S9). We repeated this procedure 1000 times to 514 develop a null distribution of the proportion of epochs during the night in which at least one 515 individual is awake and a null distribution of the average proportion of the group that was 516 synchronized, and we compared the empirical proportions to their respective null distributions 517 statistically with a Fisher's exact test. The p-value thus represents the proportion of time-shifted 518 values that were as extreme or more extreme than the empirical value. Shifting the data in time rather 519 than permuting it allowed us to develop null distributions while maintaining the autocorrelation 520 structure of the data. 521 To confirm the robustness of our findings, we again tested for collective vigilance and 522 synchronization, comparing the empirical values defined above to null distributions produced using an 523 alternative method. In this method, rather than applying a random time shift to each night of each 524 individual's data, we maintained the real time associated with the time series data, but we permuted 525 the night associated with each time series (Fig. S10). We compared empirical values to the null 526 distributions created by these night permutations with a Fisher's exact test. of study nights, during which the group slept in its main sleep site. Aside from this categorical night 565 variable, we also included age, sex, distance traveled in the preceding day, napping time during the 566 preceding day, relative time spent sleeping the previous night, the phase of the moon, and minimum 567 ambient temperature as fixed effects in the models with random intercepts for individual identity. In 568 these models, we did not include sleep tree identity, number of individuals in the sleep tree, and sleep 569 tree fidelity score, as the entire group slept in a single tree in the less commonly used sleep site. 570 We further tested for the effect of prior sleep debt on sleep behavior by modeling the effect of 571 total sleep time on time spent napping the following day. We modeled this relationship with a 572 Bayesian LMM, using individual identity and day as random intercepts. We also assessed how the 573 likelihood of sleep progressed through the night. We used a generalized additive mixed model 574 (GAMM) to model the log-odds of a baboon being asleep in a given epoch as a function of the 575 duration of that epoch from the beginning of the sleep period, scaled such that 0 represents the 576 beginning of the sleep period and 1 represents the end of the sleep period. We included individual 577 identity and night as random intercepts, and to account for autocorrelation in the response variable, we 578 also included an AR1 term in the model. 579 Lastly, we tested whether individuals showed higher synchronization of their sleep-wake 580 patterns when sharing the same sleep tree than when inhabiting different trees. With a Bayesian 581 LMM, we modeled the synchronization score between dyads on each night, calculated as the number 582 of minutes from 21:00 to 05:00 in which members of the dyad exhibited the same behavior divided by 583 the total number minutes in which both individuals had data. We included a binary predictor variable 584 indicating whether dyad members were in the same tree as the only fixed effect variable, and night, 585 the identity of both individuals in the dyad, as well as the identity of the dyad as random intercept 586 variables. 587 We carried out all Bayesian analyses with the "brms" package in R (Bürkner, 2017). We to which all authors contributed. 620

Competing interests 621
The authors declare no competing interests.   Figure S3. Comparison of the Shannon entropies of individuals' sleep tree occupancy within this 1019 sleep site to a null distribution produced by 1000 identity permutations. The analysis revealed lower 1020 entropy in tree occupancy than expected by random chance (one-tailed two-sample Kolmogorov-1021 Smirnov test: p < 1.0 x 10 -9 ), indicating that individuals exhibited high fidelity to particular trees.   Figure S9. A toy example of the procedure we used to test for sentinel behavior and synchronization 83 of nighttime behavior. Each row represents a baboon's time-series of sleep and wake activity during 84 the night, with black vertical lines indicating periods of nocturnal waking behavior. Colors correspond 85 to different nights, and the transparency of the color indicates the timing of night, with reference to 86 the empirical, unshifted data. The time shifting procedure was repeated 1000 times to generate a null 87 distribution for the proportion of minutes in which at least one individual is awake during the night 88 and the mean proportion of the group exhibiting synchronized behavior. 89