DOI: 10.5061/dryad.m0cfxppbs
title: Data and code for: A standardised approach to quantifying activity in domestic dogs

description: Objective assessment of activity via accelerometry can provide valuable
 insights into dog health and welfare. Common activity metrics involve
 using acceleration cut-points to group data into intensity categories and
 reporting the time spent in each category. Lack of consistency and
 transparency in cut-point derivation makes it difficult to compare
 findings between studies. We present an alternative metric for use in
 dogs: the acceleration threshold (as a fraction of standard gravity,1g =
 9.81m/s2) above which the animal’s X most active minutes are accumulated
 (MXACC) over a 24-hour period. We report M2ACC, M30ACC and M60ACC data
 from a colony of healthy beagles (n=6) aged 3-13 months. To ensure that
 reference values are applicable across a wider dog population, we
 incorporated labelled data from beagles and volunteer pet dogs (n=16) of a
 variety of ages and breeds. The dogs’ normal activity patterns were
 recorded at 200 Hz for 24-hours using collar-based Axivity-AX3
 accelerometers. We calculated acceleration vector magnitude and MXACC
 metrics. Using labelled data from both beagles and pet dogs, we
 characterise the range of acceleration outputs exhibited for a variety of
 behaviours, enabling meaningful interpretation of MXACC. These metrics
 will help standardise measurement of canine activity, inform development
 of exercise guidelines and adherence monitoring, and serve as outcome
 measures for veterinary and translational research. This repository
 contains two files: 1) `LMM_input_data.csv`, a spreadsheet file containing
 the raw data used to explore the effect of modifying epoch length and
 sample frequency on aggregate activity metrics using linear mixed effects
 models as described in the manuscript. There is one row per dog per epoch
 length, sample frequency and age combination, and 2)
 `getMostActiveMinsThresh.m`, a MATLAB function used to compute the MX ACC
 outcome metrics that are explored in the manuscript.
