Deciding Where to Sleep: Spatial Levels of Nesting Selection in Chimpanzees (Pan troglodytes) Living in Savanna at Issa, Tanzania

To understand how animals select resources we need to analyze selection at different spatial levels or scales in the habitat. We investigated which physical characteristics of trees (dimensions and structure, e.g., height, trunk diameter, number of branches) determined nesting selection by chimpanzees (Pan troglodytes) on two different spatial scales: individual nesting trees and nesting sites. We also examined whether individual tree selection explained the landscape pattern of nesting site selection. We compared the physical characteristics of actual (N = 132) and potential (N = 242) nesting trees in nesting sites (in 15 plots of 25 m × 25 m) and of all trees in actual and potential nesting sites (N = 763 in 30 plots of 25 m × 25 m). We collected data in May and June 2003 in Issa, a dry and open savanna habitat in Tanzania. Chimpanzees selected both the site they used for nesting in the landscape and the trees they used to build nests within a nesting site, demonstrating two levels of spatial selection in nesting. Site selection was stronger than individual tree selection. Tree height was the most important variable for both nesting site and tree selection in our study, suggesting that chimpanzees selected both safe sites and secure trees for sleeping.


Introduction
Sleep is one of the vital behaviors in animals and the one that involves the highest risk of predation, making the decision of where to sleep essential for survival (Fruth et al. 2018;Lima et al. 2005;Mainwaring et al. 2014;Reinhardt 2020). Primates show a great diversity of sleeping places. Strepsirrhines use tree branches, tree holes, tangles of vegetation, and nests constructed by other species or by themselves (Eppley et al. 2016;Gursky 2002;Kappeler 1998;Terrien et al. 2011). Old World and New World monkeys use tree branches, tree holes, tree forks, vegetation-covered tree trunks, dense tangles of vegetation, cliff ledges, or caves (Anderson 1984;Hamilton 1982). Small apes use bare tree branches and parasitic plants on branches to sleep (Fan and Jiang 2008). Great apes build beds, or complex structures of vegetation (called nests) for sleeping, mostly in trees, but chimpanzees (Pan troglodytes) and gorillas (Gorilla gorilla) also build terrestrial nests and gorillas can sleep on the bare ground (Fruth and Hohmann 1996;Fruth et al. 2018).
The most important function of a primate sleeping place is thought to be its safety from potential predators (Anderson 1984(Anderson , 1998. Primates select sleeping places that help to decrease predation risk, such as high trees, trees with dense foliage, steep cliffs, concealed nests, inaccessible trees, or tree holes (Anderson 1984(Anderson , 1998Brividoro et al. 2019;Fruth et al. 2018;Hamilton 1982;Kappeler 1998;Phoonjampa et al. 2010). For example, golden-brown mouse lemurs (Microcebus ravelobensis) construct leaf nests more often during infant rearing when predator risk is higher than at other times (Thoren et al. 2010). Baboons (Papio spp.) have an order of preference for different sleeping place types, presumably to avoid predation (Hamilton 1982), intensely reusing particularly tall individual trees in some study sites (Anderson and McGrew 1984). Pileated gibbons (Hylobates pileatus) select large emergent trees without lianas, presumably to keep away from climbing predators (Phoonjampa et al. 2010).
Like other species of mammals, primates use behavioral strategies to facilitate thermoregulation during sleep, including assuming a balled or hunched posture, sleeping in nests or in protected tree holes, sleeping on parasitic plants on tree branches, nest building, huddling, and nest sharing (Anderson 1984;Fan and Jiang 2008;Kappeler 1998;Terrien et al. 2011). Sleeping places may facilitate thermoregulation by functioning as shelters from the weather. For example, tree holes used by gray mouse lemurs (Microcebus murinus) have an insulating effect (Schmid 1998) and golden-brown mouse lemurs use leaf nests more often in a study site with lower temperatures than other study sites (Thoren et al. 2010). Huddling helps thermoregulation by increasing body temperature (Japanese macaques, Macaca fuscata: Hanya et al. 2007). For example, skywalker hoolock (Hoolock tianxing) and black crested (Nomascus concolor jingdongensis) gibbons huddle together more frequently in the cold season (Fan and Jiang 2008;Fei et al. 2019). Similarly, Azara's owl monkeys (Aotus azare azare) do not sleep in huddles when temperatures are relatively high (Savagian and Fernandez-Duque 2017). In some primate species huddling is more important than the selection of resting places for thermoregulation, for example, in southern bamboo lemurs (Hapalemur meridionalis: Eppley et al. 2017).
Comfort and the avoidance of disease and parasitic vectors are other important factors in the selection of sleeping places by primates (Anderson 1984). Selection of trees with large trunks and branches that allow for body stability and consequently more comfortable sleep has been reported in Bornean white-bearded gibbons (Hylobates albibarbis: Cheyne et al. 2012) and black-and-gold howler monkeys (Alouatta caraya: Brividoro et al. 2019). Supporting an antivector function for primate sleeping places, a study of sympatric lemurs (Avahi occidentalis and Lepilemur adwardsi) found that sleeping in tree holes protect lemurs from flying insects but promote ectoparasite infestation, while sleeping on open branches serve to avoid ectoparasites but increase susceptibility to flying insects (Hokan et al. 2017), supporting a previous finding that tree holes and tangles of vegetation protect against malaria infection in New World monkeys (Nunn and Heymann 2005). Huddling may also help to lower exposure to biting insects by decreasing exposed body surface (Mooring and Hart 1992).
Like the sleeping places of other primates, great ape nests are also proposed to function in predator avoidance, thermoregulation, comfort, and pathogen or pest avoidance (Anderson 1984;Fruth and Hohmann 1996;Fruth et al. 2018;Goodall 1962;McGrew 1992McGrew , 2004. For example, arboreal sleeping serves to avoid ground predators. However, leopards (Panthera pardus) and clouded leopards (Neofelis diardi), and sometimes lions (Panthera leo) and tigers (Panthera tigris), can climb trees (Gandini and Baldwin 1978;Stewart and Pruetz 2013;Sugardjito 1983;van Schaik et al. 1983) and thus great apes may better avoid these large carnivores by constructing high nests and selecting high trees and trees with high lowest branches for nesting. Chimpanzees and bonobos (Pan paniscus) select these nest and tree characteristics in study sites where predators exist, and chimpanzees select comparatively higher nest locations and trees where predation risk is higher (Baldwin et al. 1981;Fruth 1995;Fruth and Hohmann 1993;Hernandez-Aguilar et al. 2013;Ogawa et al. 2014;Pruetz et al. 2008;Stewart and Pruetz 2013). In lowland gorillas, immatures construct terrestrial nests less often and females and immatures sleep more frequently in arboreal nests in the absence of the dominant silverback (Yamagiwa 2001), and in Sumatran orangutans (Pongo abelii) adolescents and females with infants nest higher in trees than other individuals (Sugardjito 1983), suggesting that vulnerable individuals select sleeping heights to avoid predation. In addition, choosing to nest in trees with dense foliage, or in vegetation types with dense canopies, can help conceal the sleeping apes both visually and olfactorily from potential predators below (Ogawa et al. 2014;Stewart and Pruetz 2013).
Beyond predator avoidance, ape nests serve in thermoregulation. Nests give more insulation in colder temperatures compared to sleeping on the ground (Stewart 2011). Trees with smaller and more abundant leaves may provide insulating qualities, protecting from the weather (Fruth and Hohman 1993;Samson and Hunt 2014;Stewart et al. 2007). Chimpanzees make higher nests to avoid humidity in the wet season (Koops et al. 2012) and vary the architecture and shape of their nests, likely to help with thermoregulation . Lowland gorillas make nests more frequently, rather than sleeping on the ground, when temperatures are lower and rainfall higher (Melhman and Doran 2002;Sunderland-Groves et al. 2009), and their preference for constructing nests with a high number of plant species could reflect a strategy to improve insulation (Kalan et al. 2010).
There is also evidence that nests increase comfort during sleep. Trees with a higher density of leaves may facilitate the construction of more comfortable nests in chimpanzees (Samson and Hunt 2014;Stewart et al. 2007) and in bonobos (Fruth 1995). Chimpanzees prefer tree species that provide the structure and materials for enhancing comfort and stability (Samson and Hunt 2014). In general, more complex nests are more comfortable in chimpanzees (Stewart et al. 2007) and Sumatran orangutans (van Casteren et al. 2012). Flexibly making nests on the ground or in trees may be a strategy to maximize comfort in gorillas, to avoid wet ground from rain and elephants, or to respond to local availability of herbaceous nesting material (Tutin et al. 1995). For example, lowland gorillas sometimes make nests on decaying vegetation, which are likely more comfortable than those made on hard ground (Kalan et al. 2010). Bornean orangutans (Pongo pygmaeus) select trees where the shape and large size of the trunk allow for stability, providing comfort (Cheyne et al. 2013).
Finally, there is evidence that nests serve to avoid disease vectors and pests. Chimpanzees nest less frequently in sites where mosquitos are abundant, suggesting that they select sites for sleeping to avoid malaria infection (Krief et al. 2012). Bornean orangutans select tree species for nesting that repel mosquitos during the season when these insects are at high density (Largo et al. 2009). Similarly, a tree species preferred by chimpanzees for nesting repels insects ). In addition, sleeping in groups may serve to lower the number of insect bites in chimpanzees (Samson et al. 2019). The safety, stability, comfort, and shelter that nests provide have been proposed to increase sleep quality and consequently contributed to the evolution of cognition in great apes (Fruth and Hohmann 1996;Fruth et al. 2018;Sabater Pi 1984;Sabater Pi et al. 1997;Samson 2012;Samson and Shumaker 2013;Stewart et al. 2018).
Given the important functions of sleeping places for survival and health, we can hypothesize that primates select the physical characteristics of the places they sleep to serve these functions. Most great apes sleep in trees and thus trees are important resources. Great apes should select trees that offer materials for nest construction and, at the same time, the physical characteristics to achieve the overall functions of sleeping places (e.g., high lowest branches). Investigating which physical characteristics of trees are selected for nest building will help us to understand the function of nests and nest building behavior in great apes. To understand how animals select resources it is fundamental to analyze selection at different spatial levels or scales in the habitat (Mayor et al. 2009). Animals may select different resources, or characteristics of these resources, at different spatial levels (Mayor et al. 2009). Consequently, to better understand how great apes select nesting trees and materials, we need to study the selection of these resources at different spatial scales. Detecting patterns of selection requires detailed, systematic comparisons of physical characteristics between actual and potential nesting trees. Studies comparing the physical characteristic of actual and neighboring potential nesting trees in great apes report that nesting trees are taller and larger, have higher lowest branches, and have taller canopies than neighboring potential nesting trees (chimpanzees: Hakizimana et al. 2015;Hernandez-Aguilar 2006;Wrogemann 1992 andbonobos: Fruth 1995). However, as far as we know, no previous study has compared the overall physical characteristics of trees in specific sites on the landscape used for nesting by great apes with those on nearby suitable sites not used for nesting.
To contribute to this knowledge gap, we studied nesting selection by chimpanzees in a savanna habitat where predators (leopards and lions) and potential predators (African wild dogs: Crocuta crocuta, and hyenas: Lycaon pictus) are present (Hernandez-Aguilar 2009;Stewart and Pruetz 2013). Savanna habitats are especially interesting for the study of nesting selection because they are assumed to possess a low availability of suitable nesting trees and materials for nest building, offering a challenge for chimpanzees, especially during the dry season when the dominant deciduous vegetation has an overall low density of leaves (Baldwin et al. 1981;Hernandez-Aguilar et al. 2013;Moore 1996). Nests accumulate in specific parts of the landscape, in a pattern that does not seem to correspond to the distribution of suitable trees for nesting (Hernandez-Aguilar 2009;Sept 1992). This suggests that the decision of where to sleep in chimpanzees may operate at spatial scales larger than that of individual nesting trees. Therefore, analyzing nesting selection in spatially nested levels will help to identify the factors that influence the decisions of where to sleep in chimpanzees, which in turn would contribute to our understanding of the functions of nests. Furthermore, investigating nesting selection is important to understand the strategies that savanna chimpanzees may have to deal with the potentially low availability of nesting resources in their habitat and the presence of predators.
We examined two spatial levels of nesting selection in chimpanzees: sites in an area and trees in a site. We defined a nesting site as a place on the landscape "containing one or more nests, in one or more neighbouring trees. The limits of a nest site were defined as occurring once no nests were found within at least 100 m around the outermost nests of a nest site" (Hernandez-Aguilar 2009, p. 353). Nesting sites could be formed by one nesting party in 1 day but are formed most commonly by several nest-building episodes over time (Hernandez-Aguilar 2009). We defined an area as a part of the landscape that included both: 1) a nesting site and 2) the zone around this nesting site where no nests were found. The size of an area depended on the extent of the landscape where no nests were found (Fig. 2 in Hernandez-Aguilar 2009). We investigated whether 1) chimpanzees select sites in the landscape for sleeping based on the overall physical characteristics of trees in such sites and, if so, which characteristics they select; 2) chimpanzees select individual trees for nest construction based on their physical characteristics, and if so, which characteristics they select; and 3) the selection of individual trees for nest construction explains larger-scale nesting patterns. We took an explorative data analysis approach (Tukey 1977), and let the data suggest which variables affected nesting selection.

