*3.1. Appropriate Mother Wavelet Selection Based on Accuracy Criteria*

The gait event detection results for the healthy and hemiplegic subjects using the two accuracy criteria, the time-error and F1-score measures for mother wavelet selection, are presented as follows. Figure 5 presents the averaged time-errors associated with HS and TO estimated gait events for the healthy and hemiplegic subjects across the 32 mother wavelets. Notably, the lower the time-error value is, the higher the time-agreement with the FSR reference is. It can be seen from Figure 5a that the "sym2", "db7", and "db6" mother wavelets achieved a relatively lower averaged time-error value of 0.06 ± 0.03 s, 0.09 ± 0.07 s, and 0.10 ± 0.03 s, respectively, for the total of the estimated HS and TO gait events over all the healthy subjects in comparison to the other mother wavelets. Meanwhile, "db6", "sym5", and "db5" achieved a lower averaged time-error value of 0.18 ± 0.05 s, 0.21 ± 0.07 s, and 0.26 ± 0.07 s for gait event detection over all the hemiplegic participants, respectively, as shown in Figure 5b. Note that using the "db6" mother wavelet, the averaged time-error values were lowest over the hemiplegic participants (Figure 5b) and were relatively lower over the healthy subjects (Figure 5a). These findings suggest that the "db6" is an appropriate mother wavelet in gait event detection for both healthy and hemiplegic subjects.

**ǀĞƌĂŐĞĚdŝŵĞͲƌƌŽƌƐŽĨ'ĂŝƚǀĞŶƚĞƚĞĐƚŝŽŶ;,ĞĂůƚŚLJ^ƵďũĞĐƚƐͿ**

(**a**)

<sup>(</sup>**b**)

**Figure 5.** Averaged time-error values of the estimated HS and TO gait events over all the healthy subjects (**a**) and all the hemiplegic subjects (**b**) when using 32 commonly applied mother wavelets. The vertical dashed lines indicate the standard deviation.

As a comparison, Figure 6 plots the Bland–Altman time agreements between the reference gait events and the estimated gait events, where the sample points were obtained from the time-error values of the healthy (Figure 6a) and hemiplegic subjects (Figure 6b) when using the appropriate mother wavelet "db6" and one previously used wavelet "gaus1" in another study [15], respectively. Note that the absolute value of time-errors is presented in Figure 5, whereas the true value of the time agreement is plotted in Figure 6. Here a negative time-error value corresponds to a time-delay in the estimated gait events with respect to the FSR reference gait events, and a positive value means a time-advance. We can see from Figure 6 that for the healthy subjects, the mother wavelet "db6" had a mean time-error of −0.06 s with a 95% confidence interval (CI) of [−0.12, −0.01] for HS gait event detection and −0.02 s [−0.19, 0.14] for TO gait event detection. While using the mother wavelet "gaus1", the mean time-error of 0.16 s [−0.23, 0.55] was achieved for HS gait event detection and 0.12 s [−0.20, 0.44] for TO gait event detection. For the hemiplegic subjects, the "db6" mother wavelet achieved a mean time-error of −0.04 s [−0.11, 0.02] for HS gait event detection and 0.18 s [−0.01, 0.37] for TO gait event detection, whereas the "gaus1" mother wavelet achieved a mean time-error of −0.08 s [−1.30, 1.20] for HS gait event detection and −0.21 s [−1.40, 0.95] for TO gait event detection. Thus, the performances of "db6" were rather good in comparison to "gaus1" for both the healthy and the hemiplegic subjects.

**Figure 6.** Bland–Altman plots of time agreement between the proposed modified CWT algorithm and the FSR method for HS and TO gait event detection in the healthy group (**a**) and the hemiplegic group (**b**). The time agreement results of selecting the optimal wavelet "db6" are shown on the left side whereas results of the commonly used wavelet "gaus1" with rather poor performance are shown on the right side. Positive times correspond to delays in the gait event detection of the proposed modified CWT algorithm with respect to the reference FSR method. The horizontal axis represents the average time measures for detecting gait events by both methods, and the vertical axis is the time error between the two methods. The dashed line from top to down respectively represent the 95% CI upper limit, the mean, 95% CI lower limit of the time difference (in seconds).

Figure 7 shows the averaged HS and TO gait event detection results obtained by using the F1-score criterion across all the 32 mother wavelets. The vertical dotted line indicates the standard deviation. It can be observed from Figure 7 that four of all the mother wavelets, "sym5", "db5", "db6", and "sym7" achieved relatively higher average F1-scores (1.00 ± 0.01, 0.99 ± 0.02, 0.99 ± 0.02, and 0.99 ± 0.02 across the healthy subjects (blue line), respectively). For the hemiplegic patients (red line), "db5", "db6", and "morl" mother wavelets achieved higher averaged F1-scores (0.98 ± 0.02, 0.98 ± 0.03, and 0.98 ± 0.02, respectively). Note that "db5" and "db6" mother wavelets are more stable with relatively high F1-scores for both the healthy and hemiplegic subjects, indicating that the two mother wavelets would be the appropriate mother wavelets for the accurate detection of gait events in comparison to the other mother wavelets regardless of the status of the subject.

**Figure 7.** Averaged F1-scores of HS and TO gait event detection over all the healthy subjects (blue line) and over all the hemiplegic subjects (red line) across different mother wavelets. The vertical dashed lines indicate the standard deviation.

Furthermore, when using the different mother wavelets, the ANOVA analysis of the time-errors (Figure 5) between the FSR reference events and the estimated gait events was significantly different (*p* < 0.001) for both healthy and hemiplegic subjects. This statistical result suggests that the time-error should be a proper criterion for selection of an appropriate mother wavelet in gait event detection for all the subjects. Meanwhile, the ANOVA analysis of the F1-scores (Figure 7) was significantly different for the hemiplegic subjects (*p* < 0.01) and was not significantly different for the healthy subjects (*p* > 0.05). This suggested that the F1-score could also be used as a criterion for the selection of an appropriate mother wavelet in gait event detection for hemiplegic subjects, but probably not for healthy subjects.
