User Tools

Site Tools


sift:tutorials:bathuniversity:statistical_power_analysis_changing_gradients_and_speeds

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sift:tutorials:bathuniversity:statistical_power_analysis_changing_gradients_and_speeds [2026/08/26 13:56] – removed - external edit (Unknown date) 127.0.0.1sift:tutorials:bathuniversity:statistical_power_analysis_changing_gradients_and_speeds [2026/08/26 13:56] (current) – ↷ Links adapted because of a move operation wikisysop
Line 1: Line 1:
 +======= A Statistical Power Analysis on Lower Limb Kinematic Comparisons Across Changing Gradients and Speeds =======
 +
 +===== Abstract =====
 +An open-sourced dataset from the University of Bath including full body kinematics and ground reaction forces of fifty heterogeneous runners completing treadmill running at various speeds and gradients. This tutorial demonstrates how Visual3D, Sift and {{https://jiku.pro/|Power1D (Jiku)}} can be used to conduct a statistical power analysis to assess whether changing speed and gradient have a larger affect on running kinematics.
 +
 +===== Data =====
 +Data assessed for this processing included: 
 +    * A 3D ground reaction force data (1000Hz) collected on a gradient adjustable split belt Bertec instrumented treadmill
 +    * A full body markerset (250Hz) using 12 Qualisys Miqus cameras tracked via Qualisys Track Manager 2022
 +The dataset can be downloaded using [[https://researchdata.bath.ac.uk/1341/|BathUniversity Dataset]] which contains a zip file for each participant with the trial .c3d files and a participant info .csv file. 
 +
 +====== Creating CMZ Workspaces in Visual3D ======
 +===== Step 1: Create Model =====
 +A new model was created following the recommendations from [[visual3d:tutorials:modeling:building_a_6_dof_model|Building a 6DOF Model]] tutorial, which was then saved as a .mdh file. A few specific changes were made to the model that should be highlighted
 +    * Virtual feet markers were created as the foot segment was below the platform
 +    * Additional tracking markers on the feet were added as they disappeared often during dorsiflexion
 +    * Segment coordinate systems were modified to have A/P Axis = +Z and Distal to Proximal = -Y
 +
 +Here is the model template file used in this tutorial: [[https://has-motion.com/wiki/lib/exe/fetch.php?media=sift:tutorials:bathuniversity_project:bathmodel_virtual.zip|model.mdh]]
 +
 +===== Step 2: Create a Processing Pipeline =====
 +Set up a typical processing pipeline, which can be done following the recommendations of [[visual3d:documentation:pipeline:pipeline_overview]] Wiki page. The outlined pipeline highlights the commands used to process the data, which was saved as a .V3S file using the Save Pipeline As button under Pipeline
 +
 +Here is the processing pipeline file used in this tutorial:
 +[[https://has-motion.com/wiki/doku.php?ns=sift%3Atutorials%3Abathuniversity_project%3A&image=sift%3Atutorials%3Abathuniversity_project%3Apipeline.zip&do=media&tab_files=files&tab_details=view|Pipeline.v3s]]
 +
 +Interpolate: add SIGNAL_TYPES to TARGET
 +
 +{{..:bathuniversity_project:pasted:20260626-134155.png}}
 +
 +Lowpass Filter: add SIGNAL_TYPES to TARGET and SIGNAL_FOLDER to PROCESSED
 +
 +{{..:bathuniversity_project:pasted:20260626-134454.png}}
 +
 +Use Processed Analog: add USE_PROCESSED to TRUE
 +
 +{{..:bathuniversity_project:pasted:20260626-134718.png}}
 +
 +Lowpass Filter: add SIGNAL_TYPES to ANALOG
 +
 +{{..:bathuniversity_project:pasted:20260626-134701.png}}
 +
 +FP Auto Baseline: add FP_NUMBER to 1+2
 +
 +{{..:bathuniversity_project:pasted:20260626-134936.png}} 
 +
 +Modify force platform parameters: click edit and select get current C3D parameters
 +
 +{{..:bathuniversity_project:pasted:20260626-135115.png}}
 +
 +Recalc: default parameters
 +
 +Automatic gait events: default parameters
 +
 +Assign tags to file: each trial had two sets of tags applied, one for the gradient/type (uphill run, flat run, downhill run, walk) and speed (slow, norm, fixed, fast). Tags were made seperately and applied using a file mask such as *uphillrun*. This finds any .c3d files that have "uphillrun" in the file name.
 +
 +{{..:bathuniversity_project:pasted:20260626-140049.png}}
 +
 +Compute model based data: similar to assigning tags, computing model based data was computed individually for the left and right side as well for the metrics that you want to calculated, Add RESULT_NAME as "the name of metric" such as Left_Knee_Angle, add SUBJECT_TAG as ALL_SUBJECTS, add FUNCTION as "type of metric" such as Joint Angle (chosen from list under model based item properties), add SEGMENT as "the proximal segment" such as Left Shank (LSK) , add REFERENCE_SEGMENT as "distal segment" such as Left Thigh (LTH), add RESOLUTION_COORDINATE_SYSTEM, for left side only add NEGATEY and NEGATEZ as TRUE (as it is opposite to global coordinate system)
 +
 +{{..:bathuniversity_project:pasted:20260626-141125.png}}
 +
 +Save pipeline as .vs3 and save workspace .cmz
 +
 +
 +===== Step 3: Batch Process all Data Files through Sift's Command Line =====
 +
 +To repeat the steps from Visual3D for all the participants, this can be completed in Sift by selecting Load Data and the correct Library path. 
 +
 +{{..:bathuniversity_project:pasted:20260819-181458.png}}
 +
 +Each participant should have their own folder with all the .c3d files for each movement. 
 +  * Select Build CMZs to create a workspace for each participant
 +  * Select Make Hybrid Model by choosing the .mdh file created in Visual3D to create models from the Static files for each participant assuming the marker names are the same. 
 +  * Select Add V3S scripts and add the pipeline that was created and saved under step 2. 
 +
 +Another option is to build CMZ files within the command line Locate Sift within the command pipeline and then run the code below in the Sift noGUI following the [[sift:tutorials:openbiomechanics_project:build_cmz_files_command_line|Build CMZ Files Command Line]]
 +
 +The steps for running CMZ build are:
 +  - **Make Hybrid Model:** selects the model.mdh file, static file ID, dynamic file ID, and current file directory
 +  - **Add Metadata:** select participant info.csv file which is used to set metrics and tags
 +  - **Add V3D script:** selects pipeline.v3s script
 +  - **Build CMZ:** execute file to create CMZ files for each participant
 +
 +<code>
 +
 +-MakeHybridModel modelTemplateFile "C:\Users\...\modeltemplate.mdh" staticFileID "*Static*.c3d" dynamicFileID "*.c3d" currentFileDirectory "C:\Users\...\FolderLocation\" -AddMetaData metaFile "C:\Users\...\Participant_Info.csv" settingsFile "C:\Users\...\participantinfo_metadata.xml" -AddV3DScript scriptFile "C:\Users\...\pipeline.v3s" -buildCMZ directory "C:\Users\...\FolderLocation\" 
 +
 +</code>
 +
 +====== Analysis in Sift ======
 +===== Create Queries =====
 +Once CMZ files are built, open Sift from the GUI and load the library. 
 +
 +Next step is to create the queries to have groups separated by trials and the link model based calculations. This will allow groups to be easily compared between different conditions and metrics. 
 +
 +This is done by opening the Explore tab on the left and select Query Builder. Follow along [[sift:tutorials:openbiomechanics_project:refine_queries_with_metadata|Refine Queries]] by selecting Auto-Populate Queries through refinements of tags. To add multiple tags within the groups, edit the conditions and go under the refinement tab to select **Refine using tag** and **Use AND Logic** and select the speed and gradient tag to create as one group. 
 +
 +{{..:bathuniversity_project:pasted:20260729-142020.png}}
 +
 +For example, we assessed the knee joint angle in the X direction (flexion/extension) for each of the trials as separate groups. This allowed us to select multiple groups to compare either changing speed (ex. Downhill Fast, Downhill Slow and Downhill Norm) or changing gradient (Downhill Slow, Uphill Slow, Flat Slow). Each workspace within these groups represents an individual participant (CMZ file).
 +
 +{{..:bathuniversity_project:pasted:20260819-194918.png}}
 +
 +Here is the query builder file used in this tutorial: [[https://has-motion.com/wiki/doku.php?ns=sift%3Atutorials%3Abathuniversity_project%3A&image=sift%3Atutorials%3Abathuniversity_project%3Arun_kneexja_queries.zip&do=media&tab_files=files&tab_details=view|Queries.q3d]] to match the groups above.
 +
 + 
 +
 +===== Clean Data =====
 +In Explore tab, you can visualize your data by selecting the group of interest then selecting all workspace (button). You can also view a single workspace. 
 +
 +If there are any traces that appear visually as outliers, they can be removed within the graph. To clean the data, start by selecting the trial(s) that had issues and right click -> Exclude Trace (raw data) to remove any incorrect trials.
 +
 +{{..:bathuniversity_project:pasted:20260729-142203.png}}
 +
 +Alternative anomaly and outlier detection methods can be found from the [[https://has-motion.com/wiki/doku.php?id=sift:sift_overview:anomaly_detection|Anomaly Detection]] wiki page. 
 +
 +
 +{{..:bathuniversity_project:pasted:20260729-142746.png}} -> {{..:bathuniversity_project:pasted:20260729-142821.png}}
 +
 +Once data is cleaned you can update CMZ data. This is shown through the [[sift:tutorials:clean_your_data|Clean Data]] tutorial page to update a clean dataset. This is done by clicking the Update CMZ Files which will open this dialog:
 +
 +{{..:bathuniversity_project:pasted:20260728-172835.png}}
 +
 +Select Excluded Traces and Add Event to Exclude Signals which is defined as BAD. This will tag the bad data helping to exclude those signals that are defined as "BAD". The click Run Pipeline which will update the dataset. 
 +
 +===== PCA =====
 +Once the data is cleaned up, we can finally answer our question whether there is any explanation or statistically meaningful differences across gradients and speeds. Principal Component Analysis can be used to find components within the dataset that explain variance, specially which areas show variance. 
 +
 +In Analysis tab, select the groups you want to compare and select PCA icon in the toolbar. Follow [[sift:tutorials:perform_principal_component_analysis|PCA]] tutorial to run analysis. 
 +  - Set name for PCA
 +  - Set Number PCs to 3 (variance explained over 90%)
 +  - Set Use Workspace Mean
 +
 +Results will popup
 +
 +{{..:bathuniversity_project:pasted:20260729-154029.png}}
 +
 +Results of PCA can be interpreted as explained in [[sift:application:analyse_page|Analysis]] page
 +
 +===== SPM =====
 +Statistical Parametric Mapping is also another example of identifying regions throughout the waveform where groups or conditions that show variance, however its benefit is showing whether those regions have statistically significant differences. 
 +
 +Continue with analysis by selecting SPM icon in the toolbar. Follow [[sift:tutorials:perform_statistical_parametric_mapping|SPM]] tutorial for more information
 +   - Set name for GLM
 +   - Use Two-Sample T-Test (comparing two independent group)
 +   - Select the groups for comparison
 +   - Set Use Workspace Mean
 +
 +{{..:bathuniversity_project:pasted:20260729-153053.png}}
 +
 +Head to Statistics and select Compute SPM
 +   - Set SPM name
 +   - Select Downhill_Fast as Group 1 and Downhill_Slow as Group 2 (can be interchangeable) 
 +   - Set Threshold to 0.05
 +   - Click Two-Tailed
 +   - Create SPM
 +
 +{{..:bathuniversity_project:pasted:20260729-154850.png}}
 +
 +Results of SPM can be interpreted as explained in [[sift:application:analyse_page|Analysis]] page
 +
 +====== Project Question ======
 +===== Does variation of speed or gradient have a larger effect on changes in knee joint kinematics? =====
 +| Changing Speed - Fast vs Slow | Changing Gradients - Downhill vs Uphill |
 +| {{..:bathuniversity_project:pasted:20260729-171527.png}} | {{..:bathuniversity_project:pasted:20260729-171605.png}} |
 +| Large variance in PC1 | Variance in both PC1 and PC2 |
 +| {{..:bathuniversity_project:pasted:20260729-181848.png}} | {{..:bathuniversity_project:pasted:20260729-172935.png}} | 
 +| {{..:bathuniversity_project:pasted:20260729-182259.png}} | {{..:bathuniversity_project:pasted:20260729-182400.png}} |
 +| Highest variance at the peak flexion angle during the stance phase | Highest variance during the swing phase |
 +
 +Changing gradients (ex. Running at slow pace uphill vs downhill) shows variance in both PC1 and PC2, while changing speed (ex. Running downhill at fast vs slow pace) shows variances in only PC1. When separating PCs using the Extreme Plot section of PCA analysis we can see PC1 explains variance in the peak joint angle, while PC2 explains phase shift
 +
 +Changing Gradients - Running slow pace uphill vs downhill
 +| PC1 | PC2 |
 +| {{..:bathuniversity_project:pasted:20260729-182733.png}} | {{..:bathuniversity_project:pasted:20260729-182641.png}} | 
 +
 +====== Analysis in Jiku ======
 +===== Jiku =====
 +Although we have determined whether regions of the waveform have significant statistical differences, we can also estimate the probability that the experiment will correctly detect a true effect. This can help determine the proper sample size needed to avoid false-negative without wasting resources. 
 +
 +
 +Jiku Power1D is a statistical power analysis tool for one-dimensional continuum data. It is easily integrated with Sift, allowing you to complete your analysis seamlessly. Head to https://github.com/jiku-pro/releases-power1d/releases to download Power1D. 
 +
 +   - Open up Power1D
 +   - Select two-sample 
 +   - In the Explore tab from Sift, you can move the data into Power1D by selecting the group or workspace of interest. Click Shift and Ctrl to drag the group into Group A within Jiku Power1D. Do the same into Group B with the second group of interest you want to compare
 +   - Choose ImportedDatum in the dropdown selection
 +
 +{{..:bathuniversity_project:pasted:20260729-184850.png}}
 +
 +Head to Analysis
 +   - Select Power Mode
 +   - Leave Alpha at default value of 0.05. This signifies the significance level, which is the chosen risk tolerance for a false positive. This means there is an accepted 5% chance of finding a significant effect when non actually exists. 
 +   - Leave Iterations at 5000. This defines the number of times the computer simulator repeats a test. In each single iteration, the simulator tests both the null model (no effect) and the alterative model (true effect)
 +   - Lead Seed at 0, and select Seed Lock. This is the initial number used to start the random number generator. Keeping it the same means the software will create the exact same random noise and graphs again. 
 +   - Change sample size mode to Absolute
 +   - Use Sift Workspace to determine how many samples are used. Choose {{..:bathuniversity_project:pasted:20260729-194755.png}} icon in Sift and change **Display type for excluded data** to Fraction. Add all the denominators of the fractions for each of the workspace to determine the total number of samples used. 
 +
 +{{..:bathuniversity_project:pasted:20260729-194908.png}} 
 +
 +Example. For one participant comparing running downhill at fast (Group A) vs slow (Group B) pace, Power1D will look like this. Click Run to simulate data. 
 +
 +{{..:bathuniversity_project:pasted:20260729-195231.png}}
 +
 +
 +This will popup Results
 +
 +{{..:bathuniversity_project:pasted:20260729-195403.png}}
 +
 +and Distribution
 +
 +{{..:bathuniversity_project:pasted:20260729-195414.png}}
 +
 +**Results** indicate the power at each point across the domain. Domain represents time or cycle %. Non zero power means true effect is detectable at both maximal values and neighbouring values. Omnibus power represents the probability that the null hypothesis will be rejected in a large number of experiments. This is shown as the proportion of the h1 distribution that lies above the critical value. 
 +
 +There are two **distributions**. Distribution in gray represents the null hypothesis (h0), while distribution in blue represents alternative hypothsis (h1). The distribution represents the proportion of Zmax that exceeds the critical value meaning the null hypothesis is rejected. 
 +
 +
 +
 +
 +
 +
 +
 +   
 +
 +