help > Setting up 2nd-level contrast with age/sex confounds for subgroup (Patients A vs matched controls) + age centering?
Showing 1-2 of 2 posts
Display:
Results per page:
Feb 19, 2026  10:02 AM | Maron Mantwill
Setting up 2nd-level contrast with age/sex confounds for subgroup (Patients A vs matched controls) + age centering?

Hi CONN team,


I’m unsure how to correctly specify a second-level model/contrast in CONN for a subgroup comparison while controlling for age and sex.


Design / groups


·       Total: 160 subjects (80 patients, 80 healthy controls)


·       Patients: 50 received intervention A, 30 received intervention B


·       Controls: each control is matched either to the A or the B patient subgroup (i.e., “controls for A” and “controls for B”)


Question / goal
At baseline, I want to test Patients A vs their matched controls (Controls-A), controlling for age and sex, ignoring Patients B and Controls-B.


How should I model age/sex confounds for this comparison?
Specifically, in CONN’s 2nd-level setup:


1.     Should I include all subjects (N=160) in the analysis and use a group contrast that isolates the comparison, e.g.:


·       Subject effects: [PatientsA, ControlsA, PatientsB, ControlsB]


·       Contrast: [1, -1, 0, 0]


·       Confounds: include Age and Sex as covariates defined for all 160 subjects (with their usual values), so Patients B / Controls B are effectively excluded by the zeros in the contrast?


2.     Or is it recommended to restrict the analysis to only Patients A + Controls A (N=100) using the “Select subjects” / subgroup selection approach, and then include Age and Sex covariates only for those selected subjects?


3.     Do I ever need to create subgroup-specific age covariates (e.g., “Age_Aonly” with values only for Patients A and Controls A and zeros elsewhere), or is that unnecessary / incorrect in CONN?


Additional question: centering/scaling the age covariate
How should Age be entered in CONN at 2nd-level?


·       Should age be mean-centered (centered around 0), and if yes: centered across all 160 subjects or only within the selected subgroup (Patients A + Controls A)?


·       Alternatively, is it fine to use raw age values, and CONN/SPM will handle centering internally for interpretation?


·       Any recommendation regarding scaling (e.g., years vs z-scored)?


I’d appreciate guidance on the “CONN-correct” way to set this up and avoid mis-specifying the design.


Thanks a lot!


 


Feb 23, 2026  09:02 AM | Alfonso Nieto-Castanon - Boston University
RE: Setting up 2nd-level contrast with age/sex confounds for subgroup (Patients A vs matched controls) + age centering?

Hi Maron,


The typical/standard way to compare PatientsA to ControlsA while controlling for age and sex would be:


   Subject effects: [PatientsA, ControlsA, PatientsB, ControlsB, Age, Sex]


   Between-subjects contrast: [1, -1, 0, 0, 0 0]


In this analysis (N=160) the statistical control procedure estimates the effect of age&sex over the entire dataset and then it applies that to the comparison of GroupA subjects alone. If you have reasons to believe that the age&sex effects may be different in group A vs. B (unlikely if the intervention group was defined randomly, but possible if that decision was based on external factors like disease severity or type) then it would better to use the alternative analysis:


   Subject effects: [PatientsA, ControlsA, Age*GroupA, Sex*GroupA]


   Between-subjects contrast: [1, -1, 0, 0]


(note: the Age*GroupA variable represents the interaction of age and A/B groups, basically containing the actual age values for groupA subjects and 0s for groupB subjects; same for Sex*GroupA; you can create these in CONN in the Setup.Covariates (2nd-level) tab by selecting your variables "Sex", "GroupA" and "GroupB" and clicking on 'covariate tools -> create interaction of selected covariates')


These analyses (N=100) are equivalent to the ones above but the effect of age/sex here is estimated only over GroupA subjects.


Regarding your question about centering, in these analyses the results will always be exactly the same whether you center or not any of the age/sex variables. That said, some times it is useful to center them to then more easily interpret the adjusted means in possible post-hoc analyses. For example when displaying effect-sizes within CONN's results explorer GUI (e.g. using the 'display effects' button there) for these analyses, that will show you a barplot with the average connectivity in PatientsA and PatientsB at the zero-level of your covariates, so those plots would be much easier to interpret if the age/sex variables are centered so that the "zero-level" means the average age/sex in your sample; or if you center them only within GroupA subjects then the "zero-level" would mean the average age/sex in GroupA subjects)


Last, regarding scaling of covariates, again that does not matter (it does not change the results) as long as the scaling is linear (e.g. age in years vs. age in months; or age in years vs. age in z-scores), but it does matter if the transformation is non-linear (e.g. age in years vs. age in percentiles). In general unless you have a specific reason to believe that age-connectivity associations in your sample may be better represented through some particular non-linearity I would recommend simply keeping raw units. 


Hope this helps


Alfonso


Originally posted by Maron Mantwill:




Hi CONN team,


I’m unsure how to correctly specify a second-level model/contrast in CONN for a subgroup comparison while controlling for age and sex.


Design / groups


·       Total: 160 subjects (80 patients, 80 healthy controls)


·       Patients: 50 received intervention A, 30 received intervention B


·       Controls: each control is matched either to the A or the B patient subgroup (i.e., “controls for A” and “controls for B”)


Question / goal
At baseline, I want to test Patients A vs their matched controls (Controls-A), controlling for age and sex, ignoring Patients B and Controls-B.


How should I model age/sex confounds for this comparison?
Specifically, in CONN’s 2nd-level setup:


1.     Should I include all subjects (N=160) in the analysis and use a group contrast that isolates the comparison, e.g.:


·       Subject effects: [PatientsA, ControlsA, PatientsB, ControlsB]


·       Contrast: [1, -1, 0, 0]


·       Confounds: include Age and Sex as covariates defined for all 160 subjects (with their usual values), so Patients B / Controls B are effectively excluded by the zeros in the contrast?


2.     Or is it recommended to restrict the analysis to only Patients A + Controls A (N=100) using the “Select subjects” / subgroup selection approach, and then include Age and Sex covariates only for those selected subjects?


3.     Do I ever need to create subgroup-specific age covariates (e.g., “Age_Aonly” with values only for Patients A and Controls A and zeros elsewhere), or is that unnecessary / incorrect in CONN?


Additional question: centering/scaling the age covariate
How should Age be entered in CONN at 2nd-level?


·       Should age be mean-centered (centered around 0), and if yes: centered across all 160 subjects or only within the selected subgroup (Patients A + Controls A)?


·       Alternatively, is it fine to use raw age values, and CONN/SPM will handle centering internally for interpretation?


·       Any recommendation regarding scaling (e.g., years vs z-scored)?


I’d appreciate guidance on the “CONN-correct” way to set this up and avoid mis-specifying the design.


Thanks a lot!