====== Perform Statistical Parametric Mapping ====== This tutorial will show you how to perform an SPM analysis in Sift. An SPM analysis helps you gather statistical analysis contained in the original n-dimensional space as your data, ensuring the removal of potential biasing and allowing for easily understood visualizations. More information on SPM can be found in the [[Sift:Statistical_Parametric_Mapping:Using_Statistical_Parametric_Mapping_in_Biomechanics|SPM Page]] ==== Research Question ==== The question we will be trying to answer today is: "Is there a difference between how an OA patient walks and how a normal control group walks?". We will specifically look at identifying any differences there is in the flexion-extension of the right knee for our participants. ==== Data ==== This tutorial uses overground walking data from roughly 100 subjects divided into two conditions, normal control and osteoarthritis (moderate to severe). This data set can be found in your Sift program files under "Demo" (e.g., C:\Program Files\Sift\Demo). We will be using the same dataset as we used in the [[Sift:Tutorials:perform_principal_component_analysis|PCA Tutorial]]. === Set the library path to the data directory === As with previous tutorials, we begin by loading the CMZ library and defining the queries relevant to our question. - Click {{:sift_library_load.png?20}} **Load Library** in the [[Sift:Application:Toolbar|toolbar]] to open the Load Library dialog. - Click {{:sift_browser.png?20}} **Browse** and select the folder where the data is stored. - Click {{:sift_apply.png?20}} **Load** button to import the data. === Define queries and calculate groups === For this tutorial we will manually create two groups based on tags, one for subjects with osteoarthritis and one for normal control subjects. We begin by defining a query for subjects with the OA tag (indicating osteoarthritis). - Click on the {{:sift_query_builder.png?20}} **Query Builder** icon on the [[Sift:Application:Toolbar|toolbar]], or on the left panel of the [[Sift:Application:Explore_Page|Explore Page]], to open the Query Builder dialog. - {{:sift_action_add.png?20}} Add a query, name it OA, and click **Save**. - {{:sift_action_add.png?20}} Add a condition and name it OA. - **Signals**: Set TYPE - DERIVED, FOLDER - PCA, NAME - RKNEE_ANGLE, COMPONENT - X. This is the only signal in the data set. - **Events**: There are no events in this data set, so this tab can be skipped. - **Refinements**: Check the **Refine using tag** checkbox and select the OA tag. - Click **Save** Next we will define a query for subjects with the NC tag (indicating Normal Control). In this case we can easily modify our previous query rather than starting from scratch. - {{:sift_action_add.png?20}} Add a query, name it NC, and click **Save**. - {{:sift_action_add.png?20}} Add a condition and name it NC. - In the **Refinements** tab, change the selected tag from OA to NC. - Click **Save**. You can verify here that the new NC group has the same signal and event selections as the OA group. Click **Calculate All Queries** and then close the Query Builder dialog. ==== Curve Registration ==== Following some of the [[https://doi.org/10.1016/j.jbiomech.2010.03.008|SPM literature for Biomechanics]], we recommend applying [[sift:curve_registration:curve_registration_for_biomechanical_waveforms|Event Registration]] on 1-dimensional curves, before running an SPM analysis on the data. This is because it removes time variance from our data, which has a significant impact upon the results of our time-dependent signals. For this dataset, there are no specific event labels that we can use, but we notice a distinctive trend of a localized peak between ~50-100% of the gait cycle. As such, we will deem that as an appropriate point to register our curves to, where the right knee flexion-extension is at it's maximum. One at a time, select the query, select "Register Curves", and add the following settings: {{ :Register_OA_SPM.png?400}} Where: - Use the default **"Name of Registration Group"** (ex. OA -> OA_Registered) - Toggle **"Use Local Max/Min"** to ON. - Select 50 and 100 for **"Local Maximum X-Axis Range"** Select "Register" when this is complete.\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ You should see the registered signals "line up" much more than before registering the data: === OA Plots === {{:OA_All_Plots.png?800}} === NC Plots === {{:NC_All_Plots.png?800}} ==== SPM ==== With our pre-processing complete, we can move onto the SPM Analysis! The question we are investigating here is "Is there a difference between how an OA patient walks and how a normal control group walks?". This is a great question to apply SPM to gain some insights. === GLM === We begin by creating a General Linear Model (GLM) of our data. This is a [[sift:statistical_parametric_mapping:using_statistical_parametric_mapping_in_biomechanics|necessary step]] to easily analyze our data and create statistical parametric maps. Since we are hoping to understand the (potential) differences between 2 groups of data, we can model it by crafting the design matrix within the GLM to suit our needs. Sift automatically creates a categorical design matrix, that is, one where each grouping is selected. This will lead to a regression which calculates the means, based on these groupings. The residual matrix can then be easily calculated, and we have obtained our GLM. {{ :GLM_Dialog.png?500}} This process is completed through the following steps: - On the SPM tab, within the [[Sift:application:Analyse_Page|Analyse Page]], select the groups and workspaces you want to include in your GLM - For our analysis, select the OA and NC, and all Workspaces - Select Create GLM - Enter the following into the GLM Dialog: * GLM Name: GLM * Group By: Group * The Groups Selected should be OA and NC - Select Create GLM You will then repeat this process for the registered data: - On the SPM tab, within the [[Sift:application:Analyse_Page|Analyse Page]], select the groups and workspaces you want to include in your GLM - For our analysis, select the OA_Registered and NC_Registered, and all Workspaces - Select Create GLM - Enter the following into the GLM Dialog: * GLM Name: GLM_Registered * Group By: Group * The Groups Selected should be OA_Registered and NC_Registered - Select Create GLM The Mapping sub-tab within the SPM Tab should now be populated, along with the charts. We can clearly see the mean signals, as well as the corresponding Residuals. We may also notice a reduction in the average residual values, indicating that our curve registration has been successful in reducing the time variation in our dataset. {{:GLM_Plots.png?800}} === Analysis === To begin creating our SPMs, we will move to the Statistics sub-tab. This is where we will run our statistical tests, and gain the real insights into our data. As mentioned, we want to understand if there is a difference in the flexion-Extension of the knee in OA patients versus a Normal Control group. A classical method of comparing 2 groups is to use the Student's t-test, which can be used to understand if the difference between 2 groups is statistically significant. Doing a t-test through SPM allows this to be extended from a single summary metric, and into a continuous statistic across the entire time domain we are analyzing. We will perform two unpaired t-tests, comparing the registered traces to each other, and unregistered traces to each other. {{ :SPM_Dialog.png?300}} To complete these SPMs: - Select GLM: GLM - Select Compute SPM - Enter the following into the SPM Dialog: - For unregistered data: * SPM Name: SPM * Statistic: t Statistic * Group 1: OA * Group 2: NC - Select GLM: GLM_Registered - Select Compute SPM - Enter the following into the SPM Dialog: - For registered data: * SPM Name: SPM_Registered * Statistic: t Statistic * Group 1: OA_Registered * Group 2: NC_Registered We have now calculated two SPMs, which we can easily compare/contrast by selecting the GLM and SPM Results we want in the top bar of the SPM tab. Both SPMs provide us with similar insights: there is a statistical difference between the 2 groups, and it is most prominent during mid-stance(roughly 10%-25% of the gait cycle), as well as mid-swing (roughly 55%-85% of the gait cycle). For the given threshold (defaults to alpha=0.01), we have established that there is a difference between the 2 groups (more precisely, we determined that the null hypothesis that the 2 groups are from the same population sample is false at alpha<0.01). {{:SPM_Plot1.png?800}} The difference between both SPMs is most apparent at ~65% of the gait cycle. Here we can see a significantly more pronounced t statistic (~10 vs ~12.5). While both are well above the specified threshold where alpha=0.01, this can show us how curve registration can be useful to correctly align our data, and get more meaningful results from our analysis. {{:SPM_Plot2.png?800}} We should note that a similar analysis could be done (within Sift) by creating a GLM containing all 4 groups, and building similar SPMs from this. These results would not exactly match, as the test statistic uses the population level variance, which is different if all 4 groups are used together than if just 2 are. Clearly SPM provides us more insight than just doing a t-test during an event, or at a maximum point, and can be a useful tool during the analysis phase of a biomechanics project. In this tutorial we explored what SPM means, how to create an SPM analysis in Sift, and some insight into the best practices for doing so.