• 1: Behavioural classes;

We statistically identified broad classes of behaviour using Gaussian Mixture Models (GMM). First, we divided the trajectories into time windows of 1 s for each sheep and for each experimental phase. Next, we extracted movement parameters from each window: average speed, sinuosity (total displacement over distance between the first position and the last) and total displacement distance. Then, because the social stimuli (i.e., the three conspecifics) were located at one end of the corridor, we split the speed vector into two components: along the two lateral walls of the corridor and across the two longitudinal walls. Finally, to derive behavioural classes we performed a GMM on the extracted movement parameters for each lamb [28]. The number of classes (i.e., the number of Gaussians to be used) was determined by comparing models using 1 to 15 classes. We selected the model with the lowest Akaike score, which represents the model with the features best explaining the parameter under consideration [29]. The GMM was performed using the Python package scikit-learn [30]. We estimated the rate of time spent in each movement classes for the two phases.


**Table 1.** Technical characteristics of the FMCW radar used for indoor tracking [22] and outdoor tracking [31].

• 2: Behavioural transitions;

We determined behavioural changes over time using Ricker wavelet processing [32]. Wavelet processing consists in filtering the sheep position signal using a wavelet as a filter [33]. The use of wavelet analysis to describe animal behaviour was previously used

in [34]. This type of filtering is applied to several time scales, thus allowing the detection of a change in the direction and speed of the sheep, depending on when the changes occur or the duration of the change. Our aim was to determine the precise moments when the focal sheep changed its way of moving, which was estimated using the spectrum described by each scale of the used wavelet. We observed that the number of local maxima in the wavelet transform coefficients is sensitive to the number of changes in the way of moving and the size of the wavelet will determine if the change is global or punctual. This estimation of changes was done on the lateral and longitudinal movement and for the two last phases of the experiment.

• 3: Space coverage;

We investigated the space occupied across time by the focal sheep using heatmaps representing the areas the sheep spent time in during the measurements. The use of heatmaps to describe animal behaviour was previously used in [35]. We partitioned the arena into a grid of 80 virtual zones of 44 <sup>×</sup> 40 cm<sup>2</sup> each (i.e., 16 partitions along the arena length and 5 partitions along the arena width). We chose this grid dimension because it is the width of a small lamb [36]. We counted the number of zones (i.e., the heatmap score) the focal sheep remained in for more than 200 ms. This count was used to extract behavioural features for the two last phases of the experiment.

## *2.6. Outdoor Radar Tracking*

We ran outdoor experiments in order to demonstrate the applicability of our radar system for the tracking of sheep in field conditions. These measurements were done in an open space with no obstacles (60 m × 15 m asphalt place). A human experimenter moved within the radar catching area in order to induce animal movements. We tested one female sheep. To enhance detection range to 40 m, we used a FMCW radar with the lower operating frequency of 24 GHz. At fixed transmitted power, lower frequencies enable reduction of the free-space attenuation of the radiated electromagnetic power [27]. The gain due to the free-space attenuation is 10.13 dB.

#### *2.7. Statistical Analyses*

We ran all analyses using the programming environment R [37]. Raw trajectory data extracted from radar and video measures are available in Dataset S1.

• Analysis of new movement features

We tested the influence of sheep characteristics (docility, and sociability) in interaction with the two test phases on the proportion of time spent in the behavioural classes using a generalized Linear Mixed Model with binomial family error distribution. We tested all possible dual interactions of each variable with the test phase. Three-way Interactions were excluded to avoid over-fitting of the model [38]. Sheep identity was included as a random effect. We ran a model selection on all feature combinations (docility, sociability the phases and their interactions) using the Akaike score. The model with the lowest score was retained as the best model. When the second best model have an AIC score equivalent to the best model (i.e., when the difference is lower than 2) an average model was performed with those that have equivalent AIC. We used a similar procedure to test the influence of the sheep individual characteristics on continuous wavelet transforms estimated on lateral and longitudinal movements (Gaussian family error distributions) and heatmaps (Poisson family error distribution).

• Classification of behavioural types;

To improve the interpretation of the sheep behaviour in the corridor, we reduced our four movement features (proportion of fast movements, changes in longitudinal and transversal movements, space coverage) for phases 2 and 3, using a Principal Component Analysis (PCA). The PCA was performed using the R package FactoMineR [39]. We explored afterward whether our new automated estimators could be used to replace estimators recorded manually using a General Linear Model (GLM, using the R package stats) approach.

#### **3. Results**

#### *3.1. Radar Tracking Is Faster and More Accurate Than Video Tracking*

