Introduction
Habitat complexity, defined as the physical structure of the habitat (Carter et al., 2018), significantly influences species assembly and their interactions within a community, ranging from parasite-host dynamics to food webs and predator-prey interactions (Carter et al., 2018; Kovalenko et al., 2012; Staniczenko et al., 2017). Species interactions may be enhanced in habitats with high complexity, as the abundant microhabitats and resources support a greater number and diversity of species (Maldonado-Coelho & Marini, 2000; Maldonado-Coelho & Marini, 2004). Community interactions are often assessed under the assumption of homogeneity in individual and habitat structure, overlooking their variations and leading to incomplete insights or unrealistic interpretations (Carter et al., 2018). Therefore, it is crucial to consider this variation, as heterogeneity is essential for understanding the drivers of complex communities (Carter et al., 2018; Gibert & Brassil, 2014; Mokross et al., 2018). This is particularly relevant when studying bird communities, which not only utilize habitat structures differently but also tend to form complex interspecies associations, such as mixed-species flocks within these habitats (Jones & Robinson, 2021).
Mixed-species flocks of birds are among the most common and interactive group systems in nature (Goodale et al., 2020; Morse, 1970). These flocks are dynamic assemblages with both positive and negative interactions (Goodale et al., 2020). Understanding how they are established, maintain cohesion, and interact intra-specifically (Jones et al., 2020) is central to community ecology. The most commonly reported interactions within mixed-species flocks include behavioral interactions (Morse, 1970), role turnovers (Farine, 2021), and species facilitation in joining the flock (Martínez et al., 2018; Muñoz 2022). Role turnovers within the flock occur when the relative population of a species increases in the area, like Atlapetes tibialis that becomes a gregarious species outside the breeding season and assumes a leadership role in mixed-species flocks (Muñoz 2022). Facilitation occurs when members of the flock display behaviors that trigger flocking, such as specific vocalizations (Pagani-Nuñez et al., 2018), and can also result from external factors like habitat complexity (Croft et al., 2011; Goodale et al., 2010).
Habitat complexity may facilitate flocking behavior in various ways. For instance, specific habitat traits (e.g., background conspicuousness) influence signal transmission and its reception by conspecifics and heterospecifics (Munn, 1985; Uy & Stein, 2007). Moreover, habitat structural traits, such as forest height and area size, influence the gregariousness of mixed-species flocks (Mokross et al., 2014), as they can physically limit the number and identity of species joining a flock and affect the cost-benefit tradeoff for potential flock members. For example, the absence of larger trees limits the occurrence of woodcreepers, which used them to forage or establish a territory (Darrah & Smith, 2013; Maldonado-Coelho & Marini, 2000), while the lack of dense understory restricts wrens and antbirds that rarely move into open areas (Mokross et al., 2018). Other aspects of forest structure that might affect mixed-species flock composition, such as resource availability (e.g., fruits or flowers), shelter (e.g., abundance and size of trees), or specialized foraging structures (e.g., dense understory, canopy cover), have not been fully considered (Hutto, 1988; Jones, & Robinson, 2021; Kotagama & Goodale, 2004; Mangini et al., 2023b). Changes in these habitat traits may trigger composition effects on mixed-species flock structure. Reduced availability of understory resources may decrease the complexity of mixed-species flocks by reducing the overall foraging efficiency of bird species (Hutto, 1988). Additionally, a complex habitat structure with a higher canopy and cover may provide more usable habitat space for bird species when moving in a mixed-species flock (Mokross et al., 2014). Changes in habitat complexity, such as higher or lower understory cover, can also limit the species that can potentially join the mixed-species flock due to reduction of forest cover for them (Rutt et al., 2020).
Habitat complexity varies significantly not only at a large scale, but also over short distances within the same area (Rutt et al., 2020) and this will affect directly the composition and level of association of mixed-species flocks. Our objective is therefore to describe the correlation between the composition and occurrence sites of mixed-species flocks with the habitat complexity (structure) of a highland forest. Costa Rican highlands are suitable to answer this question because they present mixed-species flocks all year round with its members interacting among them at all times (Powell, 1979; Powell, 1985). In addition, tropical mixed-species flocks tend to use all forest structures present in its habitat, like branches, trunks, mosses, understory cover, and treetops (Powell, 1985).
Materials and methods
We conducted this study along a 5.5 km transect (Fig. 1) in the highland area of Braulio Carrillo National Park in Heredia, Costa Rica (10°05’N & 84°04’W; 2100 m a.s.l.) from March to December 2019. The study area includes a mix of oak (Quercus sp.) and Andean alder (Alnus acuminata) forest, secondary growth areas (dominated by bamboos, Malvaceae’s trees and bushes, and Ericaceae bushes), and several disturbed areas featuring pastures, peat bogs, and isolated trees. These features create a heterogeneous landscape that allowed comparisons between mixed-species flocks structure according to the habitat composition.

