Oil Palm Cultivation Critically Affects Sociality in an Endangered Malaysian Primate

Human-induced habitat alterations globally threaten animal populations, often evoking complex behavioural responses in wildlife. This may be particularly dramatic when negatively affecting social behaviour, which fundamentally determines individual tness and offspring survival in group-living animals. Here, we provide rst evidence for critical behavioural modications in sociality of Southern pigtailed macaques visiting Malaysian oil palm plantations in search of food. Specically, we found signicant reductions of positive social interactions, an increase of aggression and shifts in the macaques' social network structure, with the central positions of high-ranking adult females and immatures being passed to low-ranking individuals, likely resulting from socio-ecological risks posed by plantations. Deviations from natural behaviour also affected the smallest but crucial social units within groups, mother-infant pairs, with increased maternal protectiveness at plantations. We suggest that although primates can persist in human-altered habitats, their ability to adapt comes with a trade-off for their natural sociality, potentially hampering infant development and individual survival. Studies like ours remain critical for understanding species’ adaptability to anthropogenic landscapes, which may ultimately contribute to facilitating their coexistence with humans and preserving biodiversity.


Introduction
The ongoing expansion of anthropogenic landscapes threatens rainforest ecosystems and the survival of many species 1 . Land conversion for food production and the cultivation of cash crops is the main driver for the global forest loss of estimated 10 million hectares per year 2 . Disturbing natural habitats and presenting sources of anthropogenic food, such modi cations create novel and rapidly changing environments for animal populations 3 . With 60% of species being threatened 4 , non-human primates (hereafter 'primates') may be particularly susceptible to human disturbance. The Southern pig-tailed macaque (Macaca nemestrina, listed as Endangered by the IUCN 4 ) has lost large parts of its natural forest habitat in Malaysia and Indonesia to oil palm monocultures 5 . Habitat fragmentation, hunting and con icts with farmers are only some of the threats the macaques face in the forest-oil palm matrix 3,6 .
Plantations also lack protection by dense forest vegetation and ease access for potential predators 3,7 .
Largely understudied in the wild and described as elusive species that tend to avoid human contact 6 , it is imperative to better understand M. nemestrina's ability to adapt to these human-altered habitats.
Adaptive alterations in behaviour (i.e. behavioural plasticity 8 ) are frequently one of the rst visible responses of animals to human disturbance. In primates, these responses are diverse and very complex, with most previous studies focusing on their ability to exploit new feeding grounds, shifts in activity or ranging behaviour, and the negative consequences of the human-primate interface, such as increased stress levels among animals or con icts over resources (reviewed in 9 ). Despite their growing signi cance, quantitative studies on anthropogenic impact on wildlife behaviour have largely been context-speci c and lack comparative assessments (reviewed in 10 ). A few exceptional studies have focused on primates that live in (peri-)urban environments, describing substantial variation in time budgets 11,12 and individual social behaviour [13][14][15] across groups that face varying degrees of human disturbance.
In comparison, there is little in-depth knowledge of primate (and indeed wildlife) behaviour in agriculturally modi ed habitats. Particularly, differences in primate sociality between natural and anthropogenic habitats have not been systematically assessed. Yet, this is critical to understand as social behaviour plays a fundamental role in group-living animals. Macaques, as the majority of primate species, live in complex multi-male, multi-female societies, often following a dispersal regime, with males leaving their birth group to breed elsewhere, while females are philopatric and form the core of social groups 16 . Strong and enduring social bonds signi cantly increase tness in both sexes, with social integration offering energetic bene ts and buffering against social and environmental stress 17,18 . Speci cally, the quality of a liative relationships was found to predict individual reproductive performance 19,20 , longevity 21 , and infant survival 22 . Grooming is one of the most common a liative interactions among primates, and has a key role in establishing and maintaining social relationships that underlie complex social features such as an animal's connectedness within the group's social network [23][24][25] . Further, juvenile play constitutes a springboard for social competence during the rst years of an individual's life 26 , allowing immatures to construct and expand their social networks and grow into their social roles as adults 26,27 . On the other hand, agonistic interactions are crucial in social groups, e.g. for the acquisition and maintenance of dominance status which directly impacts individual health 28 . Shifts in any of these behaviours, and (consequently) in individuals' social network roles, may impair social bonds and thus have downstream effects on group stability and survival 29 .
Though widely overlooked in previous research, behavioural plasticity in the smallest but most essential social units of a group, i.e. mother-infant pairs, may indicate how well a species can cope in humanaltered landscapes. Primate mothers provide extensive care to their offspring, and their behaviour strongly affects the development of a wide range of infant behaviours, including environmental exploration, a liation and aggression, and later sexual and parental behaviour 27,30 . Depending on the social system of a species, but also on individual characteristics such as personality, dominance rank, parity, or infant age and sex [31][32][33][34] , mothering styles can vary from highly protective to highly tolerant, with the reduction of body contact and maternal permissive behaviours being particularly critical components for infant independence 35 . In this context, disruptions of the mother-infant relationship caused by habitat alterations may have severe consequences for offspring health and survival.
Macaca nemestrina frequently enter oil palm plantations which constitute an anthropogenically modi ed part of their natural range. Previous studies reported shifts in the macaques' foraging behaviour when ranging in these monocultures, complementing their diet with palm fruits and actively hunting plantation rats, an excellent source of protein 36,37 . Yet, it remains unclear whether and how the macaques' sociality in oil palm plantations deviates from their behaviour in their natural, undisturbed forest habitat. Here we take advantage of a 'natural experiment', by comparing the social behaviour of M. nemestrina in their natural habitat, the primary rainforest, with their behaviour observed in the human-altered plantation environment. Alternately ranging in these two different habitat types, the macaques serve as their own 'controls' in understanding how human disturbance can modify wildlife behaviour, ruling out the effects of group-speci c factors, such as variation in group size, sex ratio, or cross-population genetic differences. Firstly, we provide an overview on the macaques' overall activity budget in forest and plantation habitat. Secondly, we examined quantitative differences in individuals' frequencies of a liative and agonistic interactions across these habitats. Thirdly, we assessed potential differences in the macaques' social network connectedness. Finally, we investigated dynamics in the mother-infant relationship during the rst six months after infant birth.
Based on previous ndings 13,15,36 , we predicted strong shifts in time budgets across habitats, with macaques increasing foraging and feeding activity during plantation visits, while compromising on social interactions. We predicted rates of a liation to be low at the risky plantation environment that lacks shelter and increases the visibility to predators 3,7 , but aggression to increase based on the assumption that plantations likely evoke stress in macaques and create competition for energy-rich food sources 11,38 . In line with this, we predicted reductions in the number of individual interaction partners and the connectedness in social networks during plantation visits. Finally, we predicted macaque mothers to be more protective of their dependent offspring when ranging in the plantation compared to the forest.