Study Site
The Issa study site is located in the west of the Ugalla region, east of Lake Tanganyika in western Tanzania. The Ugalla region is about 3300 km 2 and is characterized by broad valleys and steep hills with flat plateaus, ranging in elevation from 900 to 1800 masl (Hernandez-Aguilar 2009) and is part of the Greater Mahale Ecosystem. The main vegetation of the region is miombo woodland, dominated by trees from the genera Brachystegia and Jubernardia (Fabaceae). The vegetation within the study site is a mosaic of different types, classified in two categories: open or deciduous (woodland, wooded grassland, grassland, and swamp) and closed or evergreen (gallery forest and thicket forest) canopy (see Hernandez-Aguilar 2009 for descriptions). Only 1.5% of the landscape in the study site is closed while the rest is open vegetation. Four potential predators of chimpanzees were present in the study site: lion, leopard, spotted hyena, and African wild dog. The climate has a rainy and a dry season, each lasting about 6 months. Rainfall averages 1200 mm per year and temperature ranges from 11°C to 38°C (Piel et al. 2017). The study site was 48 km 2 (for further description of the study site see Hernandez-Aguilar 2006, 2009. The chimpanzees were not habituated to human observers and were not provisioned during our study.

Data Collection
We reanalyzed data from Hernandez-Aguilar (2006). To study the selection of trees and sites used by the chimpanzees for nesting, we first mapped the distribution of nesting trees in the study site. We used data collected in May-June 2003, at the end of a 20.5month study (October 2001to June 2003 that recorded the spatiotemporal distribution of night nests (N = 5354) in the 48 km 2 study site (Hernandez-Aguilar 2009). We monitored 20 nesting sites for reuse (revisits by the chimpanzees to make new nests) every 3 months during 1 year beginning May 2002. We chose these nesting sites to represent vegetation types (woodland, gallery, and thicket forest) and topographic types (valley, slope, and plateau) where nests were found in the study site (Hernandez-Aguilar 2009). These nesting sites were up to 600 m in length ( Fig. 2 in Hernandez-Aguilar 2009). The chimpanzees reused 18 of these nesting sites (Hernandez-Aguilar 2009). For the present study we randomly sampled 15 of these 18 sites. We used a random number generator for all random selections.
We aimed to include only trees where night nests had been constructed. Day nests can be identified because their structure is generally simpler and less carefully made than that of night nests (Goodall 1968;Plumptre and Reynolds 1997; see Hernandez-Aguilar et al. 2013 for details). However, we cannot completely discount the possibility that we included some trees with day nests in our analysis. We did not include the number of nests per tree in our analysis and thus the term nesting selection in our study refers to the trees and sites used for nesting by the chimpanzees.
We defined two levels of spatial analysis ( Fig. 1): Site level. We compared the overall physical characteristics of actual and potential nesting trees in a nesting site with potential nesting trees in the surroundings area where we never found nests of any age during the 20.5-mo study (Hernandez-Aguilar 2009). Tree level. We compared the physical characteristics of actual and potential nesting trees in a nesting site.
We defined potential nesting trees as those with a minimum diameter at breast height (DBH) of 10 cm and a minimum height of 3 m, because those were, with very few exceptions, the minimum DBH and height measurements of >2000 trees used for nesting by chimpanzees at Issa and other study sites in Ugalla (Hernandez-Aguilar 2006; Hernandez-Aguilar et al. 2013).
For the Site Level analysis, we investigated 30 plots (15 nesting plots and 15 potential nesting plots). We placed each nesting plot in a different nesting site, where the maximum concentration of nesting trees existed (Fig. 1). To place potential nesting plots, we randomly selected one of the outermost nesting trees of each of the 15 nesting sites. From its trunk, we walked 100 m away from the nesting site in a random direction. On hillsides we walked parallel to the slope, choosing the direction along the slope at random. If the site did not have a density of potential nesting trees similar to that of nesting sites at the end of the 100 m, as determined by visual inspection, we went back to the origin of the transect and sampled a new direction at random until we found a site with similar density of potential nesting trees. Consequently, all potential nesting plots were plots without nests and each nesting plot had its pair, a potential nesting plot, in the same area. We excluded plots close to trails frequently used by local people or by our research team because the chimpanzees may avoid these places for nesting (Plumptre and Reynolds 1997). Although no humans inhabited the study site permanently, a few local people used the trails to carry out low scale logging, hunting, and honey gathering activities.
For the Tree Level analysis, we investigated the 15 nesting plots used in the Site Level analysis. All 30 plots (nesting and potential) measured 25 m × 25 m. This is larger than plots used to sample actual and potential bonobo nesting trees in a forested habitat (20 m × 20 m, Fruth 1995) to allow for the open vegetation of our study site. We aligned plots north-south and east-west. In each plot, we measured the physical characteristics of all actual and potential nesting trees. We made measurements using a hand-held GPS unit (Magellan 315) for location, a 50 m measuring tape for horizontal distances, a compass (Silva Ranger 15) to get the horizontal angle from magnetic north, and a clinometer (Suunto PM-5/360PC) to obtain heights (Hernandez-Aguilar et al. 2013). We used a thread distance measurer (Walktax®) to measure distances >50 m. We marked each tree after measuring it to avoid including it twice in the study. Variables 1-5 were measured, and 6-8 were scored in categories: 1) DBH: We measured circumference at breast height (1.30 m) in the field and calculated DBH in meters using the formula Diameter = Circumference/π. 2) Tree height: Height from the ground at the base of the tree to the top of the tree in meters.
3) Lowest branch height: Height from the lowest branch to the ground in meters.