Fig. 1 A. The red dot is the study location area in Costa Rica. B. Study area map with the transect used for sampleing highlited in white.
We searched for mixed-species flocks twice per week from 06:00 to 11:00 h, along the transect (Fig. 1). To minimize potential biases related to time and location, we alternated the starting point each day, beginning each sampling session at the opposite end of the transect from the previous one. Whenever we encountered a flock, we followed for 10 min and recorded the maximum number of individuals per species during this time period. The geographical position of each flock was recorded at the beginning and end of this period using a Garmin 64s GPS device.
We separated the mixed-species flocks in three groups based on the number of individuals and species (Chen & Hsieh, 2002; Mangini et al., 2023a). Small-size mixed-species flocks included <4 species or <8 individuals. Medium-size mixed-species flocks included 5-6 species or 9-11 individuals. Large-size mixed-species flocks included >7 species or >12 individuals. This imformation allowed us to compare if size of mixed-species flocks size varied according to habitat structure and characteristics.
Relationship between flocks and habitats: To measure habitat complexity traits, we used 16 plots of 10x10 m distributed across the study area to cover most common habitat types present (Fig. 1). Half of the plots were located near the transect (<50 m from the transect edge) where mixed-species flocks were sampled, and the other half of the plots were located at least 200 m away from the transects. We placed the plots ensuring a minimum distance of 200 m between them and to have four replicates in each habitat types present in the study area: pastures/peat bogs, old-growth forest, forest plantation, and secondary forest. In each plot, we counted all trees with the diameter at breast height (DBH) greater than 10 cm and measured the exact DBH for each one. We recorded canopy height at three points within the plot (one at the center and two sides) using a laser rangefinder. Additionally, we selected four equidistant 1x1 m sub-plots within each plot and estimated understory coverage as a percentage of ground cover by dead leaves, branches, and plants, but not grasses. Finally, we measured the leaf area index (LAI) using five photos per plot, following the method published by Martin (2015). The photos were taken with a Canon SL1 camera and an 18-55 mm lens: four photos directed at each cardinal point at a 45-degree angle and one photo at a 90-degree angle towards the canopy. For the eight plots near the trail, we placed 1x1 m sub-plots to measure understory cover at each of the four corners of the 10x10 m plots. For the eight plots farther from the trail, we positioned the 1x1 m sub-plots along the sides of the 10x10 m plots, midway between each corner. Using the data gathered from all 16 plots, we interpolated habitat structure traits to the rest of the un-sampled area using the inverse distance weighting method in QGIS (QGIS Development Team, 2021). This created a separate layer for each habitat structure trait measured, covering the entire study area (Fig. 2), and allowed us to: 1) determine the suitability of different habitat structures in the study area for each mixed-species flock, and 2) assign the habitat structure where each observed flock occurred.

