Social network analysis to predict social behavior in dairy cattle

: Dairy cattle are frequently housed in free stalls with limited space, impacting social interactions between individuals. Social behavior in dairy cattle is gaining recognition as a valuable tool for identifying sick animals, but its application is hampered by the complexities of analyzing social interactions in intensive housing systems. In this context, precision livestock technologies present the opportunity to continuously monitor dyadic spatial associations on dairy farms. The aim of this study is to evaluate the accuracy of predicting social behavior of dairy cows using social network analysis. Daily social networks were built using the position data from 149 cows over 14 consecutive days of the study period. We applied the separable temporal exponential random graph models to estimate the likelihood of formation and persistence of social contacts between dairy cows individually and to predict the social network on the subsequent day. The correlation between the individual degree centrality values, the number of established social contacts per individual, between the predicted and observed networks ranged from 0.22 to 0.49 when the structural information from network triangles was included in the model. This study presents a novel approach for predicting animal social behavior in intensive housing systems using spatial association information obtained from a real-time location system. The results indicate the potential of this approach as a crucial step toward the larger goal of identifying disruptions in dairy cows expected social behavior.

The list of standard abbreviations for JDS Communications is available at adsa.org/jdsc-abbreviations-24.
Abstract: Dairy cattle are frequently housed in free stalls with limited space, impacting social interactions between individuals.Social behavior in dairy cattle is gaining recognition as a valuable tool for identifying sick animals, but its application is hampered by the complexities of analyzing social interactions in intensive housing systems.In this context, precision livestock technologies present the opportunity to continuously monitor dyadic spatial associations on dairy farms.The aim of this study is to evaluate the accuracy of predicting social behavior of dairy cows using social network analysis.Daily social networks were built using the position data from 149 cows over 14 consecutive days of the study period.We applied the separable temporal exponential random graph models to estimate the likelihood of formation and persistence of social contacts between dairy cows individually and to predict the social network on the subsequent day.The correlation between the individual degree centrality values, the number of established social contacts per individual, between the predicted and observed networks ranged from 0.22 to 0.49 when the structural information from network triangles was included in the model.This study presents a novel approach for predicting animal social behavior in intensive housing systems using spatial association information obtained from a real-time location system.The results indicate the potential of this approach as a crucial step toward the larger goal of identifying disruptions in dairy cows expected social behavior.D airy cattle are frequently housed in free stalls with restricted space, leading to inevitable and often limited social interactions between individuals.Dairy cattle can develop meaningful social relationships, and the expression of this innate behavior is paramount to their well-being (Fraser et al., 1997;Beaver et al., 2020).Disruption of social relationships may induce stress, prompting aggressive and anomalous behaviors that may ultimately have long-term health consequences (Grant and Albright, 2001;von Keyserlingk et al., 2008).Social bonding in dairy cattle can play a key role in disease susceptibility (Huzzey et al., 2007;Kappeler et al., 2015).In addition, sick animals often exhibit sickness behavior, which can include a decrease in general activity, food intake and social behavior (Dantzer and Kelley, 2007).Consequently, social behavior is becoming an increasingly recognized tool for identifying sick animals (Weary et al., 2009).However, the detection of abnormal social behavior is challenging due to the limited possibilities for animal isolation in intensive housing systems (Proudfoot et al., 2012).In this context, precision livestock farming technologies, such as real-time location systems (RTLS), allow continuous monitoring of dyadic spatial associations on dairy farms.The utilization of RTLS information provides valuable insights into the social contacts of dairy cattle, even within the confines of intensive housing systems.Social network analysis has been described as an appropriate tool for understanding in detail the dynamics of dyadic social interaction information provided by these systems (Wey et al., 2008).Using this approach, previous studies have described a short-term stability (i.e., 2 weeks) of the role of dairy cows within the social networks (Hansson et al., 2023;Marina et al., 2023).
The aim of this study was to assess the accuracy of predicting social behavior in dairy cows by applying social network analysis utilizing RTLS information.Anticipating social behavior may allow the detection of abnormal animal behavior and the causes related to it.The authors declare that according to the Swedish Animal Welfare Act, no ethical approval is needed for this type of study.
This study was conducted on a commercial non-insulated freestall farm that houses around 210 dairy cows (Figure 1).The barn is divided into 2 different management groups.Cows were routinely switched between groups at approximately 170 d in milk, hence these 2 lactation groups are referred to as the early and late lactation groups, respectively.The dairy cows were milked twice a day in a 2 × 12 milking parlor from GEA Farm Technologies.Further information on farm management characteristics can be found in Hansson et al. (2023).Individual cow information on age, pedigree, was extracted from the Swedish official milk recording scheme, whereas information about parity was provided by the farm.The parity variable was categorized into 3 classes (1,2, and 3+).Of the total number of lactating dairy cows housed on this farm, only 149 cows that were present in one of the lactation groups for the entire studied period and had information on all characteristics (73 cows in the early lactation group and 76 cows in the late lactation group) were included in the analyses.The lactating cows were equipped with a tag mounted on their collars, which allowed the automatic collection of position data with a