To test the efficiency of the radar tracking system, we compared the data obtained from the infrared cells, the video and the radar. This efficiency was estimated by comparing the proximity score estimated using the infrared cell, video and radar detection but also by using the crossing rate estimated by the infrared cell and the mean speed along the longitudinal axis estimated by the video and radar detection. We analysed data from 58 individuals (29 males, 29 females). Both data collected by the radar and the video enabled to capture information given by infrared cells with high fidelity. Proximity scores and crossing rates obtained from infrared cells were positively correlated with data obtained from the radar (Pearson correlation; proximity: r = 0.77, *p* < 0.001; crossing rate: r = 0.87, *p* < 0.001) and the video (Pearson correlation test; proximity: r = 0.91, *p* < 0.001; crossing rate: r = 0.34, *p* < 0.001).

Radar tracking had additional advantages over video tracking in terms of data processing (Table 2). The radar produced two times more measures per second. Radar processing was also much faster (50 frames per second for radar and 4 for video processing) and therefore, it may be used for real time analyses. Radar measurement data were of similar size as video measures (ROM), but required approximately seven times less memory (RAM) to process. Finally, radar processing did not require a learning phase with important data collection and a time-consuming training phase that can last several hours just for the adaptation of the model, or several days if the network is not trained beforehand.

**Table 2.** Comparison of data processing characteristics with radar and video tracking systems.


#### *3.2. New Behavioural Indicators from the Radar Data*

The following analyses were made on the 58 sheep. The 2D radar trajectory data offered the opportunity for high resolution analyses of sheep movements.

• Behavioural classes: detection of slow and fast movements

In order to classify the different types of movements exhibited by the sheep, we applied the GMM procedure to statistically identify behavioural classes from the trajectory data. We found four behavioural classes (Figure 2A):

Class 1 (51.3% of the measures) was characterized by null or slow movements ("slow movements");

Class 2 (35.48% of the measures) was characterized by fast movements with low sinuosity ("fast movement");

Class 3 (10.2% of the measures) was characterized by fast movements with high sinuosity ("fast tortuous");

Class 4 (3.01% of the measures) was characterized by slow movements with high sinuosity ("slow tortuous").

Each of the two behavioural classes with strong sinuosity (classes 3 and 4) represented less than 10% of all data. We thus focused our analyses on slow and fast movements only (classes 1 and 2). We tested the effects of the individual characteristics of sheep on the rate

of time spent in each in the two main behavioural classes using GLMMs. The best (using Akaike criterion) model (See Table S1) retained the docility, sociability indicators and the phase of the test to explain the two main behavioural classes extracted by the radar, i.e. the rate of slow movement and fast movement. In phase 3, all the sheep tended to move less than in phase 2 (estimate = −1.24, std. = 0.008, *p* < 0.001). In phase 2, highly sociable sheep moved less than little sociable sheep (estimate = −0.11, std. = 0.015, *p* < 0.001). This trend was reduced in phase 3 for both sociable and docile sheep (sociability: estimate = −0.12, std. = 0.039, *p* < 0.001 docility: estimate = 0.16, std. = 0.0074, *p* < 0.001) (Table S1 and Figure 2). radar, i.e. the rate of slow movement and fast movement. In phase 3, all the sheep tended to move less than in phase 2 (estimate = −1.24, std. = 0.008, *p* < 0.001). In phase 2, highly sociable sheep moved less than little sociable sheep (estimate = −0.11, std. = 0.015, *p* < 0.001). This trend was reduced in phase 3 for both sociable and docile sheep (sociability: estimate = −0.12, std. = 0.039, *p* < 0.001 docility: estimate = 0.16, std. = 0.0074, *p* < 0.001) (Table S1 and Figure 2).

*Sensors* **2021**, *21*, x FOR PEER REVIEW 9 of 19

**Figure 2.** Analyses of behavioural classes. (**A**) Distribution of the four behavioural classes after a Gaussian Mixture Model. (**B**) Frequency of behavioural classes during phase 2 and phase 3 of the corridor test. (**C**) Correlation between the proportion of time spent in slow movements and the sociability score of sheep during phase 2 and 3 (see details of models in Table 3). (**D**) Correlation between the proportion of time spent in slow movements and the docility score of sheep during phase 2 and 3. N = 58 sheep. **Figure 2.** Analyses of behavioural classes. (**A**) Distribution of the four behavioural classes after a Gaussian Mixture Model. (**B**) Frequency of behavioural classes during phase 2 and phase 3 of the corridor test. (**C**) Correlation between the proportion of time spent in slow movements and the sociability score of sheep during phase 2 and 3 (see details of models in Table 3). (**D**) Correlation between the proportion of time spent in slow movements and the docility score of sheep during phase 2 and 3. N = 58 sheep.