Results
The macaques' activity budget in forest and oil palm plantation We collected behavioural data on two habituated groups of macaques inhabiting the Segari Melintang Forest Reserve in Peninsular Malaysia and the surrounding oil palm plantation, with daily plantation visits lasting on average 2.9 hours (see Methods). As plantation areas in close proximity to the forests provide additional shelter and protection for animals through close-by forest vegetation, we distinguished between forest habitat, the plantation edge, i.e. plantation areas within 50 metres from the forest border, and areas further inside the plantation (hereafter 'plantation').
As a measure for socio-ecological risks posed by plantation and forest habitat, respectively, we recoded ight responses from potential predators shown by the macaques during our focal observations.
Accounting for 83% of observed ight behaviour, humans and feral dogs were the most commonly observed threats. Both at the plantation edge and inside the plantation, ight responses from humans occurred at a rate of approximately 0.1 per hour observation time. In contrast, the rate of ight responses from humans was only 0.01 per hour in the forest. Similarly, ight from feral dogs was more frequently observed in the two plantation habitats (0.05 per hour) compared to the forest (0.01 per hour).
Overall, we found strong differences in the primates' time budgets across habitats (Fig. 1). Observed activities generally occurred in all three habitats, yet the rates at which they were performed remarkably changed when the macaques were ranging in the oil palm plantation. As predicted, approximately two thirds of the time the macaques spent at the plantation edge and inside the plantation, respectively, were dedicated to the search and consumption of food (mean ± SD (plantation edge/plantation) = 0.68 ± 0.08/0.65 ± 0.08). Socializing with conspeci cs, in contrast, was drastically reduced inside the plantation (mean ± SD = 0.003 ± 0.006) compared to the forest (mean ± SD = 0.15 ± 0.09), yet it occurred at an intermediate rate at the plantation edge (mean ± SD = 0.06 ± 0.06).

