0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
60 stars 21 forks source link

Paired t-test with covariate #280

Closed nickie0911 closed 2 months ago

nickie0911 commented 4 months ago

Hi, I want to do a paired t-test with one covariate. By reading previous posts I figured out that GLM might be the best choice to implement this. Is this correct or do I need to use another test?

I am employing a pre-post study design to assess alterations in joint angles resulting from the intervention. However, during the test procedure, participants traversed overground, and some exhibited variations in gait velocity post-intervention compared to pre-intervention. Consequently, I aim to account for these changes in gait velocity by incorporating it as a covariate. For a sample size of n=20, my dataset would comprise the following components, taking knee angle as an example: A = 20x101 (pre-intervention knee angle), B = 20x101 (post-intervention knee angle), C = 20x1 (pre-intervention gait velocity), D = 20x1 (post-intervention gait velocity).

As I am not very familiar with GLM can you please provide example code for the above described data structure?

0todd0000 commented 4 months ago

Sorry for the delay! Yes, indeed the GLM function can be used.

There is a brief GLM example here. The key is to create a design matrix X and a contrast vector c that are appropriate for your experiment.