# FBA design / contrast matrices for three groups

**URL:** <https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791>\
**Category:** Uncategorized\
**Created:** [July 26, 2018, 6:13pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791 "2018-07-26T18:13:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olga](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://community.mrtrix.org/u/Olga)\
**Post date:** [July 26, 2018, 6:13pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/1 "2018-07-26T18:13:10Z")

</div>

Hello experts!

I’m trying to compute FBA, and would appreciate your advice on statistical matrices construction. We have three groups: typical population (T), disease population (D), and disease-related (Dr) population. My first version of design matrix is this:

1 1 0 0  
1 0 1 0  
1 0 0 1

Where the first column is intercept, the second is T group, the third is D group, and the fourth is Dr group. N lines for N subjects.  
The contrast matrix for me to see the difference between groups:

(1) D \> T 0 -1 1 0 (2) D \< T 0 1 -1 0  
(3) Dr \> T 0 -1 0 1 (4) Dr \< T 0 1 0 -1

Now comes the puzzle. Since fixelcfestats only accepts a single contrast, will I need to run the analysis twice? First, I will run (1) and (2) (supplying (1) and requesting -negative output as well), and then run (3) and (4) in the same manner? My question is whether this would be a correct way of running this type of analysis.

Thank you!

Olga

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [August 15, 2018, 4:53am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/2 "2018-08-15T04:53:56Z")

</div>

Hi Olga,

This design matrix may misbehave as it is rank-deficient: the sum of columns 2-4 is equivalent to column 1, and therefore there are an infinite number of solutions for the beta values. While the GLM code is designed to still work in such circumstances, and due to the nature of your intended contrasts it shouldn’t actually have an effect on your t-values, it’s nevertheless avoided as best practise.

You could simply omit the first column entirely:

```auto
1 0 0
1 0 0
0 1 0
0 1 0
0 0 1
0 0 1

```

(for two subjects in each group)

Moreover, while you have three groups in your experiment, none of your hypotheses actually require all three groups to be present in the model at the same time; and `fixelcfestats` can’t (currently) test more than one hypothesis at a time. So you could simply construct two separate design matrices: One for comparing T and D, one for comparing T and Dr; then run `fixelcfestats` separately for each.

Rob

---

<div class="post-metadata">

**Author:** ![Olga](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://community.mrtrix.org/u/Olga)\
**Post date:** [August 16, 2018, 4:51pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/3 "2018-08-16T16:51:05Z")

</div>

Hi Rob,

Thank you! That’s what I ended up doing. 😄 Watched a bunch of Jeanette Mumford’s brain stats videos, and read a lot of GLM theory… 😉

If you don’t mind, can I piggyback on here with a couple of questions? First, I’m a little pained by the FWE correction. Is there an option to use FDR instead?

Second, may be a little silly question, but being new to these processes I’m trying to gain a thorough understanding of it all. 🙂 I ran a simple correlation using a single group to see if some behavioral measures associate with WM “integrity” (for lack of a better word…). The results look interesting, but I could not wrap my head around what the absolute effect output would mean in this scenario. I “discovered” it’s identical to my beta of interest. Am I understanding it right that it just is designed to create this output?

Thanks!

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [August 17, 2018, 1:19am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/4 "2018-08-17T01:19:07Z")

</div>

> Watched a bunch of Jeanette Mumford’s brain stats videos, and read a lot of GLM theory

I’m sure there’s plenty of people on here interested in better understanding the GLM - and I don’t really want to spend an inordinate amount of time writing documentation on it - so if you can provide links to what you found useful I’m sure I’m not the only one who would be appreciative 🤗

> I’m a little pained by the FWE correction. Is there an option to use FDR instead?

Currently no. I suppose it would technically be possible, but would require someone motivated enough to do it.

> … I could not wrap my head around what the absolute effect output would mean in this scenario. I “discovered” it’s identical to my beta of interest. Am I understanding it right that it just is designed to create this output?

The “absolute effect” is the inner product of the beta values with the contrast vector. So if your contrast is a single “1” and zeroes in all other columns, then yes it is identical to the beta value of that column. In certain circumstances it can be used in [certain calculations](https://mrtrix.readthedocs.io/en/latest/fixel_based_analysis/computing_effect_size_wrt_controls.html) and/or have a certain interpretation, but it’s best understood from the underlying fundamental mathematics.

---

<div class="post-metadata">

**Author:** ![Olga](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/57b2e6/32.png) [@Olga](https://community.mrtrix.org/u/Olga)\
**Post date:** [September 6, 2018, 1:40am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/5 "2018-09-06T01:40:29Z")

</div>

Rob,

Thanks for detailed response!

Here is the youtube channel which is very helpful in my statistical inquiries. [https://www.youtube.com/channel/UCZ7gF0zm35FwrFpDND6DWeA](https://www.youtube.com/channel/UCZ7gF0zm35FwrFpDND6DWeA)

I hope people find it useful.

Thanks,  
Olga

---

<div class="post-metadata">

**Author:** ![silver\_mark](https://community.mrtrix.org/user_avatar/community.mrtrix.org/silver_mark/32/2877_2.png) [@silver\_mark](https://community.mrtrix.org/u/silver_mark)\
**Post date:** [September 20, 2020, 7:35am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/6 "2020-09-20T07:35:11Z")

</div>

Hi,Olga  
I’m glad to see your post when I’m wondering how to set design\_matrix and Contrast\_matrix.  
So,in the end,because of my poor comprehension ability, I didn’t know how to set design\_matrix and Contrast – matrix.Can you give me some advices?  
Or,a concrete example is given(Group A:001\_control,002\_control,003\_control;Group B:001\_patient,002\_patient,003\_patient),how to set this example’s two matrix?  
Last question, How to implement FWE correction?

Thanks!  
Silver

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 1, 2020, 1:10am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/7 "2020-10-01T01:10:25Z")

</div>

Hi Silver,

From your brief description it looks like you’re doing just a basic [two-group difference](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GLM#Two-Group_Difference_.28Two-Sample_Unpaired_T-Test.29)?

> Last question, How to implement FWE correction?

This is not something that you yourself need to “implement”; the `fixelcfestats` command performs FWE correction and provides you with FWE-corrected _p_-values.

Rob

---

<div class="post-metadata">

**Author:** ![silver\_mark](https://community.mrtrix.org/user_avatar/community.mrtrix.org/silver_mark/32/2877_2.png) [@silver\_mark](https://community.mrtrix.org/u/silver_mark)\
**Post date:** [October 6, 2020, 8:06am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/8 "2020-10-06T08:06:04Z")

</div>

Hi Rob,  
I’m glad you can answer my question.  
Yes,I’m looking at FIXEL changes in the same group of patients at different points in time,so I use paired T-test.At the samt time,I am also examining FIXEL differences between this patient group and the healthy group (inconsistencies in number),so I use unpaired T-test.

NOW,I have a question:  
Shouldn’t the FWE corrected P value appear after the uncorrected P value?But why is it now that the corrected P value appears first?

 ![image](https://community.mrtrix.org/uploads/default/original/2X/d/db5cad6c7bcb554ade230972187195163b3a0077.png)

Silver

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 8, 2020, 5:28am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/9 "2020-10-08T05:28:21Z")

</div>

> I’m looking at FIXEL changes in the same group of patients at different points in time,so I use paired T-test.At the same time,I am also examining FIXEL differences between this patient group and the healthy group (inconsistencies in number),so I use unpaired T-test.

These are two very different experiments; and it’s not just the design matrix that differs between the two, but also the nature of the model errors that determine how shuffling should be done. So if you’re still unsure how your GLM should be set up across multiple experiments, make sure that you describe all such experiments.

> Shouldn’t the FWE corrected P value appear after the uncorrected P value?But why is it now that the corrected P value appears first?

What you’re looking at there is purely the time at which the file is first created on the filesystem, which is not guaranteed to be in the same order as that in which they are computed, depending on exactly how the code is written. In this case, you [can indeed see in the code](https://github.com/MRtrix3/mrtrix3/blob/3.0.0/cmd/fixelcfestats.cpp#L480-L482) that `uncorrected_pvalue.mif` is written after `fwe_1mpvalue.mif`.

However I’m going to infer from your question that you were in fact expecting the former to be written _a long time before_ the former, since it “doesn’t require FWE correction” and therefore should have been calculated and written a long time before the FWE-corrected _p_-values. However the uncorrected _p_-values still require computing all shuffles of the data. The uncorrected _p_-value is the fraction of shuffles for which the enhanced test statistic in that fixel was greater than that in the unshuffled data; whilst this may be independent of all other fixels (and hence “uncorrected”), it still requires performing all shuffles. Hence why they’re written to the filesystem at approximately the same time.

Rob

---

<div class="post-metadata">

**Author:** ![silver\_mark](https://community.mrtrix.org/user_avatar/community.mrtrix.org/silver_mark/32/2877_2.png) [@silver\_mark](https://community.mrtrix.org/u/silver_mark)\
**Post date:** [October 12, 2020, 2:32pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/10 "2020-10-12T14:32:51Z")

</div>

Hi,Rob

> [@rsmith](#):
>
> So if you’re still unsure how your GLM should be set up across multiple experiments, make sure that you describe all such experiments.

I’m sorry to bother you with these simple questions.Thank you very much for your kindness to answer my questions.  
OK,I will describe my experimental setup in detail.  
I have data on 37 patients at four different points in time.Like:

 ![image](https://community.mrtrix.org/uploads/default/original/2X/1/14c1689d384921f1ccffee3fcebbde908e6880a7.png)

and I have 15 healthy controls data at basedline.  
I want to compare 37 patients pre-therapy data and 15 controls data(I use unpaired two-sample T-test).What’s more,I want to compare the 37 patients at each point in time, and I want to do a pairwise comparison(like,pre-therapy vs post-treatment,post-treatment vs 3 months later…6 conditions in total) so I am going to do the paired two-sample T-test 6 times.  
Take an example of a situation:(pre-therapy vs post-treatment)(I just take two patients’ data at two time as example,like:patient1:data1.1 data1.2 ; patient2:data2.1 data2.2 )(FD comparision)

design\_matrix:  
1 0  
1 0  
0 1  
0 1

contrast\_matrix:  
1 -1

I know that with so little data, the results are not statistically significant.I just want to familiarize myself with the steps of the analysis process and the setup of the design and contrast matrix.

So,I get these results:  
 ![image](https://community.mrtrix.org/uploads/default/original/2X/4/4de00197edaf210fce9fcb35fd35ace4a2f742ec.png)

I know what the uncorrected\_pval.mif means and the fwe\_1mpvalue.mif represents the FWE corrected P value.Actually,These two P values are (1-P).

 ![image](https://community.mrtrix.org/uploads/default/original/2X/4/47f04fda2423c755f0db76a20b2e3da0c646553f.png)

And I mrview wmfod\_template.mif and use fixel plot to overlay fwe\_1mpvalue.mif.  
I have some questions about this:  
1.The image 1 shows the results I got using the MRView command directly.  
2.Do files with “Colour by”, “Thersholds” and “Scale by” boxes have to be the same?(Like image 2)  
Should the minimum threshold of 0.95 be set this way?(Like image 2)

 ![image](https://community.mrtrix.org/uploads/default/original/2X/a/a9a2ec59cf786a5b50f5dd8fc1afbcd7aa9659b3.png)  
 ![image](https://community.mrtrix.org/uploads/default/original/2X/a/abef38a577ea36059784b435500df2cf11b76427.jpeg)

Lastly,I would like to show significant differences in streamlines according to FIXEL with significant differences, is there any relevant tutorial?(I have performed whole-brain fibre tractography on the FOD template and performed SIFT to reduce tractography biases in the whole-brain tractogram)

 ![image](https://community.mrtrix.org/uploads/default/original/2X/b/bcb15fc189aac9055c4c85d40131453b1ed1da20.jpeg)

Silver

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 14, 2020, 5:39am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/11 "2020-10-14T05:39:21Z")

</div>

> I want to compare 37 patients pre-therapy data and 15 controls data(I use unpaired two-sample T-test).

Yep, that’s fine; commonplace two-sample unpaired t-test.

> What’s more,I want to compare the 37 patients at each point in time, and I want to do a pairwise comparison (like,pre-therapy vs post-treatment,post-treatment vs 3 months later…6 conditions in total) so I am going to do the paired two-sample T-test 6 times.

So there’s a couple of points to raise from here. Neither of which are actually _specific_ to your experiment, but given you’ve shown your setup I think it’s a good exemplar upon which to explain to a wider audience.

1. While you _can_ do as you’ve described, it’s worth interrogating whether or not it is in fact what you _want_ to do (if fully informed of the scope of possibilities). What I’m going to be poking and prodding at here is whether or not there has appeared a divergence between the processing that you intend to apply to your data, and the fundamental hypotheses you want to test that necessitated the collection of those data.

2. Something that’s been bugging me for a long time is the issue of false positive control in FBA, and it stands out particularly in your proposal.

* * *

> 2.Do files with “Colour by”, “Thersholds” and “Scale by” boxes have to be the same?(Like image 2)

Definitely no. It’s very intentionally designed in this way. This is a strong benefit of the [fixel directory format](https://mrtrix.readthedocs.io/en/3.0.2/fixel_based_analysis/fixel_directory_format.html), as `mrview` immediately provides the drop-down list of files available for modulating the visual properties of each fixel.

> Should the minimum threshold of 0.95 be set this way?(Like image 2)

Yes, that’s correct; though colouring fixels by _p_-value is less common, and modulating fixel length based on _p_-value is less common again.

> Lastly,I would like to show significant differences in streamlines according to FIXEL with significant differences, is there any relevant tutorial?

[https://mrtrix.readthedocs.io/en/3.0.2/fixel\_based\_analysis/displaying\_results\_with\_streamlines.html](https://mrtrix.readthedocs.io/en/3.0.2/fixel_based_analysis/displaying_results_with_streamlines.html)

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![silver\_mark](https://community.mrtrix.org/user_avatar/community.mrtrix.org/silver_mark/32/2877_2.png) [@silver\_mark](https://community.mrtrix.org/u/silver_mark)\
**Post date:** [October 15, 2020, 3:51am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/12 "2020-10-15T03:51:04Z")

</div>

Yes.Thank you for your patient and detailed answer.  
Undoubtedly,I know how to set design matrix and contrast matrix when I want to achieve [two-sample unpaired T-test](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GLM#Two-Group_Difference_.28Two-Sample_Unpaired_T-Test.29).

Yes,what I want to do is:  
1、Compared patients(pre-treatment vs controls) using two-sample unpaired T-test in fixel.Like this image(Page 7 in [this article](https://watermark.silverchair.com/awx355.pdf?token=AQECAHi208BE49Ooan9kkhW_Ercy7Dm3ZL_9Cf3qfKAc485ysgAAAqIwggKeBgkqhkiG9w0BBwagggKPMIICiwIBADCCAoQGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMY1PnhzTYIjuG1L5BAgEQgIICVR2gT6JgcdblZsEhBdWhrHjUg0V2OFf5MO1ZLKGuXBWO1hMXbzP_ACrgst46OxEOJJrBhf7ewuC28kbRaZln4u5mDbKX4KiN3fOnxlr9m6N-auhbcjmCjlXWCmbcuqFdWcMT6Mj2K6x7OPFrt1Wg4tlLi4ZvasOmCY_Kk_wFK4EZ6--rcUs6xWdJYinuK1cTAsJjDyAAEm3kaUCK2fC2a-9sp3GMdTuWT-fmshAg5gH3UwwxLYQrJvFnJsEE4Ut9kptagraTOq7T4z4BCcuIh3tzMDubvRUYpvc8hRXyDSo5JFI0qf6S2YBI8B-YKYRyDyIXtGPRQ89336jgyMxmJRboLr33YDUphwbU1pk3vVPpSj6WCjUAbQ8KiZWeluum6_6IsWbaZbpbs_lOMzgmdKVSuT2MKfFvyLjgn9o_KiZ-Mo0R59w08k4M9iQibUq7hOHugUCcjt_r9re5kB-u75oSTW2tFpUWvFdXFA6cRhZat-ZLdyofSB_a-CqjWePvAjDkCnbguDtVB83t11Asq3RYbIUERjzmwnHDIP8OM__ftWTKhxYsx5W5k0whbAjrBWvomhNwgHQ0OU3A-y3MV2aB8Vk6uTY73BE1WPI3D65iyqIUnzbKxbhatSl0oWmVWsegjArDYmyfnGJz5bf7M64-OyzGdAmgmUlaU0ED8fCHmEJU4Kz2eDHJyJmvR_bpNpyc5oymq7NP8QlCFOwYAFrPu25eik97wUVBIOjHvZ1pSiu3IRBSebDTPZwB7xlxBINvUyQz7N5HtogJaCR2pLgtKWVtKw))

 ![image](https://community.mrtrix.org/uploads/default/original/2X/0/0efe4745d7772f86528870761ac4f021be50d6c7.jpeg)

2、

> [@rsmith](#):
>
> For the follow-up scans, it’s not quite so obvious. Based on your current experimental proposal, particularly since you stated that you were going to test 6 conditions in total, the hypotheses you would be testing are:

The six situations you listed are exactly what I want. **At first,in order to check whether there is a significant difference between the pairings of the four time points** ,I want to do do a two-sample paired T-test for each of these six cases.  
But When I see [“Tripled” T-test](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GLM#Single-Group.2C_Three_Measurements_.28.22Tripled_T-Test.22.29),I wonder if there is “quadruple” T-test(Because I have data at four different times).If it does exit,What will its design\_matrix and Contrast\_matrix look like?(Take “5 subjects,each scanned under 4 conditions” as example)

“5 subjects,each scanned under 3 conditions” (design\_matrix and Three Contrast matrix items selected for specific situations)  
 ![image](https://community.mrtrix.org/uploads/default/original/2X/4/459fd1443827229ad48cca8c97fba39647dcbed4.png) ![image](https://community.mrtrix.org/uploads/default/original/2X/c/c0c0ed8998933431c2061bd375a806b87e76b42b.png)

3、I have a problem(Same kind of problem) showing the FWE corrected P value and P value.When I show fwe\_1mpvalue.mif on wmfod\_template.mif,I know that these two are in the same range with the red coils as is shown in the first diagram below(I am not setting **Threshold** ).When I set the minimum Threshold as 0.3(I know it should be 0.95 if I want see P value is less than 0.05),The range of colourbar displayed values has changed to a minimum of 0.66666687(as is shown in the second diagram below).I don’t know why this happened.AND,What range of values does the white coil represent?

 ![image](https://community.mrtrix.org/uploads/default/original/2X/4/4a5cb2bc3a9520c9705b64136fd04f9bc52571eb.png)  
 ![image](https://community.mrtrix.org/uploads/default/original/2X/4/41ef96a709b3274f4888097342556ea9c4430ded.png)

4、I use **two subjects** and their data on two different time to "found significant differences in streamlines according to FIXEL with significant differences ".But no streamlines with any significant changes are shown.Maybe it’s because the sample size is too small? 😅

 ![image](https://community.mrtrix.org/uploads/default/original/2X/2/2a9bcbfc8e4b2b97e0f733058b259aaecd8acb5d.png)

I encountered too many problems along the way 😪.Sorry for bothering you so many times. 😟

Silver

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 21, 2020, 2:44am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/13 "2020-10-21T02:44:03Z")

</div>

> But When I see “Tripled” T-test,I wonder if there is “quadruple” T-test(Because I have data at four different times).

Those instructions are specifically for FSL `feat`; for FSL `randomize`, to which `fixelcfestats` is more closely related, the page states that such a test is not possible in an integrated fashion. Even if it were, I think that compound symmetry would be violated in your case, since the variance between pre- & post-treatment is likely different to the variance between post-treatment and 3 month follow-up.

> When I set the minimum Threshold as 0.4(I know it should be 0.95 if I want see P value is less than 0.05),The range of colourbar displayed values has changed to a minimum of 0.66666687(as is shown in the second diagram below).

I’d need to search through the code to confirm, but I believe what’s happening here is that the manual lower colour value (0.4) is mapped to the start of the colour map (black in the case of the hot colourmap); but when the colour map overlay is drawn, it only shows the _visible portion_ of the mapping. So if, in your p-value image, there are no fixels that possess a value in between 0.4 and 0.667, then once you engage the lower threshold of 0.4, `mrview` determines that there is no purpose in drawing the portion of the colour map in between 0.4 and 0.667 because there are no fixels present with those values, and so “zooms in” on a subset of the colour map for the purpose of the overlay.

> What range of values does the white coil represent?

This is the colour map of the main `mrview` image, i.e. the WM density template image in this case. So -0.006 maps to black, 0.0 maps to a very dark grey, 0.396 (and greater) map to white. A value of ~ 0.282 (`1/sqrt(4pi)`) corresponds to a fibre density equivalent to that of the response function.

> I use two subjects and their data on two different time to "found significant differences in streamlines according to FIXEL with significant differences ".But no streamlines with any significant changes are shown.Maybe it’s because the sample size is too small?

I’m hoping that in doing so, the command will have issued a warning that based on the sample size it was unable to achieve the default number of 5000 permutations, and would instead utilise all possible permutations. In your case, the maximum number of permutations is 2. Therefore the smallest _p_-value that can be mathematically obtained is 0.50.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![silver\_mark](https://community.mrtrix.org/user_avatar/community.mrtrix.org/silver_mark/32/2877_2.png) [@silver\_mark](https://community.mrtrix.org/u/silver_mark)\
**Post date:** [November 4, 2020, 1:41am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/14 "2020-11-04T01:41:00Z")

</div>

Hi,Rob  
Thank you very much for your patience.My code has run through, but the end result is not particularly good.Significant differences in streamlines were rare.So I wrote another post asking a few questions.I hope you can give professional advice when you read this post.Finally, Thank you very much for your help.

Cheers  
Silver

---

<div class="post-metadata">

**Author:** ![OOjinaga](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/13edae/32.png) [@OOjinaga](https://community.mrtrix.org/u/OOjinaga)\
**Post date:** [October 19, 2021, 2:34pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/15 "2021-10-19T14:34:28Z")

</div>

Hi @rsmith,

This discussion thread has been extremely helpful to create my design and contrast matrices for a FBA.  
I just wanted to check if they are correct.

I am doing a between group comparison (controls (n=39) vs. patient (n=10)), controlling for age and sex. This is part of my my design matrix:

1 -0.01 0 1  
1 0.99 1 1  
1 -3.7 1 1  
-1 -5.44 0 1  
-1 0.99 0 1  
-1 -3.73 1 1

Where the first column is group (1 controls, -1 patients), then age in weeks (demeaned), then sex and lastly the intercept.

I would like to test the two hypotheses with the following contrast:

1. controls\>patients 1 0 0 0
2. controls\<patients -1 0 0 0

I am not sure about the contrasts. Also, does `fixelcfestats` still not test more than one hypothesis at a time, or can I have both contrasts in the same contrast.txt file?

Many thanks,  
Olatz

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [October 26, 2021, 12:06pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/16 "2021-10-26T12:06:34Z")

</div>

Welcome Olatz!

> I just wanted to check if they are correct.

All seems fine as far as hypothesis testing is concerned. There are however consequences to be aware of if doing anything that involves interpretation of the raw GLM beta coefficients.

> Also, does `fixelcfestats` still not test more than one hypothesis at a time, or can I have both contrasts in the same contrast.txt file?

As of version `3.0.0` ([relevant post in changelog](https://community.mrtrix.org/t/mrtrix-3-0-rc3-3-0-0-changelog/3552/3)), the contrast matrix can have multiple rows, and each is used to define a stand-alone hypothesis.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![OOjinaga](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/13edae/32.png) [@OOjinaga](https://community.mrtrix.org/u/OOjinaga)\
**Post date:** [October 26, 2021, 3:41pm UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/17 "2021-10-26T15:41:30Z")

</div>

Hi Rob,

Thank you for the support.

What would be the consequences to be aware of if I were to do anything involves interpretation of the raw GLM beta coefficients?

Best,  
Olatz

---

<div class="post-metadata">

**Author:** ![yichao](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/y/9e8a1a/32.png) [@yichao](https://community.mrtrix.org/u/yichao)\
**Post date:** [December 30, 2021, 7:10am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/18 "2021-12-30T07:10:51Z")

</div>

Hi,epxerts,  
I am a green hand. I am trying to the relationship FD,FC, FDC as the age changing. for example. I have just one group: the control01,age:38, control02,age:40,control03,age:45, control04,age:50,…  
I do not know how to set design\_matrix and Contrast\_matrix.  
Can you give me some advices? @rsmith @silver_mark

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [January 7, 2022, 6:50am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/19 "2022-01-07T06:50:14Z")

</div>

Hi @yichao,

In the most basic scenario, where you want to test the hypothesis that the rate of change of e.g. FDC with respect to age is greater than zero, and don’t want to bother with parameter normalisation, you would do:

```nohighlight
Name | CI | Age
----------+----+----
Control01 | 1 | 38
Control02 | 1 | 40
Control03 | 1 | 45
Control04 | 1 | 50

t-test: 0 | 1

```

If there is no relationship between age and FDC, i.e. the null hypothesis is true, then the second GLM beta coefficient will be zero. If you want to test the hypothesis that FDC _decreases_ as a function of age, i.e. the second beta coefficient is negative, then the contrast vector `[0 -1]` would produce positive _t_-statistics in that instance.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![Hinke\_Halbertsma](https://community.mrtrix.org/user_avatar/community.mrtrix.org/hinke_halbertsma/32/2533_2.png) [@Hinke\_Halbertsma](https://community.mrtrix.org/u/Hinke_Halbertsma)\
**Post date:** [February 9, 2023, 9:30am UTC](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791/20 "2023-02-09T09:30:13Z")

</div>

Dear @rsmith,

I came across this thread because I want to do something similar, although it doesn’t exactly answer my question.

Some background: I’m working on an extensive data set with both patients (n=160) and controls (n=640). For each of these subjects, we’ve calculated Polygenetic Risk Scores (PRS) for two diseases (D1 and D2). Based on their PRS, we’ve grouped the subjects into four groups: D1high\_D2high, D1high\_D2low, D1low\_D2high, and D1low\_D2low. I hope this makes sense.

In each of these groups, we have 160 controls and 40 patients. So the first few lines of the design matrix should look like the one attached right? NB: for clarity, I’ve included a controls/patient header and omitted the covariates. In the design matrix, I’ve stuck to the 4:1 ratio of controls vs patients.

 ![image](https://community.mrtrix.org/uploads/default/original/2X/6/6e776df39fbd159c3149aa251b882f028f030057.png)

Now my question is how I need to define my contrasts. We have some hypotheses:

- Controls \> patients in general, so then the contrast should be: 0.25 0.25 0.25 0.25 -0.25 -0.25 -0.25 -0.25. Am I right?

- There is a difference between the 4 groups, where we hypothesize that D1low\_D2low \> D1high\_D2high, with D1low\_D2high and D1high\_D2low in between (but no hypothesis on the order). Should I run separate tests for this? Any suggestions on how to do that?

- There might be an interaction effect, where the effect described above is bigger for the patients than for the controls. Any suggestions on how to do that?

Is its feasible at all to do this with fixelcfestats?

Any help would be much appreciated!

[Next page](https://community.mrtrix.org/t/fba-design-contrast-matrices-for-three-groups/1791.md?page=2)