Social interactions in forest and oil palm plantation
To gain a deeper insight into the macaques' social behaviour, we compared rates of a liative and aggressive interactions between forest and plantation habitats. Accounting for 96% of the total time spent socializing, grooming and social play were the most commonly observed positive social interactions. During focal observations, we recorded a total of 1,607 grooming bouts and 574 bouts of juvenile social play. The rates of both grooming and social play signi cantly differed between habitats, while controlling for potentially confounding factors, particularly an individual's dominance rank and agesex class, the study group and time of the day (Likelihood ratio test (LRT, grooming/social play): χ² = 120.96/40.28, df = 2, P < 0.001, N = 1,535/510 focal observations of 50/16 individuals, details in Supplementary Table S1). Speci cally, grooming rates were close to zero inside the plantation and signi cantly reduced at the plantation edge compared to the natural forest habitat (Fig. 2a). Similarly, social play was signi cantly higher in the forest than in both plantation habitats (Fig. 2b).
As predicted, differences in aggressive behaviour across habitats were generally in contrast to patterns of a liation, although they were less clear, and varied according to the intensity of aggression.

Social network in forest and oil palm plantation
In order to capture the impact of habitat alteration on complex patterns of an individual's social role that go beyond frequencies of social interactions, we examined differences in the macaques' social network connectedness when ranging at the oil palm plantation compared to the forest. To this end, we constructed social networks separately for each habitat based on dyadic a liation which was measured as the proportion of point time scans two individuals were in social contact (i.e. grooming, social play or a liative body contact) during behavioural observations. With only 0.2% of scans including positive social contact, dyadic a liation was nearly absent inside the plantation. In contrast, 14.9% and 7.5% of scans in the forest and at the plantation edge, respectively, included a liative contact. Therefore, further analysis was limited to describing differences in social network parameters between forest and plantation edge.
We used binary degree as a measure of partner diversity, re ecting the overall number of social partners for each individual. This did not signi cantly differ between habitats, when controlling for individual dominance rank, age-sex class and the sampling effort (χ² = 9.54, df = 8, P = 0.30, N = 36 individuals). Mean partner diversities, i.e. the overall number of partners divided by the total number of proximity scans per individual, were 0.048 and 0.050 for forest and plantation edge, respectively.
We further investigated relative changes in individual scores of eigenvector centrality (EC) between habitats, uncovering in how far an individual's position in its social group may differ between forest and plantation. EC accounts for both direct and indirect network ties, re ecting an individual's importance in the social network while considering the importance of its neighbours 29,39,40 . It was found to be strongly linked to indicators of individual health and tness in group-living animals, including macaques 23,40,41 . Therefore, EC may be a 'proxy' behavioural (network) measure for our purpose of determining whether the effect of anthropogenic factors extend beyond time budgets, potentially impacting individuals' tness and survival 42,43 . Additionally, we explored whether such differences in network positions might be dependent on an individual's socio-demographic attributes, particularly its dominance rank and age-sex class. In contrast to partner diversity, EC signi cantly differed between habitats as indicated by the LRT (χ² = 55.01, df = 8, P < 0.001, N = 36 individuals, details in Supplementary Table S2). To account for interdependency of network measures, particularly EC, we additionally ran node-swapping permutation tests 44,45 which con rmed the signi cant effect of different habitats on EC (Supplementary Table S2). The signi cant three-way interaction between habitat, dominance rank and age-sex class indicates a clear, yet opposite, effect of dominance on EC in different habitats. Speci cally, EC decreased with lower dominance in the forest, while it increased with lower dominance at the plantation edge (Fig. 3). In other words, high ranking individuals were better connected compared to lower ranking individuals when the group was ranging in the forest, while low-ranking individuals occupied the most central positions in the group at the plantation edge. This combined effect of dominance rank and habitat was found to be strongest for immature and adult females, moderate for immature males, and absent in adult males ( Fig. 3).

