# How to perform one-way anova with fixelcfestats?

**URL:** <https://community.mrtrix.org/t/how-to-perform-one-way-anova-with-fixelcfestats/6940>\
**Category:** Uncategorized\
**Tags:** fba\
**Created:** [September 9, 2023, 1:50pm UTC](https://community.mrtrix.org/t/how-to-perform-one-way-anova-with-fixelcfestats/6940 "2023-09-09T13:50:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hyting](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/h/ed655f/32.png) [@hyting](https://community.mrtrix.org/u/hyting)\
**Post date:** [September 9, 2023, 1:50pm UTC](https://community.mrtrix.org/t/how-to-perform-one-way-anova-with-fixelcfestats/6940/1 "2023-09-09T13:50:43Z")

</div>

Hi all,

I have done the whole-brain FBA, and I want to do statistics with `fixelcfestats`. I have 3 groups (patient1, patient2, healthy controls), and I want to compare the FBA metrics among three groups. I need to perform the one-way ANOVA and post-hoc, I’ve noticed the option `-ftests` and `-fonly` of `fixelcfestats`, but I don’t know how to use them. Here is my design and contrast matrix, do they look fine?

Design matrix: Each group has 2 subjects (HC, patient1, patient2, sex demeaned, Zage, Zlg(etiv))  
1 0 0 -0.405 0.998 -0.038  
1 0 0 -0.405 0.641 1.537  
0 1 0 0.595 -0.522 -0.912  
0 1 0 -0.405 -0.789 -0.393  
0 0 1 0.595 -0.343 0.326  
0 0 1 -0.405 -0.969 0.491

Contrast matrix:  
1 -1 0 0 0 0  
-1 1 0 0 0 0  
0 1 -1 0 0 0  
0 -1 1 0 0 0  
1 0 -1 0 0 0  
-1 0 1 0 0 0

I know my contrast matrix simply performs 6 t-tests, but I don’t know how to rewrite it to achieve one-way ANOVA and post-hoc. It would be very appreciated if you can give me some advice.

BW,  
yuting

---

<div class="post-metadata">

**Author:** ![hyting](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/h/ed655f/32.png) [@hyting](https://community.mrtrix.org/u/hyting)\
**Post date:** [September 11, 2023, 6:02pm UTC](https://community.mrtrix.org/t/how-to-perform-one-way-anova-with-fixelcfestats/6940/2 "2023-09-11T18:02:04Z")

</div>

I ran the following code but received a warning: `F-test 1 is rank-deficient; row-space matrix decomposition will instead be used`.

My code:

```auto
fixelcfestats log_fc_smooth/ files.txt design_matrix_F.txt contrast_matrix_F.txt matrix/ stats_log_fc_F/ -ftests ftest.txt -fonly

```

Design matrix: Each group has 2 subjects (HC, patient1, patient2, sex demeaned, Zage, Zlg(etiv))  
1 0 0 -0.405 0.998 -0.038  
1 0 0 -0.405 0.641 1.537  
0 1 0 0.595 -0.522 -0.912  
0 1 0 -0.405 -0.789 -0.393  
0 0 1 0.595 -0.343 0.326  
0 0 1 -0.405 -0.969 0.491

ftest.txt simply contains [1 1 1]

Contrast\_matrix\_F.txt:  
1 -1 0 0 0 0  
0 1 -1 0 0 0  
1 0 -1 0 0 0

How can I fix this warning?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![hyting](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/h/ed655f/32.png) [@hyting](https://community.mrtrix.org/u/hyting)\
**Post date:** [September 16, 2023, 8:08am UTC](https://community.mrtrix.org/t/how-to-perform-one-way-anova-with-fixelcfestats/6940/3 "2023-09-16T08:08:40Z")

</div>

Hi, all  
After learning some knowledge about GLM, I rewrote my contrast matrix.

As I mentioned before, I have two cohorts (patients and healthy controls, in which the patient group includes two subgroups).

I ran a two-sample T-test at first (patients vs. HCs), to investigate the different fixels between these 2 groups.  
Design matrix: HCs patients sex age TIV (sex, age, and TIV demeaned)  
Contrast matrix: C1: 1 -1 0 0 0  
C2: -1 1 0 0 0

Then I ran an F-test and one-way ANOVA, respectively. (My goal is to investigate the among-group differences, but I was not sure whether to do F-test or ANOVA?)

1. For F-test:  
Design matrix: HCs subgroup1 subgroup2 sex age TIV (sex, age, and TIV demeaned)  
Contrast matrix: C1: 1 0 0 0 0 0  
C2: 0 1 0 0 0 0  
C2: 0 0 1 0 0 0  
F matrix: [1 1 1]

2. For one-way ANOVA:  
Design matrix: HCs subgroup1 subgroup2 sex age TIV (sex, age, and TIV demeaned)  
Contrast matrix: C1: 1 -1 0 0 0 0  
C2: 0 1 -1 0 0 0  
F matrix: [1 1]

After that, I view the significant fixels in mrview. To my surprise, the significant fixels of the two-sample T-test are almost the same as those of the one-way ANOVA, why?

My goal is to investigate the among-group differences (among HCs, subgroup1, and subgroup2) and then extract the mean FBA metrics based on the significant fixel masks to do the post-hoc to investigate the between-group differences (HCs vs. subgroup1, HCs vs. subgroup2, and subgroup1 vs. subgroup2). To achieve my goal, which test should I do, an F-test or one-way ANOVA?

Best,  
yuting

---

<div class="post-metadata">

**Author:** ![jacksonlee](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/j/b19c9b/32.png) [@jacksonlee](https://community.mrtrix.org/u/jacksonlee)\
**Post date:** [August 23, 2025, 7:35am UTC](https://community.mrtrix.org/t/how-to-perform-one-way-anova-with-fixelcfestats/6940/4 "2025-08-23T07:35:09Z")

</div>

Hi @yuting

Just following up this post as I have a similar question at the moment. For your group comparison, did you end up running an F-test first, followed by post-hoc t-tests (if significant?)

If so, how did you structure your contrast and F-test file (for -ftest)?

Cheers! Jackson