Fig. 2 Inverse weighted interpolations of habitat structure variables for the whole area; A. Understory cover, B. Tree height, C. Diameter at breast height, D. Number of trees, and E) Leaf area index. Red indicates higher values of the variable, while the blue indicates lower values of the variable.
Before analyzing the mixed-species flock occurrence, we ensured that each flock included in the analysis were at least 10 m apart from other flock. We used this distance because the predictor layers employed were interpolated to 10x10 m pixels. We estimated the probability of occurences of each mixed-species flock size group in the study area using kernel density estimation in QGIS (QGIS Development Team, 2021). For this, we mapped the occurences of each mixed-species flock size on top the five cover layers of habitat complexity (see above), and created three probability map models, one for each mixed-species flock size. Finally, we used the GPS position of each mixed-species flock to quantify its occurrence in each main habitat of the study area: pasture/peat bogs, old-growth, forest plantation, and secondary forest; according to habitat observed in Google maps on January 2020, and in cases where habitat was covered by clouds we assigned the category of unknown habitat.
Statistical analysis: First, we conducted three chi-square test to compare if each mixed-species flock group-size used different the main habitats (i.e., pasture/peatbogs, old-growth, forest plantation, and secondary forest). Second, we compared if the habitat structure where each mixed-species flock group-size occurred varied using a multiple analysis of variance (MANOVA). For this analysis, we used as our independent variable the flock size category. We used as dependent variables the values of each of the five habitat structure measurements (i.e., DBH, canopy height, tree abundance, understory coverage, and LAI) where each flock occurred. This value was estimated using the layer for each habitat strcture trait built using the inverse distance weighting method in QGIS. For this analysis, we used a posterior comparison to report which habitat structure variable were diferent between mixed-species flock group-size. Third, we conducted a non-metric multidimensional scaling (NMDS) analysis with Euclidian distance and 10 000 permutations to compare if the mixed-species flock groups varied in composition (i.e., species and abundance) and its relationship with the five habitat structure variables. Finally, we used a one-way PERMANOVA to analyze if the three mixed-species flock groups were significantly different in the NMDS, and with pair-wise comparison we analyzed differences between flock sizes. All statistical analysis were conducted using PAST 4.17 (https://www.nhm.uio.no/english/research/resources/past/).
Results
We recorded 34 species in 127 mixed-species flocks, with 51 classified as small-size, 46 as medium-size, and 30 as large-size (Table 1, Appendix 1). We found that each mixed-species flock size used differently the four main habitats in the study area. Small-size mixed-species flocks used in similar frequency the four main habitats of the study site (Χ² = 0.80, df = 3, P = 0.85; Table 1). Medium-sized mixed-species flocks used more old-growth and forest plantations than the other two main habitats (Χ² = 8.84, df = 3, P = 0.03; Table 1). Meanwhile, large-size mixed-species flocks used more forest plantations and pasture/peat bog habitats than the other two main habitats (Χ² = 12.30, df = 3, P = 0.006; Table 1).
Table 1 Percentage of occurrence of mixed-species flock size in different habitat types.
| Habitat Type | Small (%) | Medium (%) | Large (%) |
| Pasture/Peatbogs | 20.8 | 15.7 | 34 |
| Old-growth | 23.1 | 27.8 | 14.9 |
| Forest Plantation | 19.8 | 32.5 | 40.4 |
| Secondary Forest | 15.4 | 7.2 | 2.1 |
| Unknown | 20.8 | 16.9 | 8.5 |
Each mixed-species flock group sizes occurred in sites with different habitat structure according to the five measurements took (MANOVA: Wilk’s λ = 0.92, F8,438 = 2.26, P = 0.02; Fig. 3). Among the habitat structure variables analyzed independently with the posterior comparisons of the MANOVA, only the diameter at breast height (DBH) showed a significant difference between mixed-species flock group sizes (F2, 222 = 3.70, P = 0.03). Large-size mixed-species flocks were more often found in sites with larger DBH compared to the other two mixed-species flock group sizes (Fig. 4). Meanwhile, the mixed-species flock group sizes used sites with similar values for the other four habitat structure variables (F2,222 < 0.82, P > 0.44 for all variables; Fig. 4).

Fig. 3 Kernel density estimation models for A. Small-sized, B. Medium-sized, and C. Large-sized mixed-species flocks. Red indicates higher probabilities that each flock size occur in that site, while blue indicates lower probabilities of the occurrence.

Fig. 4 Non-Metric Multidimensional Scaling (NMDS) plot showing the position of different mixed-species flocks sizes and its relationship with the habitat complexity variables. Error bars represent one standar error in both axes.
We found a positive association between higher canopy and understory cover, tree quantity, and DBH with species composition and abundance per species in large-size mixed-species flocks (PERMANOVA: F = 4.60, P < 0.001; Fig. 4). However, small and medium-size mixed-species flocks were associated with sites that showed higher values of leaf area index (LAI; Fig. 4). Additionally, small and medium-size mixed-species flocks had similar species composition and abundance per species (pairwise comparison: P = 0.13), but both differed significantly from large-size mixed-species flocks (small vs. large: P < 0.001, medium vs. large: P < 0.001; Fig. 4).
Discussion
Habitat structure affects the size of flocks that occur in different sites of the study area. This pattern was expected, since more complex habitat structures facilitate larger mixed-species flocks by accommodating species with varying microhabitat preferences, such as understory specialists or foraging specialists (Zhang et al., 2013; Zuluaga & Rodewald, 2015). For instance, woodcreepers require large trees with mosses and bromeliads, commonly found in old secondary forests and plantations in the study area, to join the flocks (Cintra et al., 2006; Rodrigues et al., 2016). Additionally, wrens need dense understories to establish territories and join flocks as they pass through (Caro et al., 2013; Shogren et al., 2019). Consequently, habitats with a greater variety of complex structures (e.g., higher canopy and understory coverage, and more trees) allowed more species to join the flocks. This explain why we observed more medium and large mixed-species flocks in areas with forest plantations and old-growth forests (Zuluaga & Rodewald, 2015). However, large mixed-species flocks were also found in higher numbers in open disturbed areas (i.e., pastures/peat bogs), which have less complex habitat characteristics (Harris et al., 2018; Lindgren et al., 2018). This fiding can be explained by the fact that large flocks in open areas increased in size by adding more individuals of the same species, rather than different species as seen in forest habitats (pers. obs.). This occurs because species that inhabit in open areas (i.e., mixed-species core species) and form mixed-species flocks are typically more numerous such as chlorospingus and warblers (Blake & Loiselle, 2001). Contrary to previous reports from another tropical forest, where flock complexity (i.e., more individuals and species) increased on advanced forest successional stages (Zhang et al., 2013). Consequently, our highland mixed-species flock system showed that large-size flocks may occurr on both old forest plantations and peat bogs
Conversely, small mixed-species flocks occurred in similar abundance across all habitat types. This is because the core species that form Costa Rican highland mixed-species flocks (e.g., Tangara dowii, Chlorospingus pileatus, Margarornis rubiginosus, and Atlapetes tibialis, Appendix 1) are present in all habitats, including open areas, forest edges, secondary forests, and plantations (Barrantes, 2009; Barrantes et al., 2011; Stiles & Skutch, 1989). Additionally, species from genera that did not usually involve in mixed-species flocks in lowlands as Turdus, Piranga and Atlapetes that are common in open areas and secondary forest canopies also join mixed-species flocks (Bohórquez, 2003, Powell, 1979, Stiles & Skutch, 1989), probably because increase the food intake and decrease the probabilities of predation (Hino, 2000; Mangini et al., 2023b). Consequently, mixed-species flocks occurrences are not limited by habitat structure in highlands (Barrantes et al., 2011) and occurred in all the sites, allowing small-size flocks use all habitats available in the study area.
When comparing habitat complexity and its relationship with flock composition, we found that medium and large-sized flocks did not respond uniformly and used microhabitat inside the four habitat types of the study area differently. While, medium-sized flocks were more similar in structure and habitat use to small-sized flocks. This similarity may be due to both flock sizes sharing more species and having similar numbers of individuals per species (Appendix 1), especially if both are primarily composed of core flock species that tend to forage on substrates such as isolated trees, forest edges, and mature forests (Barrantes & Pereira, 2002; Stiles & Skutch, 1989). Abrupt changes in habitat structure over short distances (e.g., transitioning from old-growth forest or forest plantation to open areas), as observed in the study area (Fig. 1), affected the number of species in our mixed-species flocks but not the number of individuals. Forest-dependent species (e.g., woodcreepers, tapaculos, wrens) would abandon the mixed-species flocks upon reaching open areas (Rutt et al., 2020), while core species continued foraging together across different habitats. Consequently, the number and type of species that form small and medium-size flocks were more similar to each other than to larger flocks. In other environments, such as the Amazonian lowlands, abrupt changes in habitat structure generally limit the movement of mixed-species flocks because their core species are more forest-dependent than what we found for Costa Rican highland species (Rutt et al., 2020). Therefore, on those sites mixed-species flocks composition in each habitat type are different, showing a greater association between the species that form the mixed-species flocks and the habitats in which they occur (Zhang et al., 2013).
We concluded that the presence of mixed-species flocks as a whole was not limited by forest structures in the study area, but their sizes and composition were associated with habitat complexity. Forest structures with more microhabitats for species to forage may enhance the occurrence of large-size mixed-species flocks in an area. A core set of species that joined mixed-species flocks are consistent across all forest types and flock sizes, which may explain why these flocks were present throughout the study area. Forest structure likely might also affect the number and type of interactions of a flock members, but this is an aspect the remain understudied (Zhang et al., 2013).
Ethical statement: the authors declare that they all agree with this publication and made significant contributions; that there is no conflict of interest of any kind; and that we followed all pertinent ethical and legal procedures and requirements. All financial sources are fully and clearly stated in the acknowledgments section. A signed document has been filed in the journal archives.











uBio 