Mother-infant relationship in forest and oil palm plantation
Studying a liation between macaque mothers and their dependent offspring, as well as maternal behaviour encouraging infant independence during the rst six months after infant birth, we found mothers' protectiveness to be strongly in uenced by the habitat the macaques were ranging in.
Speci cally, the proportion of body contact between macaque mothers and their offspring signi cantly differed between habitats, while controlling for infant age and sex, mothers' rank, parity and time of the day (LRT: χ² = 45.01, df = 4, P < 0.001, N = 491 observations of 11 mother-infant pairs, details in Supplementary Table S3). As predicted 46 contact time decreased with infant age, yet the start of this decrease was highly dependent on the habitat (Fig. 4a). Speci cally, body contact between mothers and infants already decreased within the rst month after infant birth in the forest, after one to two months at the plantation edge, and only after approximately three months inside the plantation (Fig. 4a).
Examining the mothers' incentive to facilitate infant independence, we looked at three different maternal behaviours, i.e. mother breaks contact, mother increases distance, and maternal rejection. With a total of only 15 occurrences during focal observations, rejection was very rare in macaque mothers and thus not considered for multivariate analysis. We further recorded 346 contacts broken by mothers and 838 events of mothers increasing the distance to their offspring. Infant age had a non-linear effect on both maternal behaviours, with the highest rates of breaking contact and increasing distance being observed at an age between three to ve and four to six months, respectively (Fig. 4b, c). As indicated by the full-null model comparisons, the rates of both breaking contact and increasing distance, were signi cantly in uenced by the habitat (LRT (breaking contact/increasing distance): χ² = 33.04/51.91, df = 6, P < 0.001, N = 491 observations of 11 mother-infant pairs, Supplementary Table S3). Speci cally, the signi cant interaction between habitat and infant age indicates an earlier increase of mothers' facilitation of infant independence in the forest than in the plantation (Fig. 4b, c).