4) Number of branches:
Including all branches thick enough to be used as support for a nest (ca. 5 cm). We determined the minimum branch diameter based on the estimated size of branches supporting nests in the study area. 5) Number of horizontal, vertical, and inclined branches. 6) Number of branches of different diameters, scored as: 1 = 5 cm, 2 = 5-10 cm, 3 = 10-20 cm, 4 = >20 cm. 7) Leaf size, scored as very small (<5 cm), small (5-10 cm), medium (11-20 cm), and large (21-35 cm). For composed leaves we used the length of leaflets. 8) The relative density of leaves in the canopy, estimated visually and scored as: 0 = no leaves, 1 = 1-20%, 2 = 20-40%, 3 = 40-60%, 4 = 60-80%, and 5 = 80-100% of leaves covering the tree canopy. We measured this variable once during the rainy season. Because nesting trees had some nests that were old, it is possible that the density of leaves was different when those nests were constructed. 9) Tree species: Identified by an experienced botanist in the field.

Site Level Analysis
We sought to determine if the characteristics of a site affected the probability of that site being used for nesting by chimpanzees. Thus, we compared the characteristics of two sites in an area: one used for nesting (actual nesting site, N = 15) and the other not used for nesting (potential nesting site, N = 15). We used a one-to-one matched case-control analysis (Hosmer and Lemeshow 2000), a variant of logistic regression that accounts for paired responses. As possible explanatory variables we used the following: 1) the mean and standard deviation of the physical characteristics of all trees suitable for nesting (both actual and potential) in the plot, 2) overall suitable tree density, 3) number of suitable trees belonging to the most common species, and 4) vegetation type (open or closed).

