*2.3. Features*

We ran a pilot study with 5 participants, in which we asked the users to complete the minesweeper game in a limited time. We presented a clock to the user, and an observer was also present to make negative comments on the user's performance. Among all participants in the stress situation, we observed a change in leg posture and a different foot contact with the floor. Two participants demonstrated a nervous leg shaking and foot tapping. Our prototype is designed to identify these unique characteristics by sensing plantar pressure distributions of the foot, as well as tracking the foot angle and motions. We defined 10 low-level features reflecting these behaviours, which are:

#### 2.3.1. A: Foot Pressure

The forefoot pressure was calculated by adding the pressure of 12 sensor points located at the forefoot area of the insole. To calculate rear-foot pressure, the sensor readings of 4 sensors located at the heel area were added together. The sensor layout is depicted in Figure 2.

If the *i*th sensor is *Pi*:

$$P\_F = \sum\_{i=1}^{12} P\_i \tag{1}$$

$$P\_R = \sum\_{i=13}^{16} P\_i \tag{2}$$

Before summing the raw data, we applied a moving average filter ofa1s window size to filter out high frequency noises. Finally, we calculated the total foot pressure by summing up all pressure points.

$$P\_T = \sum\_{i=1}^{16} P\_i \tag{3}$$

Since the features are independent from previous data points, all pressure features were segmented into 10 s non-overlapping windows. Then, the mean of each window is used for the model training.

**Figure 2.** The sensor layout of the insole.

#### 2.3.2. B: Centre of Pressure

Literature has shown the Centre of Pressure (CoP) as an interesting feature to understand different postures and motion while standing [23], as well as sitting [77]. Therefore, we calculated the CoP for both dimensions (X-axis and Y-axis—see also Figure 3B) by using a weighted average calculation as mentioned in prior work [23]. The CoP was also calculated over 10 s of non-overlapping windows since it is independent from the previous window.

$$\chi\_{CoP} = \frac{\sum\_{i=1}^{12} P\_i y\_i + 3 \sum\_{i=13}^{16} P\_i y\_i}{P\_F + 3P\_R} \tag{4}$$

$$X\_{CoP} = \frac{\sum\_{i=1}^{12} P\_i \mathbf{x}\_i + 3 \sum\_{i=13}^{16} P\_i \mathbf{x}\_i}{P\_F + 3P\_R} \tag{5}$$

**Figure 3.** To detect acute stress, we present a shoe prototype incorporating a pressure sensitive insole and an IMU worn around the ankle. Based on literature research and observations, we propose four features that can reveal the user's stress level. We show that a significant forefoot pressure, deviations in the centre of pressure, different foot/leg postures, and tapping of the foot, can indicate an elevated stress level. To validate generalisability, we conducted three studies: Study 1—Constructing Validity, Study 2—evidencing Empirical Replicability and Study 3—testing for External Validity. Our proposed models score reasonable accuracy and show robustness across different users.

#### 2.3.3. C: Foot/Leg Posture

The acceleration data of each axis (aX, aY, aZ) primarily indicates the leg/foot posture defined by the knee angle as seen in Figure 3C. Similar to the above mentioned features, the raw data stream of each axis was segmented into non-overlapping 10 s windows and the mean of the each window was used in model training. Since the sampling rate was 50 Hz, the mean of 500 data points were taken in each 10 s window for all 3 axes. If the number of data points per window is *W* where *W* = 500:

$$aX\_{\text{mean}} = \frac{1}{\mathcal{W}} \sum\_{i=1}^{500} aX\_i \tag{6}$$

$$a\mathcal{Y}\_{\text{mean}} = \frac{1}{\mathcal{W}} \sum\_{i=1}^{500} a\mathcal{Y} \tag{7}$$

$$aZ\_{\text{mean}} = \frac{1}{\mathcal{W}} \sum\_{i=1}^{500} aZ \tag{8}$$

#### 2.3.4. D: Foot Tapping

The dominant and the median frequency of each axis are used to describe foot motions, such as foot tapping, waving and leg shaking. We recognised that some motions may be very minimal. To avoid cancelling out these low-amplitude motions when calculating a 3D vector-norm, we deployed the axis-inversion algorithm Matthies et al. introduced [83]. For instance, if we inverted X axis of the accelerometer the inverted axis *aXinv* would be: *aXinv* = 2*MAX*(*aX*) − *aX*. After segmenting the signal into 10 s non-overlapping windows, we calculated three 3D norms, each with a different inverted axis. From the resulting signals, the 3D-norm with the highest peak-to-peak, *V*3*D* was selected for further processing. Then, FFT was used to identify the frequency components of the signal before we extract the dominant and median frequency [84].

$$F\_D = F\_{\text{MaxEnergy}}(FFT(V\_{\text{3D}})) \tag{9}$$

$$F\_M = F\_{M 
\text{diam Energy}}(FFT(V\_{3D})) \tag{10}$$

#### **3. Construct Validity—Study 1**

As elaborated before, conceptual-wise leg/foot postures and movements should yield information that could indicate stress. Therefore, in our first study, we aim to construct the validity of this concept by developing a machine learning model that aims to distinguish acute stress and relaxation. The study protocol was approved by the University of Auckland Human Participants Ethics Committee.