Discussion
The present study provides important insights into the effects of anthropogenic environments on primate social behaviour, which is crucial to understand a species' ability to coexist with humans. Our results demonstrate the presence of critical behavioural alterations in the macaques' activity while ranging in oil palm plantations, compromising on key social interactions, such as grooming and juvenile social play. Further, we found strong habitat-dependent shifts in the macaques' social network structure, with the central positions of high-ranking adult females and immatures of both sexes being passed to low-ranking individuals during plantation visits. Finally, we found dynamics in the mother-infant relationship, with mothers being more protective in the plantation compared to the forest as indicated by higher proportions of body contact and less maternal behaviour facilitating infant independence. Focusing on interindividual, between-context (forest versus oil palm plantation) variation in behaviour, we ensured a studydesign in which the study groups effectively formed their own 'controls' for our purposes of evaluating the clear effects of anthropogenic disturbance on spatial variation in aspects of animal behaviour that are critical to and underlie individuals' tness.
Our results con rm previous studies, which suggest that oil palm plantations function as foraging grounds for macaques 36,37,47 . Their motivation to range within these monocultures despite increased predation risk, indicated by rates of ight responses ve to ten times higher compared to those observed in the forest, likely lies in the broad abundance of food. Previous studies suggested more frequent plantation visits and extended plantation ranges during periods of lower fruit availability in the forest 47,48 . Further, regular plantation visits may be triggered by the high nutritional value of available food sources, as the macaques do not only feed on palm fruits, but also consume a high number of plantation rats 37 . Yet, highly clumped and energy-rich food sources may also increase competition and consequently fuel aggression among animals 49,50 , as previously shown for urban and semi-provisioned primate groups 11,38 . This was partly con rmed by our ndings, with rates of non-physical aggression being signi cantly increased inside the plantation. However, no such effect was found for physical aggression, which in general is particularly rare in our study species, agreeing with M. nemestrina's intermediate position between despotic (i.e. less tolerant) and egalitarian (i.e. more tolerant) macaque species 34 .
As predicted, rates of a liative social interactions were rare in the oil palm plantation, especially when groups were ranging in plantation areas further than 50 metres from the forest border. Considering the socio-ecological risks posed by plantations (i.e. predation from feral dogs, human contact, and intense feeding competition within groups) the macaques may restrict plantation visits to feeding activities and avoid time-consuming social a liations, which can be carried out more safely in the protected environment of the forest. As previously reported for other primate species, close proximity to humans and/or direct interactions with humans in touristic or urban areas can induce stress in animals 15,51 and signi cantly alter a liative interactions [13][14][15] . Our results add to these ndings by showing that also indirect human impact through the conversion of rainforest into agricultural land can profoundly affect primate sociality. We found rates of both grooming and social play to be close to zero inside the plantation and signi cantly reduced at the plantation edge compared to the natural forest habitat.
However, contrary to our prediction, the number of a liative social partners did not differ between forest and plantation edge. This nding is nonetheless consistent with those by Marty et al. 15 , who revealed that long-tailed macaques (M. fascicularis) living in human-impacted areas in Malaysia spent less time grooming but preserved the same number of grooming partners under time constraints. This retention of partner diversity is critical since both strong connections, i.e. frequent a liative interactions, to an individual's favoured partners, but also a large number of weak connections to many different partners play an important role for individual tness in Cercopithecine primates 52 .
Typically, animal social networks are in uenced not only by individuals' demographic characteristics (e.g.
age-sex class, dominance rank 53,54 ), but also by extrinsic factors like their ecology (reviewed in 55 ) or exposure to human impact 43 , with particularly the latter having been shown to decrease cohesiveness and connectivity of wildlife social networks 42,56 . Here we extend these previous ndings, by revealing how environmental modi cations, despite generating a seemingly uniform reduction in time spent socializing for entire groups (see above), may differentially affect the network connectedness of individual wild animals depending on their socio-demographic characteristics, using EC as a measure of social connectedness. In the forest, we observed a gradient in female centrality, with both high-ranking adult females as well as their immature female offspring being the most central, i.e. socially bestconnected individuals. This is consistent with previous studies, reporting top-ranking females to occupy more central network positions than lower-ranking individuals, as they are attractive social partners (e.g. by providing agonistic support in exchange for grooming 57,58 ). Remarkably, at the planation edge, this relationship was reversed, possibly because high-and low-ranking females may use different strategies to handle the potentially stressful environment and intense feeding competition posed by the plantation. Reacting to time constraints, dominants may compromise on their a liative social connections in order to be more vigilant of competing conspeci cs. At the same time, subordinates may increase their a liative network to gain more tolerance and/or access to energy-rich food sources from dominants. In immature males, we observed a similar, though less strong effect to that observed in females. This is unsurprising, as immature males are still integrated in the maternal network, holding their mothers' dominance status during childhood, yet they already start to grow into their later role as the dispersing sex 27 . In contrast, EC in adult males was not affected by rank and habitat, which may be closely linked to M. nemestrina's dispersal regime 59 . Whereas philopatric females strongly rely on being well integrated into an intact social network in order to survive and successfully raise offspring 22 , dispersing males have generally more peripheral positions within groups 53 .
Behavioural modi cations in the groups' smallest social units can negatively affect both macaque mothers and their offspring. With mothers behaving more protective during plantation visits by increasingly keeping body contact, infant independence may be delayed compared to the macaques' natural behaviour in the forest. Yet, weaning ages in our study groups did not obviously deviate from the broader literature (N. Ruppert, unpublished data) which suggests that weaning in macaques occurs at about 10 to 14 months of age 60 . Additionally, alterations in mother-infant bonds may affect the development of infants in the forest-oil palm matrix. In particular, young males' preparation for their later dispersal may be hampered by prolonged physical proximity between mothers and infants. Further, increased maternal protectiveness may restrict adolescent females' opportunities to handle their adult relatives' infants, and thus to gain and practice maternal skills prior to their rst own offspring 61,62 . Ultimately, the disruption of an intact mother-infant relationship through frequent plantation visits may imply negative consequences for offspring health and survival. Long-term data (2014-2018) from our study groups, whose natural forest habitat have been partly replaced by oil palm plantation already several decades ago, revealed infant mortality within the rst year of life to be approximately 55%, with the highest rate (71%) observed in 2016 (N. Ruppert, unpublished data). This is unexpectedly high, considering that infant mortality in other macaque species ranges between 2.7% and 32% 63-68 . However, our data are not su cient to prove whether infant survival is directly connected to the macaques' ability to cope with human-induced habitat modi cations.
Overall, this study fundamentally contributes to understanding the impact of oil palm cultivation on sociality in wild primates. We observed behavioural plasticity in the macaques' overall network structure through to the smallest social units of the group, demonstrating that anthropogenic impacts, even without frequent direct contact with humans, can severely restrict a liative interactions among macaques and disrupt the mother-infant relationship. High rates of infant mortality may ultimately cause di culties for endangered species to maintain their viable population size. In this context, it is essential to protect the remaining populations and facilitate their coexistence with humans in anthropogenic landscapes. As umbrella species, primates represent a wide range of wildlife that depends on primary rainforest 69 . Hence, their protection will ultimately contribute to maintaining biodiversity and important ecosystem functions of tropical habitats. Unravelling the effects of both direct and indirect anthropogenic disturbances on primate social behaviour can serve as a basis for understanding the degree to which a species can adapt to human-altered habitats and may aid in developing effective conservation strategies and species management plans. Looking at the most important a liative behaviours in primates, our results suggest that proximity to the forest is the key factor for macaques to be able to perform the full range of their natural behavioural repertoire. Maintaining forest corridors, an important conservation tool to create viable interfaces between forests and agricultural landscapes, may therefore not only facilitate natural dispersal and link fragmented wildlife populations affected by monocultures, but also enable animals to display essential social behaviours that directly affect their tness. Ultimately, this will contribute to improving individual well-being and ensuring the long-term survival of primates and other species. 3.1 ± 1.8/2.7 ± 1.8 hours per day 37 ). The annual home ranges of group AMY and VOL were 92.7 and 96.6 hectares, respectively, with used plantation areas accounting for approximately one third of the total home range areas 37 . As group VOL has not been fully habituated before the start of 2018, assessments of the macaques' social network and the mother-infant relationship were performed only on group AMY.