Tree Level Analysis
We sought to determine if the physical characteristics of a tree affected its probability of being used for nest construction by chimpanzees within a nesting site, using trees from the 15 nesting plots described earlier. We looked at nesting choice as a function of tree characteristics, rather than looking at tree characteristics as a function of nesting choice, as in previous studies (Fruth 1995;Hakizimana et al. 2015;Hernandez-Aguilar 2006;Wrogermann 1992). To investigate which physical characteristics of the trees determined if the trees were selected by the chimpanzees for nest construction, we used a logistic regression, as we had a binomial (presence/absence) response variable. As possible explanatory variables we used the following tree characteristics: 1) DBH; 2) tree height; 3) lowest branch height; 4) total number of branches; 5) number of horizontal, of vertical, and of inclined branches; 6) number of branches of a given thickness (1-4); 7) leaf size; 8) leaf density; and 9) tree species. We included site as a possible random effect, to test for differences in the base selection rate (intercept) in different sites. We examined possible random slopes for tree characteristics separated by site because those can reveal differences in how the nesting probability responds to a tree characteristic in different sites.

Combined Site Level and Tree Level Analysis
To test if the apparent selection of a site for sleeping (Site Level) was simply the consequence of chimpanzees selecting individual trees for nesting (Tree Level), we performed an analysis on both Site Level and Tree Level selection combined and compared it to one where tree selection was performed in all plots (both potential and actual plots). For this analysis, we performed the same model search as in the Tree Level analysis but used trees from all plots (actual and potential nesting plots). We then compared the resulting model to a model combining the results of Site Level and Tree Level analyses.
We performed a new model selection to find the best combination of tree characteristics for describing tree selection in both types of plots (actual and potential nesting plots). We used the Bayesian information criterion (BIC) to compare this model with the combined BIC of the Site Level and Tree Level models.