description: See detailed methods in accompanying paper, Karimjee et al. 2024,
 Royal Society Open Science.  The Methods description below are exerpts
 directly from the methods paper.  See the paper for more details including
 the equations, tables and figures.  Data were collected
 via Axivity AX3 activity monitors (Axivity, U.K.). These have been
 previously validated for use in dogs and their parameters are easily
 modifiable by the user through open-source software, unlike many other
 commercial devices. Devices were mounted onto each dog’s neck collar using
 duct tape, and positioned ventrally to minimise likelihood of rotation of
 the logger over time. Additionally, the metrics selected were direction
 invariant to avoid any influence of device rotation. A sample frequency of
 200Hz was used for recording. This was a higher sample frequency in
 comparison to most industry standard devices (30-100Hz). Considering that
 one of the main objectives of this work was to quantify the effect of
 sample frequency on output metrics, we aimed to use a sample frequency
 that far exceeded that necessary to allow for meaningful comparisons to be
 carried out by downsampling to lower sample frequencies that are commonly
 used in industry devices. Using a higher sample rate also ensured that the
 loggers captured all high frequency activity and behaviour data.
 <em>Dog Colony</em> The loggers
 were mounted onto the dogs’ collars before 12pm and removed after 12pm, 2
 days later. Dogs were habituated to wearing collars from 7 weeks of age.
 Dogs were sampled at monthly intervals between the ages of 3 and 18 months
 old and data were recorded for 48 hours continuously. The dogs remained in
 their kennels during the period of monitoring and followed their normal
 daily routine. Paddock exercise was not provided during the monitoring
 period, however all kennels included an outdoor courtyard area which was
 always accessible. To develop aggregate metrics to represent activity over
 a 24-hour period, we split the 48-hour recording into 2x 24-hour segments.
 Each 24-hour segment was carried forward for analysis and calculation of
 aggregate metrics. The resulting metrics were then averaged across the 2x
 24-hour periods per time point for each animal. Using an average of the
 output metrics from 2x 24-hour segments, we were able to establish a more
 representative measurement of that dog at a particular age
 point. In addition to the data described above, we also
 collected a smaller sample of video and accompanying accelerometer data
 (approx. 43 hours across multiple recording sessions). The videos were
 collected at the end of the 48-hour segments within the kennel
 environment. Video data were recorded using GoPro Hero 5 black cameras and
 a gooseneck monopod with clamp attachment. Video was captured in 1080p and
 at 30 fps using the “Superview” mode. This ensured that the whole kennel
 was visible with a single camera.<br><br>Upon starting
 recording, the collar was shown to the camera and visibly tapped 3x using
 a solid object (e.g. pen) in order to create spikes in the accelerometer
 data whilst within view of the camera. These spikes were used to
 synchronise the video and accelerometer data during labelling. The collars
 were then placed on the dogs and the start and end times were logged. The
 dogs were left undisturbed for a period of between 60-120
 minutes. <em>Volunteer Pet
 Dogs</em> We carried out 10-minute sessions of
 behavioural observation whilst the dog wore the AX3 logger. This
 observation period followed a protocol to encourage a range of behaviours
 in the dogs without specific commands to maintain an environment
 comparable to free-living. Dogs were put into a secure, enclosed pen (3m x
 2.5m) and were under video surveillance throughout the experiment. The
 video footage was live streamed to a screen outside the room to allow
 constant observation. Dog owners were able to watch the live footage and
 could decide to end the experiment early if they deemed their dog to be
 under significant stress due to being left alone in an unfamiliar
 environment. One experiment was terminated early due to anxiety and that
 dog’s data has been excluded from the analysis.
 <em>Active threshold derivation for epoch length
 analysis</em> We have explored the derivation of
 two key processing parameters: (1) derivation of an appropriate
 active/inactive threshold and (2) establishment of an appropriate epoch
 length for our dog data. However, each analysis required the use of both
 parameters. We chose to begin with the derivation of active/inactive
 threshold to quantify bouts of activity, which meant that an initial epoch
 length was required to process our data. The derived threshold was then
 taken forward and used to analyse potential epoch lengths. Lastly, we
 repeated the threshold derivation analysis with data processed using the
 newly established epoch length to confirm that the threshold remained
 appropriate. Labelled data were imported into MATLAB R2021a for
 processing. A 6<sup>th</sup> order Butterworth band-pass
 filter was used in both directions (‘filtfilt’ function) to obtain zero
 phase lag, with cut-off frequencies of 0.28 Hz and 32.76Hz (stop band:
 0.1Hz and 50Hz, pass band: 0.5Hz and 20Hz). The filter settings were
 chosen to both remove the acceleration due to gravity and any background
 noise. We also anticipated that behaviours of interest would all occur at
 frequencies between the cut off frequencies listed. The labelled, filtered
 tri-axial data were used to compute the vector magnitude of acceleration.
 This allowed for the magnitude of the acceleration captured in each axis
 to be quantified, independent of direction. The labelled vector magnitude
 data were then split into 1s epochs and each segment was assigned an
 “active” or “inactive” label. The mean was calculated for that segment.
 The 1s epoch duration is commonly used in industry and served as an
 initial starting point for derivation of activity threshold. In the cases
 where more than one label was present across a single 1s segment, the
 label corresponding to &gt; 50% of the points was assigned to the
 whole segment. If there was no label that was assigned to &gt;50% of
 points, this segment was discarded and not taken forward for
 analysis. The labelled data were then split into active
 and stationary behaviours and exported to Python 3 for further analysis.
 Data were split into a training and test fractions (80:20) and a
 Receiver-operating characteristic (ROC) analysis was carried out. ROC
 curves visualise the trade-off between sensitivity and specificity for all
 possible cut-off thresholds for a test, to enable selection of an optimum
 threshold that maximises both sensitivity and specificity. The area under
 the curve (AUC) also provides a numerical measure of usefulness of a
 particular test. We iterated through thresholds between
 0.001<em>g</em> and 0.5<em>g</em> in increments of
 0.001g. We computed the differences between sensitivity and specificity
 values per threshold and selected the threshold with the minimum
 difference between the two quantities. The resulting threshold for the
 beagle data was 0.154<em>g</em>, and for the pet dogs was
 0.159<em>g</em>. <em>Evaluating the
 effect of epoch length on activity measures</em>
 Once data are collected, smoothing by aggregating the data over a
 time window of fixed length, or “epoch”, is a tool that can be used to
 further reduce computational load whilst providing a more reliable
 estimate of the acceleration frequency. Epoch length refers to a time
 window of fixed length across which data points are aggregated during a
 recording. This is particularly helpful for devices with lower memory
 capacity, which is often the case in wearable devices due to their
 extremely small size. Epochs are used for several reasons including
 reducing computational load whilst increasing reliability by averaging
 data points over a time period, versus simply reducing the sample
 frequency. The choice of epoch length should be a decision made in the
 context of the data collected. Given that we are investigating activity
 patterns, including counts and durations of bouts of activity, the choice
 epoch length was an important consideration. Here, we adopted a
 data-driven approach to explore how epoch length influenced the measured
 outcome variables. To determine the appropriate epoch
 length for our dog data, we processed 24-hour activity data using
 different epoch lengths between 0.005s and 1s, in 0.005s increments. The
 increment size was chosen as data were collected at 200Hz, meaning that
 the changes were as granular as possible, incrementing by a single sample
 period each time. A 6<sup>th</sup> order Butterworth band-pass
 filter was then used in both directions (‘filtfilt’ function) to obtain
 zero phase lag, with cut-off frequencies of 0.28 Hz and 32.76Hz (stop
 band: 0.1Hz and 50Hz, pass band: 0.5Hz and 20Hz).
 <em>Derivation of MX<sub>ACC</sub>
 metrics</em> We report an activity metric first
 presented in humans by Rowlands and colleagues (2019), for activity
 monitoring in dogs: the acceleration threshold (<em>g</em>)
 above which the animal’s X most active minutes are accumulated
 (MX<sub>ACC</sub>) over a 24-hour time period. Examining the
 threshold above which the dog’s X most active minutes are accumulated over
 a 24-hour period provides an understanding of the varying intensity levels
 of movement that are exhibited over a longer time frame, and how
 individuals compare to each other. The values reported are directly
 comparable between individuals and, importantly, are translatable between
 populations. The values of X used can be adjusted to suit the data that is
 being examined, with smaller values reflecting higher intensity activities
 and larger values reflecting lower intensity activities. In this case
 study, we present MX<sub>ACC </sub>data computed using
 X-minute values of 2, 30 and 60. To calculate these data points, the
 epoched vector magnitude was sorted in descending order and the
 appropriate X-minute increment was indexed. The vector magnitude value at
 the X time index in the sorted data is the MX<sub>ACC</sub>
 statistic.<br><br>Rowlands AV, Sherar LB, Fairclough SJ, Yates
 T, Edwardson CL, Harrington DM, et al. (2019) A data-driven, meaningful,
 easy to interpret, standardised accelerometer outcome variable for global
 surveillance. Journal of Science and Medicine in Sport.
 22(10):1132-8.