Habitat types
In order to assess the impact of anthropogenic environments on the macaques' social activities, we divided the home range areas of our study groups into three habitat types, i.e. forest, plantation edge and plantation (Supplementary Figure S1). SMFR comprises 2742 hectares of which 408 hectares are strictly protected Virgin Jungle Reserve. Its main vegetation types are dipterocarp lowland forest and alluvial fresh-water swamp 36 . The 420-hectare sized oil palm plantation bordering the reserve was established between 1980 and 1990 and is managed by a federal authority. The oil palm estate was accessible to macaques, with encounters between wildlife and plantation workers being occasionally observed, yet these did not involve regular con icts, such as hunting or chasing. We de ned 'plantation edge' as the plantation area which is located within 50 metres from the forest border, whereas 'plantation' refers to all plantation areas further than 50 metres from the forest border. This distinction was made to account for the fact that plantation areas in close proximity to the forest provide additional shelter and protection for the macaques through close-by forest vegetation. So-called ecotones that form transitional areas between two distinct ecological habitats were reported to be of great environmental importance, potentially serving as speciation and biodiversity centres 71 . We chose the distance of 50 metres according to the average diameter of the macaque groups' dispersion (edge-centre-edge).

Behavioural data collection
We collected data using 30-minute focal animal sampling 72 based on a species-speci c ethogram established for the study species (adapted from 73 ) in the forest, at the plantation edge and inside the plantation. We observed a total of 50 individually recognizable macaques (36 of group AMY, 14 of group VOL). Focal individuals were chosen to represent all age-sex classes. The order of focal observations was randomized, aiming at sampling each individual only once per day. If a focal animal entered another habitat type during a 30-minute sampling protocol or went out of sight for more than ten minutes, this observation was stopped. Incomplete protocols were considered for multivariate analysis if they lasted at least 15 minutes. Total observation time was 724 hours (mean ± SD = 14.5 ± 3.6 hours per subject).
To assess socio-ecological risks posed by forest and plantation habitats, we recorded the frequency and duration of ight behaviour shown by the macaques in response to the presence of potential predators, i.e. humans, feral dogs, birds of prey, snakes or monitor lizards. To provide an overview on shifts in the macaques' overall time budget, we continuously recorded their activity in the different habitats. Recorded activities included feeding (i.e. ingesting food), foraging (i.e. searching for or manipulating food), locomotion (i.e. walking, running, climbing or travelling without other activity), resting (i.e. standing, sitting or lying without other activity, eyes may be open or closed), socializing (i.e. all positive social interactions, e.g., grooming, being groomed and groom presenting, social play and huddling) and others (e.g. sexual and agonistic interactions or self-grooming). To assess individual differences in a liation, we recorded the frequency, measured as rate per hour, and duration of all bouts of grooming and social play between the focal subject and other group members. As measures of frequency and duration were highly correlated (Pearson's r (grooming/social play) = 0.78/0.81, P < 0.001), we considered only frequencies for analyses. Further, we recorded aggressive behaviour exchanged between the focal subject and other group members, considering both physical (i.e. attack, bite, grab, hit, push) and non-physical aggression (i.e. charge, chase, lunge, stare and vocal or open mouth threat). Social data were complemented by ad libitum data 72 on aggression, displacement and submission among adult males and adult females for the purpose of constructing dominance hierarchies (see below). Data on social interactions included information on both the initiator and the recipient. Following previous studies 74 , a repetition of a behaviour was scored as a new bout if more than ten seconds had elapsed between occurrences or at least one partner had switched to a mutually exclusive activity (e.g., from grooming to aggression). During an aggressive event in which a number of different agonistic patterns occurred in quick succession, only the most intense kind of aggression was considered for analyses 74 .
To assess a liative social networks across different habitats, we recorded data on spatial proximity between macaques. We took point time scans 72 every three minutes within the 30-minute sampling protocol, recording all group members in body contact with the focal individual. We further recorded whether or not this contact resulted from an a liative interaction (e.g., during grooming, play or huddling). This was the case for 98.3% of our observations. The total number of scans recorded was 14,205 (mean ± SD = 284 ± 71 scans per subject).
To assess the mother-infant relationship, we additionally observed eleven mother-infant pairs from group AMY in the three different habitats for the rst six months after infant birth. Total observation time was 240 hours (mean ± SD = 21.8 ± 9.4 hours per mother-infant pair). We continuously recorded maternal behaviour promoting infant independence 46 . Speci cally, we recorded the number of contacts broken (i.e. any movements disrupting body contact between mother and infant), increases of distance (i.e. movements increasing the distance between mother and infant from within arm's reach (about 60 cm) to outside of arm's reach) and maternal rejection (i.e. attempts by the infant to make contact that were rejected by the mother, e.g., by turning, running away, or holding the infant at a distance with an arm 46 ). To ensure independence between these measures, increases of distance were only recorded if at least ve seconds elapsed since contacts were broken. To assess spatial proximity in mother-infant pairs, we took point time scans 72 every minute during focal observations, recording whether or not mothers and their infants stayed in body contact, including ventro-ventral contact, nipple holding, side-by-side contact, and grooming.