Inferential Considerations
For all analyses, we log-transformed heights and DBH because they are positively definite characteristics. For example, a change from 2 m to 4 m in the height of a tree is expected to cause a larger impact in the probability of being selected for nesting than a change from 20 m to 22 m.
Because our study was observational and explanatory variables can be correlated, we used model selection to determine the combination of explanatory variables that produced the best model for each model search (selection in Site Level, selection in Tree Level, and selection of trees in all plots). When we could use maximum likelihood estimates, we used BIC as the model selection criterion, as theory suggests using BIC will converge toward the model that produced the data (Claeskens and Hjort 2008). Because some variables were correlated, there was a risk of selecting a correlated variable rather than the explanatory variable that actually affected the nesting probability. For the tree selection analyses (selection in the Tree Level and selection of trees in all plots), we looked at all models (generated by considering all combinations of explanatory variables) and extracted the model with the lowest BIC value.
Maximum likelihood analysis can yield results that perfectly separate the binary responses and where the regression coefficients diverge rather than converge. In such cases, the maximum likelihood optimization yields unrealistic estimates. This occurred in the Site Level analysis, so we used Bayesian analysis for model selection and regression coefficient estimation (see also Electronic Supplementary Material [ESM]). The Bayesian Site Level analysis was computationally more time-consuming than the classic analysis for the Tree Level, and with 27 potential explanatory variables (Table SI) going through all combinations (2 27 = 134,217,728 models) was unfeasible. We instead opted for a stepwise forward approach that started with a model without explanatory variables. For each step, we tested all explanatory variables not already included, and added the explanatory variable with the most evidence using the Bayesian model likelihood as the criterion, which converges to the true model just as BIC does (see, e.g., Chatterjee et al. 2020). We continued this procedure until we found no evidence for any extra explanatory variables. A stepwise approach is of course not guaranteed to find the best model. However, with 15 plot pairs, the data are expected to support a model with only few actual explanatory variables and thus a step-wise forward approach has a good chance of finding the best model according to the Bayesian model likelihood. To test the robustness of this approach, we examined three different Bayesian prior distributions when doing the stepwise search (see the ESM, which also describes how the prior distributions affect the regression coefficient estimates). We conduced all statistical analyses in R version 3.3.1.I.
The ratio between the Bayesian model likelihood of two models is called the Bayes factor and is used for summarizing evidence for one model versus another. We used the Jeffreys (1961) criteria for evaluating Bayes factors, so that a Bayes factor smaller than ffiffiffiffiffi 10 p is slight, one between ffiffiffiffiffi 10 p and 10 is substantial, and one above 10 is strong evidence. We used the same evaluation for the ratio of BIC weights for two models, when those were examined.
It was difficult to assess the importance of the different explanatory variables based solely on the parameter values, as the range of the variables also affects the importance of the effects. Furthermore, the data collected for the Site Level analysis was that of a 1to 1 matched case-control study, while the Tree Level analysis examined all trees in a nesting plot. We took the natural variation of each explanatory variable into account when comparing the importance of explanatory variables. For instance, a change of 1.0 in leaf density is not directly comparable to a change of 1.0 in DBH, as leaf density is an ordered categorical variable while DBH is measured in meters. The range is also very different for different variables. To compare effects, we summarized the effect strength of a variable by reporting the nesting probability ratio when going from the 5% to the 95% quartile. We used this definition of effect strength rather than using the more familiar standardized regression coefficients, as we wanted to construct a definition that would also allow us to compare Site Level and Tree Level effect strengths.

