The resulting data was formatted as a three-dimensional tensor, with cows on the first axis, time on the second axis, and mutually exclusive behaviors on the third axis . In order to more intuitively represent this data as the proportion of time devoted to each behavior, the total minutes a given cow was recorded as engaging in a given behavior on a given day was normalized by the total minutes that a given cow was recorded on a given day of observation.An ensemble of data mimicries was created for this observed data tensor using the simTimeBudget utility previously developed for the LIT package. Observational error attributable to the precision of the sensor was again simulated by stochastically resampling each observed hourly time budget using the joint Dirichlet-Multinomial sampling strategy . The resulting mimicry of the raw sensor data was then conditionally aggregated by date of observation to create a four-dimensional tensor formatted identical to the observed data tensor but with simulation number on the fourth axis to comply with LIT package formatting standards. Ensemble variance estimates were calculated over the simulation axis for each combination of cow, day, and behavior indices. As with overall time budget, these ensemble variance estimates could subsequently be used to scale dissimilarity estimates for the observed data to account for heterogeneity in multinomial-formatted data both within and between behavioral axes. In previous analysis of overall time budgets, trimming tray for weed jackknife resampling could be performed within-animal to nonparametrically estimate the reliability of the underlying behavioral signal by leveraging information in the temporal subsamples used to create the aggregate record .
With daily time budget records, however, this strategy could not be employed, ashomogeneity of hourly time budgets could not be assumed due to fluctuations in behaviors imposed by the management schedule and the circadian rhythms of the animals themselves . Thus, while the behavioral axis could be rescaled using the precision penalized ensemble weighted distances, systematic differences between days of observation was here accommodated by the empirically-driven iterative re-weighting of the time axis at the heart of the data mechanics algorithm .In order to encode daily time budgets, the basic data mechanics algorithm was extended to a three-dimensional tensor. As before, column clusters were used to reweight dissimilarity matrices calculated for row observations, and row clusters were used to re-weight dissimilarity matrices calculated for column observations, allowing structural information to be shared between the two axes . To accommodate a multivariate response, dissimilarity values were aggregated over the third axis at each matrix index prior to aggregation over the remaining matrix index for which the dissimilarity matrix was calculated. The efficacy of three dissimilarity estimators were explored. The first was a simple unweighted Euclidean distance , which is functionally equivalent to the standard two-dimensional implementation of the data mechanics algorithm, except that in the tensor implementation all behaviors for a given time budget observation are forced into the same cluster. The second dissimilarity estimator considered was the Kullback-Leibler Divergence Distance, which is the sum of the asymmetric relative entropy estimates for any two probability distributions vectors that sum to one. Here KLD-distance was calculated at each index for the first two axes and prior to aggregation over the axis for which the dissimilarity matrix was computed. The third and final dissimilarity estimator explored wasthe ensemble-weighted Euclidean distance, wherein the squared distance between observed values were normalized by the sum of the ensemble variance estimates calculated over all simulated datasets at the corresponding tensor indices.
The dissimilarity matrices calculated over the subset of row or column indices were reweighted iteratively using the cluster results of the opposite matrix axes until either cluster sets became stable or a maximum of ten iterations were reached . For all three dissimilarity estimators, clustering results were here calculated on a grid of metaparameter values: from one to ten cow clusters and one to six day clusters. Full details on the implementation of the tensorMechanics algorithm are provided in Supplemental Materials. To visualize the final dendrograms produce from each tensor mechanics optimization, the pheatmap package was used to create heatmaps wherein cows were arranged along the row axis, days along the column axis, and cells colored to represent the proportion of time that a given cow dedicated to a given behavior on a given day . To help identify temporal patterns captured by these clustering results, the column axis was annotated in purple with the day on trial that each set of records were recorded. In order to visualize patterns recovered across all five behavioral axes simultaneously, the ggpubr package was used to create a composite image of the final heatmaps created using equivalent 0 to 1 scales to facilitate direct visual comparisons of behavioral investments .Visualizations for final clustering results for all three dissimilarity estimators for all candidate metaparameter values are provided in Supplemental Materials. Comparisons of dissimilarity estimators for encodings of daily time budgets largely mirrored the clustering dynamics found with encodings of overall time budgets. Tensor mechanics encodings using thestandard unweighted Euclidean norm, which employed no rescaling of behavioral axes, overemphasized patterns in high frequency behaviors such as eating and rumination, recovering very little systematic differences in any of the activity axes across days or animals. KLD distance, on the other hand, produced a more balanced encoding across the five behavioral axes, but again was prone to over-estimate dissimilarity at the extremes of the time budget distribution, which resulted in a number of animals with extremely low or high eating times being classified as outlier in clusters containing only one animal, which would effectively remove these animals from consideration in downstream analyses of bivariate associations using these clustering results.
The encoding created using the ensemble-weighted Euclidean distance is visualized in Figure 1. This dissimilarity estimator provided arguably the most balanced representation of heterogeneity in daily time budgets across all five behavioral axes without over-pruning at the extremes of the distribution. Perhaps the most striking feature of this visualization, however, is the remarkable consistency in daily time budget records across this observational window. As with overall time budget, eating time remains the primary driver of difference between animals in this encoding. At the extremes of these eating time budgets, there are few systematic differences in clusters across the temporal axis, nor even much variability in observations within clusters, suggesting that neither transient environmental fluctuations or more persistent changes in management or the biology of these animals had much influence on the time investments of these individuals with more extreme behavioral strategies. Among cows with more moderate eating times, there is certainly more variability within clusters, but systematic differences in cells across the temporal axis are still surprisingly subtle. In contrasting what systematic patterns are apparent against the time indices of these records, it appears that time spent eating was slightly elevated during roughly the first 30-60 days on trial relative to the remainder of the observation window, which would have encompassed the transition period for many of these animals and the earliest stages of lactation for nearly all cows enrolled on this trial. This result is counter intuitive, as we would expect appetites to be suppressed immediately following calving and gradually increase throughout this observational window; however, it has been shown previously that time spent eating is not always well correlated with feed intake, weed trim tray as cows can compensate for reduced time invested in mastication at initial ingestion with increases in time masticating during subsequent rumination . Therefore, it is also possible that this early surge in time spent at the feed bunk might represent increase in feed sorting behaviors, which might represent latent behavioral strategies cows employ to cope with this period of negative energy balance, or it could simply reflect palatability issues related to the nutritional supplement or some other element of the total mixed ration. It is also interesting to note that, amongst animals with moderate eating times, the drop off in eating times seems to correspond with a slight increase in time spent highly active observed across all cow clusters. While this temporal subperiod would likely correspond to the return to estrus for some animals in this herd , the pervasiveness of this shift would seem more easily attributable to some latent biological or managerial shift, such as an increase in appetite during peak milk that led to a greater number of trips to the feed bunk between milkings . As these cows were under stocked with respect to bunk space during this observation window, this may indicate that conditions in this pen support good lying time irrespective of fluctuations in the management environment .In comparing the results of the tensor mechanics clustering with the results for data aggregated to an overall time budget, which are visualized in Figure 2, we see that the two encodings are in close agreement. The contingency table reveals that cluster assignments are nearly identical between the two data sets for the coarser branches of the dendrogram nearer the trunk, which reflect differences among more extreme time budgets, and differ only slightly in the cut off values established between branches representing more subtle differences in time budgets. Given the temporal consistency in this daily time budget data, this result is not necessarily surprising, as there is little additional information or complexity to be recovered from disaggregating this information across days for this herd.
Accommodation of temporal heterogeneity in the tensormechanics encoding appears to have largely only served to more finely distinguish between animals with low eating times. Closer inspection reveals that these distinctions appear to have been made based on differences in tradeoffs between the nonactive and highly active behavioral axes across the early and later phases of this observation window. As a result, the tensor mechanics encoding produces a coarser encoding of animals with more moderate time budgets. This has caused some of the more moderate overall time budget clusters to be consolidated in the tensor mechanics encoding, with some ambiguity in the resulting cutoffs that appears again to be driven by greater weight being placed on how the eating-nonactivity tradeoff and the eating-highly active tradeoff shifts over the observation window.To determine if the temporal heterogeneity found in daily time budget records would modify bivariate associations found in previous analyses between overall time budgets and other farm data streams, bivariate tree tests were conducted using the tensor mechanics results for all three dissimilarity estimators. The first set of tests conducted explored if patterns in daily time budgets differed between animals fed control diets and those whose TMR rations were amended with the Organilac fat supplement. In prior analyses with overall time budgets, no significant bivariate associations were recovered using the bivariate tree test framework ±a result that was not necessarily surprising given that control and treatment animals were housed together throughout the duration of the trial except while head locked for the morning feeding and herd check. Significant bivariate associations were, however, recovered between treatment group and all three dissimilarity estimators used to create tensor mechanics encodings. Visual characterizations of these relationships, which can be found in Supplemental Materials, were created using the compare Encoding utility, wherein contingency table cells were colored by point wise mutual information estimates that were deemed statistically significant by simulation against the null using multinomial resampling . The relationship recovered using the ensemble-weighted Euclidean distance is visualized in Figure 3. Organilac cows were significantly over represented among daily time budgets that were consistent throughout the observation window and characterized by relatively high time spent eating, moderate rates of rumination, and low non-activity. Cows in the control group, on the other hand, were over-represented among daily time budgets that were characterized by time spent eating that varied between moderately-low to moderately-high , rumination rates that were consistently relatively low, elevated rates of nonactivity during the first half of the observation window, and elevated rates of high activity during the second half of the observation period. Collectively, these results might suggest that, amongst cows with more moderate time budgets, control animals may have struggled in the early stages of this study that encompassed much of the transition milk period, whereas fat supplemented cows were able to maintain a robust and well balanced time budget throughout this early lactation period . Alternatively, Organilac cows might simply have spent more time eating throughout the first phase of this research trial in order to sort through their TMR ration in order to avoid the fat supplement.