Social network analysis to predict social behavior in dairy cattle
H. Marina,1* W. F. Fikse, 2 and L. Rönnegård134 1-s fix rate using an ultra-wideband RTLS (CowView, GEA Farm Technologies), with an accuracy of 0.78m (Hansson et al., 2023).The present study includes 14 d of positioning data (from October 16 to 29, 2020).During this period, data missing averaged 33.34% (~8 h/d), with the most common scenario being a single second missing.Missing position information was interpolated by applying the Modified Akima Interpolation (Akima, 1970) implemented in MATLAB (MATLAB, 2020) following Ren et al. (2022).All missing positions were filled after the interpolation procedure.R statistical software version 4.2.0 (R Core Team, 2022) was used for subsequent analyses.The source code utilized is publicly available at https: / / github .com/CSI -DT/ SNA .
The barn area was divided into 2 functional areas: the resting area, consisting of the cubicles in the center of the barn and the inner alleys, and the feeding area, consisting of the feeding tables and outer alleys.The time each cow spent with the rest of the herd within a 2.5 m radius was quantified per functional area using posi-tion data.The justification for this distance threshold is derived from the average cubicle width of 1.25 m in the resting area, thus the maximum distance between 2 cows lying in consecutive cubicles would be approximately 2.5 m.To avoid stochastic contacts, we filtered out daily contacts between cows of less than 600 s (10 min).Previous studies conducted by our research group have described no effects of varying the time and distance thresholds on the results obtained from different models (Hansson et al., 2023;Marina et al., 2023).Previous studies found that affiliative social interactions were positively correlated with prolonged proximity contacts in dairy cows and calves, whereas short encounters were associated with agonistic interactions only in calves (Boyland et al., 2016;Ben-Meir et al., 2023).This supports the use of this method for measuring social contacts in dairy cattle.Daily social networks were constructed using position information from 149 cows selected over 14 consecutive days of the study period via the SNA package (Butts, 2020).The pedigree information concerning the 149 cows comprised a total of 8,594 animals over 22 generations.This information was used to estimate the additive relationship matrix.Age information was used to estimate the kindergarten effect following Marina et al. (2023).The kindergarten effect is a binary variable, having the value 1 if both cows were born 7 d apart on the same farm, and 0 otherwise.
Social networks were visualized as sociograms using the igraph package (Csárdi and Nepusz, 2006), with nodes representing individual cows, and spatial contacts between cows represented in a binary format.Further, to determine the optimal number of days to consider in models predicting social behavior, we estimated the pairwise graph correlation between the daily social networks within each functional area and lactation group (e.g., 1-2, 1-3, …, 13-14).Graph correlation determines the similarity between 2 network graphs by dividing the covariance of the adjacency matrices by their standard deviations.The resulting statistic can be interpreted as a standard Pearson's product-moment correlation coefficient (Gjesfjeld, 2015).The dynamic social networks were modeled using separable temporal exponential random graph models (STERGM) described by Krivitsky and Handcock (2010).The STERGM approach models the probability of a new spatial contact given that there was no contact on the previous day (formation) and the probability of a spatial contact given that it was established on the previous day (persistence).Formation and persistence events were modeled including fixed effects of parity of both cows in the dyad, additive genetic relationship between both cows (estimated using pedigree information) and the kindergarten effect.The homophily effects of parity, kindergarten effect and kinship relationships on the likelihood of formation and persistence of social contacts in dairy cattle have been described by Marina et al. (2023).In network analysis, variables representing information external to the network are classified as exogenous variables (e.g., cow information), whereas endogenous variables refer to factors determined by the structure of the network itself (e.g., number of triangles in the network).
In this study, the model was fitted incorporating these exogenous variables (M1), and further enhancing it by integrating the structural information of network triangles (M2).A triangle consists of 3 nodes, each of which is connected to the other 2 nodes.Incorporating triangles into network analysis can assist in understanding important structural properties of networks (Durak et al., 2012).Further explanations about the STERGM method can  G2) lactation, where y and x represent the direction of the y-axis and x-axis, respectively.The cubicles are in the center of the barn and the feeding tables are on either side.The beige area is outside the boundaries of the cows in the milking group, except for transport between the pen area and the milking parlor.
be found in Marina et al. (2023).The model was fitted separately for each functional area and lactation group using sliding windows of 5 consecutive days.The utilization of a 5-d window length was determined by the decreasing trend in the graph correlation between the social networks over time, as shown below.Moreover, window lengths below 5 d led to stronger convergence problems in the M2.STERGM estimates were used to predict the animals' social behavior on the subsequent day.Social contacts were predicted individually based on the likelihood of occurrence of each dyad, derived from the estimates of formation and persistence calculated by STERGM and the information on the previous network structure.A total of 100 networks were generated per prediction scenario.In addition, to compare these results with a naïve model, the animal identifications of the consecutive networks were randomly permuted 100 times.
The accuracy of network predictions was assessed by correlation analysis, including graph correlation and degree centrality correlation with the observed network.On the one hand, the graph correlation offers valuable insights into the accuracy of predicting the specific social contacts between dairy cows within the herd.On the other hand, the Spearman correlation of the degree centrality values examines the total number of social contacts established by individual nodes.Gjesfjeld (2015) described how 3 common centrality parameters (degree, betweenness and eigenvector) vary when different nodes were excluded from the network.Degree exhibited robust stability when specific individuals were removed from the network.Commercial dairy farms usually group cows by stage of lactation, which leads to regrouping of animals (Grant and Albright, 2001;Hu et al., 2023).Hence, degree centrality is a suitable parameter to generate insights into the accuracy of predicting the social roles of dairy cows.
The pairwise graph correlation between the daily social networks revealed that as the temporal distance between the compared days increased, the corresponding graph correlation values decreased (Figure 2).This decrease in graph correlation values over time supports a progression in the dynamics of the social networks.Based on these observations, sliding windows of 5 consecutive days were fitted in the prediction model.The higher similarity observed between consecutive social networks suggests the potential for shortterm prediction of social network structure and individual social behavior.
The utilization of 5-d sliding windows for prediction resulted in 9 predicted scenarios for each lactation group and functional area.Out of the 36 prediction scenarios fitted per model, all converged successfully for M1, while 11 scenarios failed to converge for M2.In the early lactation group, 7 scenarios did not converge for the resting area.In the late lactation group, 2 scenarios did not converge for each functional area.Only models that converged were compared in this study.The reduced number of days considered in the model could have led to model degeneracy when triadic terms (triangles) are included in the model, particularly within networks characterized by high levels of structural heterogeneity (e.g., dense regions with many triangles or high-degree nodes mixed with lowdensity regions) (O'Malley and Marsden, 2008).Such structural complexity may impede model convergence.To address potential degeneracy, one approach is to increase either the number of days or individuals considered in the analysis.However, increasing the number of days considered in the model could compromise the accuracy of the prediction as it may not reflect the dynamic nature of social relationships in cattle.
STERGM estimates and the prior network state were used to generate 100 social networks per prediction scenario.Across all converged scenarios, the average graph correlation values ranged from 0.01 to 0.12, accompanied by standard deviations from 0.01 to 0.02.Recall that the graph correlations between social networks from consecutive days were lower than 0.20 (Figure 2).Similarly, degree centrality correlation values spanned from 0.06 to 0.49, with corresponding standard deviations varying from 0.06 to 0.12.In addition, the accuracy of the betweenness and eigenvector centrality parameters was also examined, giving very similar results to those obtained for degree centrality (data not shown).Moreover, the average values reported by the naïve model for graph correlation and degree centrality correlation were 0.00 and −0.01, with standard deviations of 0.02 and 0.12, respectively.The difference in accuracy results between graph correlation and degree centrality correlations is because the graph correlation evaluates the accuracy of predicting specific dyads within the network, whereas degree centrality only quantifies the prediction of the total number of social contacts.Although a superior predictive accuracy was achieved for degree centrality, it is noteworthy that cows form preferential relationships with similar and familiar individuals (Marina et al., 2023;Vázquez-Diosdado et al., 2023).Hence, the use of specific dyads information in combination with the total number of social contacts emerges as the most promising approach to detect disruptions in social behavior.
Across all converged scenarios, M2 achieved superior performance, with higher graph and degree centrality correlations and lower standard deviations in accuracy results compared with M1 (Figure 3).Including this structural information substantially increased the degree centrality correlation values, with results ranging from 0.22 to 0.49 (Figure 3).These outcomes highlight the importance of considering the structural information of network triangles for predicting social behavior in dairy cattle.Triangles are a fundamental element of social networks, and including information about them can provide a more complete picture of the social network structure (Durak et al., 2012).The inclusion of this term in the model implicates an assumption of dependency between edges in the network.Consequently, unobserved interactions (i.e., caused by untagged animals or observational errors) could affect the interpretation of results and the accuracy of predictions (James et al., 2009).Nevertheless, the results of the models fitted in this study were not affected by variations in the number of individuals considered in the social networks (data not shown).
Further studies are encouraged to focus on improving the predictive accuracy of the social networks in dairy cattle.This could involve including structural network information other than triangles, or by considering contact duration instead of analyzing binary social networks.Other factors that may affect the accuracy of predictions include regrouping events and the number of herds considered.On the one hand, regrouping events can disrupt the stability of social networks, thereby affecting the accuracy of estimates (Rocha et al., 2020).On the other hand, considering a larger number of herds could provide more accurate results from the model.
The use of social behavior as an early indicator for identifying sick animals is limited by the complexity of analyzing this information in intensive housing systems (Proudfoot et al., 2012).How- ever, sickness behavior can affect general activity levels, feeding patterns, and social interactions (Dantzer and Kelley, 2007), all of which could influence spatial associations measured in this study and, consequently, the social network structure.This study presents a novel approach using RTLS-monitored spatial association data for predicting animal social behavior in intensive housing systems.Future research should prioritize comparative analysis of accuracy when integrating information from different window lengths in populations of different sizes.

Figure 1 .
Figure1.Schematic map of the free-stall barn (74 × 33 m) divided into 2 lactation groups: early (G1) and late (G2) lactation, where y and x represent the direction of the y-axis and x-axis, respectively.The cubicles are in the center of the barn and the feeding tables are on either side.The beige area is outside the boundaries of the cows in the milking group, except for transport between the pen area and the milking parlor.
Marina et al. | PREDICTION OF SOCIAL BEHAVIOR IN DAIRY CATTLE