Ethical Note
This research was noninvasive, complied with the Guidelines of Best Practices for Field Primatology of the protocols of the International Primatological Society (http://www. internationalprimatologicalsociety.org/docs/Code%20of_Best_Practices%20Oct% 202014.pdf), and adhered to the legal requirements of Tanzania. The authors declare that they have no conflict of interest.
Data Availability The data set analyzed in our study is available from the corresponding author on reasonable request. We do not include the exact location of our study site to protect our study population.

Results
Nesting plots had 374 trees (132 actual and 242 potential nesting trees) and potential nesting plots had 389 (all potential nesting trees). Thus, we analyzed 763 trees in the combined area of all 30 square plots (0.01875 km 2 ) (Tables I and II, ESM Table SII). The multiple regression analyses we conducted looks at site and tree nesting selection as a function of site and tree characteristics. In contrast, looking at tree characteristics as a function of site and tree nesting selection may give apparent differences between measurement values because correlation among variables is not accounted for (Table III).

Site Level
The model considered best based on Bayesian model probability included mean log tree height, mean number of 5-10 cm diameter branches, and mean log lowest branch height (Table IV; see ESM Tables SIII and SIV for more details of the process of model selection). When testing the three different priors we obtained the same model in all three cases, giving additional evidence of the robustness of our stepwise approach. The regression formula, where the probability for choosing a site labeled "X" instead of one labeled "Y", was estimated as where MLTH is mean log tree height, MNB2 is mean number of 5-10 cm diameter branches, and MLLBH is mean log lowest branch height. Only mean log tree height had substantial evidence according to the Jeffrey classification of Bayes factors (B = 4.12) (Table IV). This was also the first variable chosen in the stepwise model search, with a Bayes factor of 122 compared to the null model. Thus, the evidence that some explanatory variables affected nesting site probability was strong, and the single variable with the strongest most evidence on its side was mean log tree height. Although the 95% credibility bands encompassed zero, this does not mean that the test is nonsignificant, as in classic hypothesis testing.
The evidence for an effect of the mean number of 5-10 cm diameter branches and mean log lowest branch height was slight. Of the three influential variables (mean log tree height, mean number of 5-10 cm diameter branches, and mean log lowest branch height), only the mean number of 5-10 cm diameter branches affected the nesting probability negatively rather than positively (Fig. 2).

Tree Level
The model search resulted in a model with tree height, DBH, and leaf density as explanatory variables for tree selection. The regression coefficients of the model deemed best by the BIC search predicted the probability that a tree in a nesting plot was used for nest construction as follows (logistic regression): where TH is tree height and LD is leaf density. The coefficient associated with DBH was very close to 1.0. The coefficient associated with leaf density was very close to 0.5 and had a confidence interval very close to encompassing 0 (Table V). There is a positive relationship between the three explanatory variables and the nesting probability according to Eq. 1 (Fig. 3). Increases in the value of each of the three variables in the best model according to BIC (tree height, DBH and leaf density) caused an increase in the probability of a tree being used for nesting (Eq. 2 and Fig. 3). BIC weights show that the evidence for tree height and DBH was strong but the evidence for leaf density was slight (Table VI). Lower ranked models show that vegetation type, the number of vertical branches or the number of 10-20 cm diameter branches may also be important, but the best model does not use these variables, meaning that the evidence does not support this conclusion (Table VI).
We found no plotwise random effects, which means that the chimpanzees did not detectably choose a larger ratio of trees in one plot than in another conditioned on tree height, DBH, and leaf density. In the models where we could examine random slopes, we found no such effects, meaning that there was no detectable different selection of tree height, DBH, or leaf density in different plots. In short, there was no evidence that chimpanzee preferences for tree characteristics varied in different plots. We did not find that tree species had an effect on the probability of selecting a tree for nesting.

Comparison of Effect Strength Between Site Level and Tree Level
We found that Site Level effects were in general stronger than Tree Level effects (Table VII). The two largest effects were mean number of 5-10 cm diameter branches and mean log tree height from the Site Level, while only tree height from the Tree Level had a larger effect than the least ranked effect from the Site Level, namely mean log lowest branch height.

Combined Site Level and Tree Level Analysis
The model search on selection of trees in all plots obtained a model that, as in the Tree Level analysis, included DBH and tree height, but also included number of inclined branches (instead of leaf density). The regression formula was  Fig. 2 Actual (y = 1) and potential (y = 0) nesting sites used by chimpanzees at Issa, Tanzania, October 2001-June 2003. The regression line represents the probability (P) of choosing a site with a given variable value over one having a median variable value, while the two other explanatory variables are held constant. The three vertical lines, from left to right, are the 5% quantile, the median and the 95% quantile, respectively, for the explanatory variable.
The BIC was better for the combined site and tree selection models than for the tree selection in all plots model (Eq. 3). The BIC difference was 125, showing strong evidence for the combined site and tree selection models compared to the model with tree selection in all plots, which strongly suggests that nesting selection took place at both spatial levels.

Discussion
The chimpanzees in our study selected both the nesting sites they used in an area and the trees they used to build nests within a site. In an area, the chimpanzees selected nesting sites based on their overall tree height, overall number of 5-10 cm diameter branches, and more likely than not, overall lowest branch height. Within a nesting site, they selected trees for nest construction based on their height and DBH and also, more likely than not, on the density of leaves they had. Our results show that site selection is a separate task from that of individual tree selection, and that the chimpanzees exhibit two different spatial levels of selection in nesting. Furthermore, our results indicate that site selection is stronger than individual tree selection. These data suggest that the chimpanzees first selected a site in which to sleep based on the overall characteristics of all trees present at the site, and then selected the tree in which to build the nest within this nesting site (Fig. 4). Tree height was the most important variable for nesting selection by the chimpanzees in our study. It had the strongest effect on the probability that chimpanzees selected a tree, with evidence for a strong effect, and the second strongest effect on the probability that they selected a site, with evidence for a substantial effect. Studies that have compared trees within a nesting site, as we did for the Tree Level analysis, reported that sleeping trees are significantly higher than potential sleeping trees in bonobos (Fruth and Hohmann 1993;Fruth 1995) and gibbons (Fan and Jiang 2008;Phoonjampa et al. 2010). When the height of chimpanzee sleeping trees has been compared to the overall height of trees in the habitat, in most study sites nesting trees were generally higher (reviewed in Hernandez-Aguilar et al. 2013), as is the case for Bornean orangutans in disturbed forests where there is a scarcity of suitable nesting sites (Ancrenaz et al. 2004) and for other primates (e.g., gold-and-black howler monkeys: Brividoro et al. (2019). We used BIC weights (which are proportional to exp − BIC 2 À Á ) to summarize the support for a model chosen by BIC. The model is weighted by the BIC weight of a model without the given explanatory variable, to make a measure roughly equivalent to a Bayes factor (Table IV), labeled "relative BIC weight." Chimpanzees in savannas build higher nests and use higher nesting trees than those available in their habitat in study sites where predators are present than in study sites where predators are almost absent (Hernandez-Aguilar et al. 2013;Pruetz et al. 2008;Stewart and Pruetz 2013). We did not examine nest height in our study, but nest height positively correlates with nesting tree height (Hernandez-Aguilar et al. 2013;Koops et al. 2012;Ogawa et al. 2007;Sept 1998) and thus a tall tree would provide more opportunities to make higher nests and would be more time-consuming for a predator to climb, giving the chimpanzees more time to detect its presence. Our findings support the antipredation function of nests and suggests that, like chimpanzees at other sites, chimpanzees at Issa select trees that increase safety from potential predators.
In addition to selecting a safe tree for nesting, our results suggest that Issa chimpanzees select sites for sleeping that offer protection against predation. A site with high trees overall would provide not only suitable nesting trees, but also high neighboring trees that would similarly increase the time needed by a climbing predator to access a nesting tree via connected branches, allowing the chimpanzees longer time to hear the predator's approach.
The mean number of 5-10 cm diameter branches had the strongest effect on the probability that a site was selected for nesting and this effect was negative, although the evidence for the effect of this variable was considered slight. Assuming that this effect exists, it means that the more 5-10 cm diameter branches there are, the less chance there is that the site will be selected for nesting. We could not find an immediate explanation for a direct link between the mean number of 5-10 cm diameter branches and site selection. However, it is possible that this variable correlates with a characteristic we did not measure that affected site selection. The overall abundance of relatively small but thick enough branches in a tree may indicate that its canopy does not have the adequate architecture for nest construction (e.g., insufficient branch stability). Another explanation could be that the abundance of such branches may hide larger branches  conditioning for the Tree Level as for the Site Level (i.e., that there is a pairwise comparison between an actual and a potential nesting site/tree) to make this score comparable between the two analyses. We used the absolute value of the regression coefficient so the effect strength of an explanatory variable with decreasing probability for increasing values can be directly compared to the strength of an explanatory variable with increasing probability for increasing values. Variables are arranged in order of effect strength from strongest to weakest.
from the chimpanzees' view, especially close to the tree trunk, where chimpanzees in Issa nested more frequently at the time of our study (Hernandez-Aguilar et al. 2013).
It is more likely than not that lowest branch height had an effect on the probability that a site was selected for nesting. Lowest branch height has been suggested to influence the selection of trees for sleeping in chimpanzees (Goodall 1962(Goodall , 1965Hernandez-Aguilar et al. 2013), bonobos (Fruth 1995), and in other primate species (e.g., gold-and-black howler monkeys: Brividoro et al. 2019). It may be more difficult and time consuming for a cat to climb a nesting tree with high lowest branches, allowing more time for primates to detect its presence and flee or defend themselves (Hernandez-Aguilar et al. 2013). In support of the hypothesis that selecting trees with high lowest branches for nesting may reflect an antipredation strategy, chimpanzees prefer trees with low first branches for nesting in Seringbara, Guinea, a study site with low or absent predator pressure (Koops et al. 2012). In addition to selecting a tree with high lowest branches, it may be advantageous for chimpanzees to select sites for sleeping that have overall high lowest branches of trees, making a predator's ascent difficult both to a nesting tree and to neighboring trees. However, this variable had the most uncertainty out of the explanatory variables for the Site Level analysis and more data are needed to know if lowest branch height actually affects nesting probability.
In the Tree Level analysis, DBH had the second strongest effect on the probability that a tree was selected for nesting. This suggests that chimpanzees select the height of a tree and the diameter of the tree trunk separately when choosing a tree for nest construction. Most nests in Issa are positioned close to the tree trunk (Hernandez-Aguilar et al. 2013), where branches are thicker, and thus when chimpanzees select trees with larger DBH they may be selecting trees that provide branches more adequate to support their weight (Hernandez-Aguilar et al. 2013;Koops et al. 2012). Large DBH trees are thought to provide stability for making secure and comfortable nests in Bornean orangutans (Cheyne et al. 2013). Therefore, trunk diameter may function as an indication of branch diameter and stability. The selection of trees with large DBH for sleeping has been reported in several primate species. When trees within a site have been compared in other studies, similar to what we did in the Tree Level analysis, sleeping trees have significantly larger DBH than potential sleeping trees in bonobos (Fruth 1995;Fruth and Hohmann 1993) and black crested gibbons (Fan and Jiang 2008). When the DBH of sleeping trees has been compared to that of overall trees in the habitat, sleeping trees have significantly larger DBH in Bornean orangutans (Ancrenaz et al. 2004;Cheyne et al. 2013), pigtailed macaques (Macaca leonine: Albert et al. 2011) and gold-and-black howler monkeys (Brividoro et al. 2019). Our study adds to the evidence that DBH is an important characteristic for primates when selecting sleeping trees. showing how site and tree physical characteristics affected nesting selection, according to our models. Blue solid arrows show the three variables that affected the probability that a site is used for nesting (Site Level). The dashed arrow shows that nesting site selection determines the individual trees that will be available for selection in the site. Yellow solid arrows show the three variables that affected the probability that a tree is used for nesting (Tree Level).
We found that it is more likely than not that leaf density had an effect on the probability that chimpanzees selected a tree for nesting within a site. Abundance of leaves has been suggested to be important when chimpanzees select trees for nest construction (Baldwin 1979;Goodall 1962Goodall , 1965Hernandez-Aguilar 2009;Izawa and Itani 1966;Sabater Pi 1984) and comfort and insulation are important features of nests (Samson 2012;Stewart et al. 2007Stewart et al. , 2018. The higher the proportion of leafy versus woody area on a nest surface, the softer and more comfortable a nest is (Stewart et al. 2007). Chimpanzees in Seringbara prefer trees with dense leaf cover presumably for comfort (Koops et al. 2012). Chimpanzees in Semliki, Uganda, disproportionately use a species of tree that has the highest density of leaves of all tree species used for nesting at that study site, suggesting that the dense foliage of this tree species may insulate and provide thermoregulation and also increase comfort (Samson and Hunt 2014). Similarly, in other primate species the use of vegetation tangles or the construction of leaf nests for sleeping has been suggested to aid with thermoregulation (e.g., those of golden-brown mouse lemurs: Thoren et al. 2010). Furthermore, making nests in trees with high density of leaves may help apes conceal themselves from potential predators on the ground (Ogawa et al. 2014;Stewart and Pruetz 2013). Some primates sleep in dense foliage, presumably to hide from predators, for example ursine colobus monkeys (Colobus vellerosus: Teichroeb et al. 2012) and Azara's owl monkeys (Savagian and Fernandez-Duque 2017). However, in our study, leaf density had the most uncertainty among the explanatory variables for the Tree Level analysis. In addition, leaf density at the time of measurement is a noisy indicator of leaf density at the time of nesting. Thus, more data are needed to conclude whether leaf density affects tree selection by chimpanzees.
In sum, our results support the antipredation and comfort function of nests, trees, and sites and more likely than not the thermoregulation function of nests and trees. In addition, our results suggest that both nesting sites and individual nesting trees function to reduce the risk of predation by providing a sleeping environment where overall trees are high and have high lowest branches, making it more difficult for a predator to access nesting trees directly or using neighbouring trees. Thus, chimpanzees at Issa selected both safe sites and secure trees. These are important decisions in a habitat where potential predators exist, including those able to climb, and where the availability of suitable trees for nesting may be low, at least seasonally. Unlike at Fongoli, where the predator population is reduced (Lindshield et al. 2019), no terrestrial nests have been found in Issa (Hernandez-Aguilar 2009;Hernandez-Aguilar et al. 2013;Stewart and Pruetz 2013), supporting the idea that arboreal nesting is a strategy to avoid predation.
There is increasing evidence that nest construction in chimpanzees and other great apes involves the complex manipulation and selection of vegetation materials and likely an understanding of the physical properties of such materials, which may be comparable to tool use (Fruth and Hohmann 1996;Hansell and Ruxton 2008;Samson andHunt 2012, 2014;Stewart et al. 2011Stewart et al. , 2018van Casteren et al. 2012). Our finding that chimpanzees selected sites and trees separately for nesting based on specific physical tree characteristics suggests that before selecting a site and an individual tree, chimpanzees compare physical dimensions (including heights and diameters) of both groups of trees and individual trees that would provide protection against predation in addition to adequate materials for nest construction. We propose that the cognitive abilities required to evaluate the physical dimensions of groups of trees and of individual trees before using them for sleeping may be similar to those exhibited by chimpanzees when selecting physical dimensions of objects (stones or plant materials) before using them as tools. In particular, chimpanzees select objects to use as tools for specific activities (e.g., nut-cracking) based on these objects physical characteristics (size, weight, shape, density, and material) (Boesch and Boesch 1983;Carvalho et al. 2008Carvalho et al. , 2009Motes-Rodrigo et al. 2019;Seed et al. 2012;Sirianni et al. 2015), can anticipate the weight of a tool from visual cues such as its size (Sirianni et al. 2018) and assess several physical characteristics of potential tools for nut-cracking simultaneously (Visalberghi et al. 2015).
Learning seems to be an important component of nesting behavior (Videan 2006). Chimpanzees reuse nesting trees and sites, and even specific spots in trees where nests are constructed (Hernandez-Aguilar 2009;Sept 1992;Stewart et al. 2011). Nests last several months and even more than a year (Hernandez-Aguilar 2009; Ogawa et al. 2007;Sept 1992;Stewart et al. 2011) and thus may serve as visual information of where conspecifics have nested in the past, especially in savannas where the open vegetation allows nests to be spotted further (Hernandez-Aguilar 2006, 2009. In this sense, nesting sites may provide information on the location of sleeping sites and provide opportunity to inexperienced individuals for learning about the physical characteristics that make sites and trees appropriate for nest building. A limitation of our study is that we have evidence that potential nesting sites had been unused for a short period compared to a chimpanzee's lifespan and thus we cannot rule out that the chimpanzees used these sites for nest construction in other periods. However, the fidelity of reuse of the same nesting sites seems to be a long-term pattern. In two other study sites in Ugalla (Nguye and Mufombasi) chimpanzees used the same nesting sites and trees for at least 5 years (Hernandez-Aguilar and Moore, unpubl. data). Furthermore, both chimpanzee and bonobo reuse of specific spots within trees for nest construction is shown by scars and unnatural growth shapes of tree branches and has been estimated to be as long as 50 years (Fruth and Hohmann 1994;Stewart et al. 2011).
Social factors, food abundance and availability, seasonality, and vegetation types in the habitat have been proposed to influence the selection of sleeping sites in primates (Anderson 1984(Anderson , 2000, including chimpanzees Baldwin et al. 1982;Barca et al. 2018;Basabose and Yamagiwa 2002;Carvalho et al. 2015;Furuichi and Hashimoto 2004;Goodall 1986;Granier et al. 2014;Hakizimana et al. 2015;Hernandez-Aguilar 2009;Koops et al. 2012;Ndiaye et al. 2018;Ogawa et al. 2007Ogawa et al. , 2014. Social factors, such as engaging in territory patrols or guarding females with swollen sexual skin influence male chimpanzees' decisions of where to nest (Goodall 1986). In gorillas, the absence of the dominant male cause female and juvenile to sleep in arboreal (instead of terrestrial) nests (Yamagiwa 2001). Bonobos construct nests to avoid conflicts with party members, mainly over food (Fruth and Hohmann 1993). Consequently, diverse social factors may affect nesting behavior in great apes and influence the selection of sites and trees for nesting. Chimpanzees in a rainforest appear to position their sleeping sites based on the places they planned to feed the following day (Janmaat et al. 2014). The strong seasonality and the mosaic vegetation characteristic of savanna habitats likely affect the selection of sites and trees for nesting by chimpanzees. The spatiotemporal changes in the availability of water and food in savanna habitats seem to influence their selection of sites for nesting (Ogawa et al. 2014). With the exception of small parts of evergreen vegetation, the majority of the landscape in savanna habitats is occupied by deciduous vegetation types where tree height is lower, tree trunk is smaller, and trees exist in overall lower densities and have a discontinuous canopy in comparison to more forested habitats (Abbot et al. 1997;Hutley and Setterfield 2008;van Leeuwen et al. 2020;). These physical characteristics of trees in deciduous vegetation types may have forced the chimpanzees in our study to select sites with overall high trees and tall and large trees for nesting. In addition, the low density of leaves of open canopy vegetation and the seasonally low availability of leaves may have played a role in the selection of trees with more leaves by the chimpanzees in our study. To better understand chimpanzee nesting selection future studies should investigate other physical and environmental characteristics of actual and potential nesting sites and trees besides the ones we have analyzed in our study, and compare nesting selection patterns with other savanna sites and in different habitats.