help > within group to a between group comparison
Showing 1-2 of 2 posts
Apr 24, 2015 10:04 PM | Katherine Wu
within group to a between group comparison
how to do a within group to a between group comparison in CONN?
For example, assume there two observations per group such as patients on/off medication and controls scaned twice.
We like to compare the difference between patients on/off to the variability within controls scanned twice
A little lost on how to set up the contrasts (or if that's even the right way to go about it.
Thanks!
Screenshot of second-level results attached.

For example, assume there two observations per group such as patients on/off medication and controls scaned twice.
We like to compare the difference between patients on/off to the variability within controls scanned twice
A little lost on how to set up the contrasts (or if that's even the right way to go about it.
Thanks!
Screenshot of second-level results attached.
Apr 25, 2015 05:04 PM | Alfonso Nieto-Castanon - Boston University
RE: within group to a between group comparison
Hi Katherine,
Typically in CONN you would/should have defined within-subject effects, such as the ON/OFF scans, as conditions (e.g. enter 2 as the number of scans per subject in Setup.Basic, and then associated the first scan with the Off condition and the second scan with the On condition in Setup.Conditions). Doing so makes this sort of within- between- subject tests considerably simpler (the Off and On conditions would appear in your Second-level results tab under the conditions list, and the PD/HC groups would appear under the subject-effects list; looking at the group x condition interaction is as simple as selecting both PD and HC in the between-subject effects list and entering a between-subjects contrast [1 -1] and then selecting both Off and On conditions and entering a between-condition contrast [1 -1]).
Having said that, since you seem to have entered those On and Off scans as if they were different subjects (and some times there are good reasons to do so), you still have a couple of options to perform the desired analyses (even though they are a bit more involved):
Option 1) running the analyses in CONN (this will use a partitioned variance ANOVA model). Steps:
1.a) You need to first define a series of second-level covariates identifying the repeated subjects in your data (one covariate per subject). I would create, for example, one variable named 'SubjectEffects_PD1' identifying the two scans associated with the On and Off condition for the first subject in group PD, and do the same for all other subjects. This can be a bit tedious to do manually (create one covariate per subject), so you can use batch scripts to automate this or alternatively do the following: create a new second-level covariate named 'SubjectEffects_PD' and enter in the values field the string "sparse([1:nnz(PD - Off),1:nnz(PD - On)], [find(PD - Off), find(PD - On)], 1, nnz(PD - Off), numel(PD - Off))" (without the quotes), and when prompted answer 'Yes' to the question about expanding this covariate. Then repeat the step for the other groups (changing PD - Off and PD - On for HC - On and HC - Off, for example), and you will end up with all of the desired SubjectEffects* covariates (one per subject)
1.b ) to look at the group by condition interaction, in the Second-level results tab select 'PD - Off', 'PD - On', 'HC - Off', 'HC - On', as well as all of the 'SubjectEffects_PD*' covariates and all of the 'SubjectEffects_HC*' covariates and enter the between-subjects contrsat [1 -1 -1 1 0 0 .... 0] (with as many 0's as SubjectEffect* covariates you have selected). Just to double-check the degrees of freedom of the resulting analysis should be T(N1+N2-2) where N1 is the number of subjects in the PD group and N2 is the number of subjects in the HC group.
Option 2) running the analysis in SPM (this will use a pooled variance ANOVA model instead of a partitioned variance model so the results might differ and the results might be considered overly liberal by some). Steps:
2.a) in SPM define a new 'flexible factorial' second-level analysis, enter two factors (one condition factor with two levels, 'Off' and 'On', and one group factor with two levels 'PD' and 'HC'), for the conditions factor select 'Independence'=No and 'variance'=unequal, and for the group factor enter 'independence'=Yes and 'variance'=equal. Then select the appropriate first-level files (named BETA_Subject*_Condition001_Source*.img in your conn/results/firstlevel/ANALYSIS_01/ folder) for each level of the conditions and groups factors. Then run the analyses and define the appropriate contrasts to explore (e.g. for the desired interaction this will typically look like [0... 0 1 -1 -1 1] with N+4 0's where N is the total number of subjects in this analysis).
For additional info simply google 'rik_anova.pdf' for a very good and detailed explanation about this sort of analyses.
Hope this helps
Alfonso
Originally posted by Katherine Wu:
Typically in CONN you would/should have defined within-subject effects, such as the ON/OFF scans, as conditions (e.g. enter 2 as the number of scans per subject in Setup.Basic, and then associated the first scan with the Off condition and the second scan with the On condition in Setup.Conditions). Doing so makes this sort of within- between- subject tests considerably simpler (the Off and On conditions would appear in your Second-level results tab under the conditions list, and the PD/HC groups would appear under the subject-effects list; looking at the group x condition interaction is as simple as selecting both PD and HC in the between-subject effects list and entering a between-subjects contrast [1 -1] and then selecting both Off and On conditions and entering a between-condition contrast [1 -1]).
Having said that, since you seem to have entered those On and Off scans as if they were different subjects (and some times there are good reasons to do so), you still have a couple of options to perform the desired analyses (even though they are a bit more involved):
Option 1) running the analyses in CONN (this will use a partitioned variance ANOVA model). Steps:
1.a) You need to first define a series of second-level covariates identifying the repeated subjects in your data (one covariate per subject). I would create, for example, one variable named 'SubjectEffects_PD1' identifying the two scans associated with the On and Off condition for the first subject in group PD, and do the same for all other subjects. This can be a bit tedious to do manually (create one covariate per subject), so you can use batch scripts to automate this or alternatively do the following: create a new second-level covariate named 'SubjectEffects_PD' and enter in the values field the string "sparse([1:nnz(PD - Off),1:nnz(PD - On)], [find(PD - Off), find(PD - On)], 1, nnz(PD - Off), numel(PD - Off))" (without the quotes), and when prompted answer 'Yes' to the question about expanding this covariate. Then repeat the step for the other groups (changing PD - Off and PD - On for HC - On and HC - Off, for example), and you will end up with all of the desired SubjectEffects* covariates (one per subject)
1.b ) to look at the group by condition interaction, in the Second-level results tab select 'PD - Off', 'PD - On', 'HC - Off', 'HC - On', as well as all of the 'SubjectEffects_PD*' covariates and all of the 'SubjectEffects_HC*' covariates and enter the between-subjects contrsat [1 -1 -1 1 0 0 .... 0] (with as many 0's as SubjectEffect* covariates you have selected). Just to double-check the degrees of freedom of the resulting analysis should be T(N1+N2-2) where N1 is the number of subjects in the PD group and N2 is the number of subjects in the HC group.
Option 2) running the analysis in SPM (this will use a pooled variance ANOVA model instead of a partitioned variance model so the results might differ and the results might be considered overly liberal by some). Steps:
2.a) in SPM define a new 'flexible factorial' second-level analysis, enter two factors (one condition factor with two levels, 'Off' and 'On', and one group factor with two levels 'PD' and 'HC'), for the conditions factor select 'Independence'=No and 'variance'=unequal, and for the group factor enter 'independence'=Yes and 'variance'=equal. Then select the appropriate first-level files (named BETA_Subject*_Condition001_Source*.img in your conn/results/firstlevel/ANALYSIS_01/ folder) for each level of the conditions and groups factors. Then run the analyses and define the appropriate contrasts to explore (e.g. for the desired interaction this will typically look like [0... 0 1 -1 -1 1] with N+4 0's where N is the total number of subjects in this analysis).
For additional info simply google 'rik_anova.pdf' for a very good and detailed explanation about this sort of analyses.
Hope this helps
Alfonso
Originally posted by Katherine Wu:
how to do a within group to a between group
comparison in CONN?
For example, assume there two observations per group such as patients on/off medication and controls scaned twice.
We like to compare the difference between patients on/off to the variability within controls scanned twice
A little lost on how to set up the contrasts (or if that's even the right way to go about it.
Thanks!
Screenshot of second-level results attached.
For example, assume there two observations per group such as patients on/off medication and controls scaned twice.
We like to compare the difference between patients on/off to the variability within controls scanned twice
A little lost on how to set up the contrasts (or if that's even the right way to go about it.
Thanks!
Screenshot of second-level results attached.