description: # Data and code for: A standardised approach to quantifying activity in
 domestic dogs [Access this dataset on Dryad](10.5061/dryad.m0cfxppbs)
 `LMM_input_data.csv` - this file containing the raw data used to explore
 the effect of modifying epoch length and sample frequency on aggregate
 activity metrics using linear mixed effects models as described in the
 manuscript. ## Description of the data and file structure As described
 above, the data included in `LMM_input_data.csv` was used to examine the
 effect of epoch length and sample frequency on aggregate activity metrics.
 There is one row per dog per epoch length, sample frequency and age
 combination. This data was used to create Figures 5-7 in the manuscript.
 #### Columns: * `dogCode` - ID of the dog recorded * `AgeInMonths` - age
 of the dog at the time of recording * `epochLength` - epoch length used to
 process the data * `sampleFreq` - the data was re-sampled to this
 frequency for processing * `M2_ACC` - the M2<sub>ACC</sub>
 value computed at this combination of sample frequency and epoch length *
 `M30_ACC` - the M2<sub>ACC</sub> value computed at this
 combination of sample frequency and epoch length * `M60_ACC` - the
 M2<sub>ACC</sub> value computed at this combination of sample
 frequency and epoch length ## Code/Software `getMostActiveMinsThresh.m` -
 a MATLAB function used to compute the MX<sub>ACC</sub> outcome
 metrics that are explored in the manuscript. MATLAB R2021a was used for
 this analysis. It will compute a single MX<sub>ACC</sub> value
 for the chosen value of X. #### Inputs: * `activeMinutes` - integer
 specifying the number of active minutes to use (2, 30 and 60 were used in
 the manuscript) * `svm` - vector magnitude data of a single recording over
 a 24h period collected from the accelerometer with the same sample
 frequency as the `sample_Hz` in vector format * `sample_Hz` - sample
 frequency of the recording * `epochLength` - smoothing window size in
 seconds #### Outputs: * `accThresh` - the acceleration threshold (g) above
 which the dog's X most active minutes (specified by `activeMinutes`)
 are accumulated over a 24h period If you use this code, please cite :
 Karimjee, Harron, Piercy, Daley (2024), A standardised approach to
 quantifying activity in domestic dogs, Royal Society Open Science