**Table 3.** Analyses of behavioural classes. Results of the best GLMM (binomial family, after model selection—see Table S1). The model tested the effects of phase, docility, sociability, and dual interaction of each variable with phase, on the proportion of time spent in fast movements (behavioural class 2). Lamb identity was included as a random factor. Significant effects (*p* < 0.05). **Table 3.** Analyses of behavioural classes. Results of the best GLMM (binomial family, after model selection—see Table S1). The model tested the effects of phase, docility, sociability, and dual interaction of each variable with phase, on the proportion of time spent in fast movements (behavioural class 2). Lamb identity was included as a random factor. Significant effects (*p* < 0.05).


Our second approach to describe the sheep behaviour was to quantified changes in movements (i.e., variation in speed, direction, or both) through time. This was done using

• Wavelet analysis: detection of erratic behavioural transitions; *Sensors* **2021**, *21*, x FOR PEER REVIEW 10 of 19

> Our second approach to describe the sheep behaviour was to quantified changes in movements (i.e., variation in speed, direction, or both) through time. This was done using continuous wavelet analyses (Figure 3). We tested the effects of the individual characteristics of sheep on the frequency of these changes using GLMMs and model selection (Tables S2 and S3). When considering longitudinal displacements (i.e., wavelet Y) along the arena device (Table 4), we found that highly sociable sheep made more changes in the pattern of displacement during both phases of test (estimate = 16.98, std. = 4.68 *p* < 0.001) (Figure 3A,C). In general the movements were less erratic in phase 2 than in phase 3 (estimate = −91.50, std. = 9.07, *p* < 0.001). When considering transversal movements (i.e., wavelet X) across the arena device (Table 4), we found that sheep made more changes in the way of displacement during phase 2 than phase 3 of test (estimate = −53.15, std. = 8.26, *p* < 0.001) (Figure 3B,D). However, this trend was reduced for the docile sheep (estimate = 19.19, std. = 7.11, *p* = 0.009). continuous wavelet analyses (Figure 3). We tested the effects of the individual characteristics of sheep on the frequency of these changes using GLMMs and model selection (Tables S2 and S3). When considering longitudinal displacements (i.e., wavelet Y) along the arena device (Table 4), we found that highly sociable sheep made more changes in the pattern of displacement during both phases of test (estimate = 16.98, std. = 4.68 *p* < 0.001) (Figure 3A,C). In general the movements were less erratic in phase 2 than in phase 3 (estimate = −91.50 std. = 9.07, *p* < 0.001). When considering transversal movements (i.e., wavelet X) across the arena device (Table 4), we found that sheep made more changes in the way of displacement during phase 2 than phase 3 of test (estimate = −53.15, std = 8.26, *p* < 0.001) (Figure 3B,D). However, this trend was reduced for the docile sheep (estimate = 19.19, std = 7.11, *p* = 0.009).

**Figure 3.** Wavelet analyses. (**A**) Example of wavelet transform for lateral movements (X). Red dots correspond to the detection of a change in the displacement at scale factor and time position (i.e., a local maxima of the wavelet transform of the signal position). (**B**) Example of wavelet transform for longitudinal movements (Y). (**C**) Relationship between the number of local maxima (red dots in (**A**,**B**)) in the wavelet extraction and the degree of sociability of sheep during phases 2 and 3. (**D**) Relationship between the number of wavelets and the degree of docility of sheep during phases 2 and 3. See details of models in Table 4. N = 58 sheep. **Figure 3.** Wavelet analyses. (**A**) Example of wavelet transform for lateral movements (X). Red dots correspond to the detection of a change in the displacement at scale factor and time position (i.e., a local maxima of the wavelet transform of the signal position). (**B**) Example of wavelet transform for longitudinal movements (Y). (**C**) Relationship between the number of local maxima (red dots in (**A**,**B**)) in the wavelet extraction and the degree of sociability of sheep during phases 2 and 3. (**D**) Relationship between the number of wavelets and the degree of docility of sheep during phases 2 and 3. See details of models in Table 4. N = 58 sheep.

**Table 4.** Wavelet analyses. Results of the best GLMM (Gaussian family, after model selection—see details in Tables S2 and S3). The model tested the effects of phase, docility, sociability, and binary interactions of each variable with phase, on the number of wavelets. Lamb identity was included as a random factor. Significant effects (*p* < 0.05) are shown in bold. Wavelet Y: longitudinal movements. Wavelet X: transversal movements.