Individual location data
We collected individual location data with a Garmin GPSMAP62s daily during behavioural observations, with the coordinates of each focal observation being taken at half-time of the respective focal protocol.
Annual home range areas of group AMY and VOL were adopted from Holzner et al. 37  We set argument 'prop' to 'Dij', calculating dyadic win proportions corrected for chance 78 . As in macaques rank acquisition and function typically differ between sexes, with non-natal males ghting for dominance, while females socially inherit the rank of their mothers 79 , we estimated rank orders separately for males and females. Following Kaburu et al. 80 , we controlled for differences in group size and sex ratio by standardizing dominance rank as '(Rank-1)/(N-1)', where N represents the number of focal animals per group and sex class. Standardized dominance rank values range from zero (top-ranking individual) to one (bottom-ranking individual). Referring to literature 81 , immature males and females got assigned the same rank as their biological mother, or, if their mother already died, the rank of their closest adult female relative.
As David's scores do not account for potential temporal uctuations in rank orders, we further assessed rank stability using the function stab.elo of the package 'EloRating' (version 0.46.8 77 ). Indices range between zero (unstable) and one (stable), re ecting to what extent rank positions of individuals change over time. Males and females of both groups displayed stability indices close to one (males (AMY) = 0.9950, females (AMY) = 0.9956, males (VOL) = 0.9909, females (VOL) = 0.9943), suggesting highly stable dominance hierarchies during the sampling period in both sexes. Therefore, David's scores seem to be appropriate for estimating dominance ranks in our study groups.

Social network analysis
Based on a liative interactions observed during individual focal sampling, we constructed the social network of group AMY separately for forest and plantation habitats. Following Lehmann et al. 29 , we assessed dyadic a liation as the proportion of scans two individuals were in social contact (i.e. grooming, social play or a liative body contact). We created social networks in R version 3.4.4 (R Core Team 2020) using an undirected data structure with the function graph_from_data_frame from the package 'igraph' (version 1.2.5 82 ). For each individual, we extracted the binary degree and eigenvector centrality (EC), two commonly used network parameters to quantify individual social connectedness 39,29 .
The binary degree re ects an individual's overall number of interaction partners, while EC is a measure of both direct and indirect network ties, re ecting a node's importance while considering the importance of its neighbours. Thus, a high value of EC suggests that an individual has many social partners who themselves also have many partners. While considering raw counts for binary degree, with regard to EC we were particularly interested in an individual's connectedness in relation to other group members. We therefore rescaled the obtained values of EC in each habitat to get percentile scores lying between zero (minimum) and one (maximum).

