MRtrix: how to construct a contrast matrix and design matrix for paired samples

Dear MRtrix Experts,
I have pre - and post-treatment data for statistical analysis by paired sample t-test. I’m trying to compute FBA, and would appreciate your advice on statistical matrices construction. According to the MRtrix maunal, I will run the step: fixelcfestats fd_smooth/ files.txt design_matrix.txt contrast_matrix.txt matrix/ stats_fd/ fixelcfestats log_fc_smooth/ files.txt design_matrix.txt contrast_matrix.txt matrix/stats_log_fc/ fixelcfestats fdc_smooth/ files.txt design_matrix.txt contrast_matrix.txt matrix/ stats_fdc/. However, I don’t know how to construct the design_matrix.txt and contrast_matrix.txt. I would be very grateful if you could give me some advice.
In addition, I don’t know whether the following way to build the matrix is correct, I need your advice (Take three pairs of data as an example)
1 1 0 0
1 0 1 0
1 0 0 1
-1 1 0 0
-1 0 1 0
-1 0 0 1
1 0 0 0
-1 0 0 0

Sincerely hope to get your advice, I would be very grateful.

I struggled with this as well but discussed it with some MRtrix experts and we came up with the following method for doing statistics for a study that consists of 2 timepoints for each subject and where all subjects belong to 1 group (so only patients for example) :

  • first calculate difference images from the smoothed FDC files for each subject
  • then your design matrix is just 1 column with “1” for every subject since every subject belongs to the same group
  • the contrast matrix is then “1” if you expect timepoint1-timepoint2 to be positive or “-1” if you expect the difference to be negative

You also have to add <-errors ise> in the command, since the default for handling errors is an ee algorithm. You can find more info on this in: Redirecting

Dear GreetV
I wanted to extend my heartfelt thanks to you who responded to my query regarding the design matrix for paired sample t-tests. Your guidance and expertise have been incredibly valuable and have significantly aided in my research. I will try this method for doing statistics .
Can I understand it this way?—first calculate difference images and then do the one sample t-test. I think it’s great and thoughtful. In addition, I would like to ask if there is no direct design matrix for paired sample t test like independent sample t test. What kind of errors would occur if the design matrix and contrast matrix generated by the FSL software were used directly.
Thank you once again for your support and willingness to share your knowledge.
Best regards

Dear sunshine,

Indeed this is a way for doing a one sample t-test on the longitudinal differences. You can also perform a paired analysis (although in my experience the results are highly similar):

In that case you list the files as (example for two cases):

The design matrix would then be:
1 1 0
0 1 0
1 0 1
0 0 1

The contrast matrix would be:
1 0 0

Of course you add columns to your design and contrast matrix depending on the number of subjects.

Good luck!

Dear Professor GreetV

I hope this email finds you well.

I wanted to take a moment to express my sincere thanks for your continued assistance and expertise. Your recent responses have been incredibly helpful and have significantly enhanced my understanding of MRtrix. I truly appreciate your dedication and the time you’ve taken to provide such detailed and insightful answers.

Thank you once again for your invaluable support.

Best regards