The outline of the whole sensitivity analysis process is shown in Fig. 1. A 3D CAD model of the human body was built and actuated using real joint angles data from normal subjects. The joint angles were collected using a standard motion capture system (Vicon system + Plugin-gait protocol). Each subject performed eight activities (as will be explained later in part one of the Methods section) for ten times to provide a set of movements with natural variations. Virtual sensors were installed on the CAD model. The virtual sensors were coordinate systems that could be defined at any arbitrary location on the CAD model. The accelerations, and angular velocities of the virtual sensors were extracted (with respect to the local frames of the sensors) and were used as inputs to the HAR system. The precision of the HAR system was then calculated and considered as the performance index.
4.1. The HAR system and the activities
The HAR system used in this research had been developed in a previous study and was composed of four IMU sensors . The system was to recognize a set of 34 activities for physical rehabilitation of Parkinson's disease (PD) patients. The activities included LSVT-BIG  and some functional exercises. Due to similarities in the nature of these activities, only 8 of them were later used as representatives for the sensitivity analysis, namely: slow-walk, picking up, putting down, turning to left, LSVT-BIG step forward and reach (right and left), LSVT-BIG step to the side and reach (right and left). For more information about the activities see .
In the HAR system, eight features were calculated from the linear accelerations and angular velocity components from each of the four sensors. The features were in the time, frequency, and the time-frequency domain (see ). A combination of the principal component analysis (PCA) and linear discriminant analysis (LDA) was used for feature extraction . In this method, the redundant features were elided using the PCA, then the best features for classification were extracted using the LDA. Finally, the nearest mean (NM) algorithm [11, 18] was used to categorize the activities. The HAR system used a two-stage training procedure. It was once trained with a database of nine subjects. Then for each particular user for whom the recognition was to be done, a re-training or so called adaptation was performed using the data collected from the same person. For this purpose, each new subject had to perform the activities for a minimum of six times in the presence of a trained staff to make sure that the sensors were correctly attached and the activities were performed correctly. The collected data were then replicated and added to the original database. The replication was done to increase the weight of the subject’s data versus the old data in the database. The augmented database was then used to re-train the classifier to maximize the performance for that particular subject. In other words, the second training phase, customized the classifier for each individual. This was justified since the final application of the proposed system is tele-rehabilitation and therefore, the device is supposed to be lent out to the same individual for a certain period of time.
The participants in the current study (3 male subjects aged 23–28), performed the eight mentioned activities for ten times each, under the lab staff supervision. While the subjects performed the activities, motion capture was performed following the Plug-in gait model. The data of motion capture analysis was further used to re-train and test the HAR system. In order to do so, the joint angle data were used to actuate the CAD model and the IMU data was extracted from the model. This process will be fully demonstrated in the following section. Figure 2 shows the experimental setup.
4.2. A 3D CAD body model and actuating the model
A kinematic anthropometric 3D CAD model of a human male body  was used to investigate the effects of the sensor misplacements. The model, as shown in Fig. 3, has a total of 15 segments (head, thorax, pelvis, bilateral feet, shanks, thighs, arms, forearms, and hands) and 14 joints (neck, spine, bilateral ankles, knees, hips, shoulders, elbows, and wrists). The CAD model was imported to Simulink-MATLAB R2016a for kinematic simulation.
Using the motion capture analysis (Vicon and plug-in gait model), the joint angles according to the plug-in gait model were extracted from the experiments. Such angles are in the form of Euler angles that correspond to the coordinate frames of the successive segments. The Euler angles were then input to the CAD model. For this purpose, frame assignments were carried out on the CAD model segments following the Plug-in gait model. As a result, the model was able to replicate the movements of each subject in the simulation environment.
4.3. Modeling the sensor misplacements
In the CAD model, the IMU sensors were modeled by body-attached small cubes each incorporating a local frame. The frames were defined such that their z-axes were normal to the model surface. The acceleration and the angular velocity vectors of the segment were measured in accordance to the local frames by the simulation software, resembling the IMU sensors outputs. In this study, the selected regions to install the IMU sensors, were the right and left arms & right and left anterior thighs. The gravitational acceleration was also added separately to the sensors’ output for full resemblance with real IMUs.
In this research, three types of sensor misplacements were implemented on each sensor, namely: Translations in the longitudinal and transverse directions of the body segment, and rotation about the z-axis of the sensor (normal to the body surface). Considering four sensors and three types of misplacements for each and ignoring any interactions between the different types of sensor misplacements, a total of twelve types of misplacements were considered and analyzed. For the longitudinal and transverse directions, eight steps of displacements were considered with a step size of 5 millimeters resulting in an overall range of 40 millimeters with the nominal sensor placement at the center. Note that these displacements are accompanied by small rotations of the sensor as well since the sensor is constrained to lie on the surface of the body segment. Figure 4 depicts the proposed locations for mounting the sensors for arms and legs. The rotational misplacement of the sensors (about the z-axis) were implemented by multiplying a rotation matrix to the output vectors of the central sensors. Eight rotation steps of two degrees were considered resulting in a variation interval of − 8 to 8 degrees.
The proposed variation ranges for the sensor misplacements were determined based on the common sense. It was noted that translations greater than 20 mm in any direction or rotations more than 8 degrees were quite apparent and easily noted by the user and hence corrected before using the HAR system.
4.4. Sensitivity analysis
The purpose of the sensitivity analysis was to determine the impact of each of the 12 types of sensor misplacements on the performance of the HAR system. The performance of the HAR system was measured using precision  or positive predictive value (PPV). This measure is a good indicator of the overall functionality of the classifier for the whole set of activities . PPV was calculated as:
where, TP (true positives) represents the number of correct recognitions of classes in samples of positive conditions, and FP (false positives) represents false classifications of samples with positive conditions. TP & FP are extracted from the confusion matrix.
The HAR system used in this study underwent an adaptation process. 2 of 10 instances for each of 8 activities performed by each subject, were replicated and used to adapt the HAR system to the same subject (as discussed in Sect. 2.1). For the adaptation phase, the outputs of the nominal sensors were used. The remaining 8 instances of the activities performed by the subject were used to validate the HAR system with sensors at their nominal locations (“validation tests”).
In order to determine the sensitivity of the sensor misplacements, the data extracted from the misplaced sensors were fed to the HAR system. Such experiments are called “variation tests” in this work. In each variation test, all 10 instances of activities performed by the subject in which 1 and only 1 out of 12 types of misplacement was applied were produced by the model and sensors’ outputs were processed by the HAR.
For investigating the effects of each one of the 12 types of misplacement, we compared the PPV of the variation tests with that of the validation tests for each subject. The higher the difference is, the more sensitive that type of the misplacement would be.
In reality, there are always combinations of different types of misplacements. As a result, it remains to determine how the interaction between different types of misplacements impact the performance of the HAR. For this purpose Monte Carlo method was used . Following this method, misplacements of the sensors were considered as random variables and their impact on the system performance was determined statistically through simulations. In this study, two sets of distribution functions were considered for the sensor misplacements. In the first set, we assumed similar distribution for all misplacement types. In the second set, we assumed that the user was provided with some guidelines on the importance of the top three types of misplacements out of the 12 types. This guideline was assumed to be resulted from the sensitivity analysis. Therefore, it was expected that users mount the more sensitive sensors more accurately. To perform the process, 200 random instances of the sensor mounting on the human body were modeled by a discrete normal distribution. The placement of sensors was computed by the formula below:
where is a normally distributed random variable with a mean of Xmean (i.e. the nominal location of the sensor) and standard deviation of σ. The standard deviation was set to the range of variation used in the sensitivity analysis for all 12 misplacement types. Using the above distribution of the misplacement, 200 instances of the sensor placements were built and output signals were fed to the classifier. The average precision rate was calculated and considered as the overall performance of the system in the real world applications where a combination of sensor misplacements is present. In a second set of simulation, for the first three misplacement types with top sensitivity, the standard deviation was reduced to one third assuming that the user instruction of the system recommends more precise mounting of the corresponding sensors. The results are to determine how the outcome of the sensitivity analysis may impact the performance of the system through more accurate mounting of the sensitive sensors.