Statistical Analysis
Multivariate statistical analyses assessing the impact of different habitats on the frequencies of a liation and aggression (models 1 to 4), social network connectedness (models 5 and 6), and the mother-infant relationship (models 7 to 9) were conducted in R version 3.4.4 (R Core Team 2020) using Social network connectedness (models 5 and 6): To investigate the impact of the habitat on two common network parameters, i.e. the binary degree and EC de ned above, we constructed two GLMMs 83 with Poisson and Gaussian error structure, respectively. As response variables we used the individuals' binary degree (model 5) and scaled EC (model 6) in each habitat (N = 68 observations of 34 individuals). We included the habitat (forest or plantation edge) and its interactions with individual dominance rank and age-sex class (as de ned above) as xed effects and the focal individual ID as random effect. Controlling for differences in the sampling effort, we further included the total number of point time scans per individual as an offset term into model 5 89 . To test the effect of different habitats on the binary degree and EC, we performed LRTs 86 , comparing the full models with respective reduced models lacking our test predictor (habitat) and its interactions with dominance rank and age-sex class.
To account for interdependency of network measures used as outcome variables in our GLMMs, we used a node-swapping permutation approach, based on 1,000 permutations of the outcome variables 90 . This included recalculating the network parameters after randomly swapping the nodes of the original networks. We used node-swapping (as opposed to generating random graphs or using pre-network 'edgeswapping' randomizations) since this approach seemed better suited for our purposes of testing regression-based null hypotheses in a taxon with a largely stable group composition and relatively low observation biases 44,45 . Speci cally, node-swapping preserves the overall size, number of connections, and structure of the network, thereby also preserving the overall distribution of node-level measures such as degree and EC. It is therefore a more conservative approach that may be less susceptible to Type I errors, compared to random graph generation or edge-swapping 44,45 . After each permuted swapping event, we re t the same GLMM using these newly created parameters as response variable. Comparing the observed model coe cients with the distribution of the 1,000 permuted coe cients, we calculated pvalues as the number of times the coe cient value of the observed network is smaller than a randomized network, divided by the number of randomizations 90 .
Mother-infant relationship (models 7 to 9): To investigate the impact of the habitat on the mother-infant non-contacts per individual as the response 83 . Models 8 and 9 were created using a count response with Poisson error structure and log link function. Here, we controlled for differences in the sampling effort by including the duration of each focal observation as an offset term 89 . In all three models, we included the habitat (forest, plantation edge or plantation) as a xed effect test predictor, while controlling for infant and maternal characteristics, which were previously shown to affect the mother-infant bond, i.e. infant age 46 and sex (male or female 33 ), as well as maternal rank and parity (primiparous or multiparous 31,32 ). As in models 1-4, we accounted for changes in the overall group activity over the day by including the time of the day as xed effect control predictor. Further, we included the mother-infant pair and sampling date as well as the combination of these two as random effects, as mother-infant pairs were frequently observed more than once on a given day. Additionally, we included the random slopes of habitat, infant age and time of the day within the mother-infant pair 86,88 . As we expected infant age to have a non-linear effect on the rates of maternal breaking contact and increasing distance, we additionally incorporated squared infant age into models 8 and 9. Further, we included the two-way interaction between habitat and infant age in model 7, and its interactions with infant age and squared infant age in models 8 and 9. To test the effect of different habitats, we compared the full models with the respective reduced models lacking our test predictor (habitat) and its interactions with infant age and squared infant age, respectively, using LRTs 86 . In case of a non-signi cant interaction, we re-ran the model without the interaction term to facilitate the interpretation of the main effects in the model.
For models 1 to 9, we assessed model stability by excluding the levels of the random effects one at a time and comparing the estimates from the obtained models with the estimates from the model based on all data using a self-written R function provided by Roger Mundry. This did not indicate any obviously in uential case. To rule out collinearity, we determined Variance In ation Factors (VIFs) for respective standard linear models excluding the random effects using the function vif of the package 'car' (version 3.0.2 91 ). According to these, none of the models indicated issues regarding collinearity (all VIFs < 1.16). We con rmed that overdispersion was no issue in all models with a Poisson (models 1-4, 5, 8, 9)  We obtained permits to enter the forest reserve bordering the oil palm plantation from the Forestry Department Peninsular Malaysia (permit holder: Asyraf Mansor, School of Biological Sciences, Universiti Sains Malaysia). No written permit was needed to enter the plantations, but we informed the local management about the study. This non-invasive study was conducted in line with Universiti Sains Malaysia's animal ethics requirements.

Declarations
Data availability The data that support the ndings of this study will be made available online. Figure 1 Activity budgets of Southern pig-tailed macaques in forest and oil palm plantation. The boxplots indicate the median values and percentiles of individual proportions of time spent for foraging and feeding, locomotion, resting, socializing and other behaviours (e.g. self-directed behaviour, agonistic behaviour, mating), separately for forest, plantation edge and plantation. Circles represent outliers. The sample comprised a total of 50 individuals belonging to two social groups. territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. This map has been provided by the authors.