longitudinal model with 6 time points

445 views
Skip to first unread message

khup...@ufl.edu

unread,
May 27, 2020, 9:47:35 PM5/27/20
to SwE-Toolbox Support
Hi all, 

I want to run a longitudinal model to characterize gray matter volume changes across 6 time points in ~15 subjects. The first 2 time points are pre-intervention & other 4 are post. We'd predict a stable pre-intervention baseline & then increases/decreases at time 3, returning to baseline levels by time 6. In SPM's flexible factorial, I've modeled this as the contrast: [-4.1 -4.1 6.4 4.8 1.1 -4.1] for increases with intervention & [4.1 4.1 -6.4 -4.8 -1.1 4.1] for decreases with the intervention. 

Previously, I had set up a flexible factorial model in SPM with design matrix that looked like this (screenshot on left). (Here, showing only 3 subjs as an example to compare with SwE.) The design matrix models the 6 time points & has TIV, age, and sex as covariates of no interest. Screenshot on right shows results at uncorrected p<0.001 for these 3 subjs for comparison to SwE.  
  

I wanted to run similar parametric & non-parametric models using the SwE toolbox and compare these results with the SPM flexible factorial. (& according to the McFarquhar 2019 paper, it sounds like SwE might be a better approach than flex factorial??). This is the code I've used to run a parametric model: 
      matlabbatch{1}.spm.tools.swe.smodel.dir = {'D:\NASA_Flight_VBM\CAT12_SecLevel_Scripts\SwE_Test\parametric'};
      %%
      matlabbatch{1}.spm.tools.swe.smodel.scans = {
                                                  'U:\NASA_Flight_VBM_KH\1023\01\S8mm_Mod_MNI_GMseg_1023_01.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1023\02\S8mm_Mod_MNI_GMseg_1023_02.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1023\03\S8mm_Mod_MNI_GMseg_1023_03.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1023\04\S8mm_Mod_MNI_GMseg_1023_04.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1023\05\S8mm_Mod_MNI_GMseg_1023_05.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1023\06\S8mm_Mod_MNI_GMseg_1023_06.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1062\01\S8mm_Mod_MNI_GMseg_1062_01.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1062\02\S8mm_Mod_MNI_GMseg_1062_02.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1062\03\S8mm_Mod_MNI_GMseg_1062_03.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1062\04\S8mm_Mod_MNI_GMseg_1062_04.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1062\05\S8mm_Mod_MNI_GMseg_1062_05.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1062\06\S8mm_Mod_MNI_GMseg_1062_06.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1098\01\S8mm_Mod_MNI_GMseg_1098_01.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1098\02\S8mm_Mod_MNI_GMseg_1098_02.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1098\03\S8mm_Mod_MNI_GMseg_1098_03.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1098\04\S8mm_Mod_MNI_GMseg_1098_04.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1098\05\S8mm_Mod_MNI_GMseg_1098_05.nii,1'
                                                  'U:\NASA_Flight_VBM_KH\1098\06\S8mm_Mod_MNI_GMseg_1098_06.nii,1'
                                                  };
      %%
      matlabbatch{1}.spm.tools.swe.smodel.ciftiAdditionalInfo.ciftiGeomFile = struct('brainStructureLabel', {}, 'geomFile', {}, 'areaFile', {});
      matlabbatch{1}.spm.tools.swe.smodel.ciftiAdditionalInfo.volRoiConstraint = 1;
      %%
      matlabbatch{1}.spm.tools.swe.smodel.type.modified.groups = [1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1
                                                                 1];
      %%
      %%
      matlabbatch{1}.spm.tools.swe.smodel.type.modified.visits = [1
                                                                 2
                                                                 3
                                                                 4
                                                                 5
                                                                 6
                                                                 1
                                                                 2
                                                                 3
                                                                 4
                                                                 5
                                                                 6
                                                                 1
                                                                 2
                                                                 3
                                                                 4
                                                                 5
                                                                 6];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.type.modified.ss = 3;
      matlabbatch{1}.spm.tools.swe.smodel.type.modified.dof_mo = 3;
      %%
      matlabbatch{1}.spm.tools.swe.smodel.subjects = [1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     2
                                                     2
                                                     2
                                                     2
                                                     2
                                                     2
                                                     3
                                                     3
                                                     3
                                                     3
                                                     3
                                                     3];
      %%
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(1).c = [1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1
                                                     1];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(1).cname = 'intercept';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(2).c = [1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(2).cname = 'time 1';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(3).c = [0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(3).cname = 'time 2';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(4).c = [0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(4).cname = 'time 3';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(5).c = [0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(5).cname = 'time 4';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(6).c = [0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(6).cname = 'time 5';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(7).c = [0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1
                                                     0
                                                     0
                                                     0
                                                     0
                                                     0
                                                     1];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(7).cname = 'time 6';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(8).c = [1371.77
                                                     1371.77
                                                     1371.77
                                                     1371.77
                                                     1371.77
                                                     1371.77
                                                     1519.89
                                                     1519.89
                                                     1519.89
                                                     1519.89
                                                     1519.89
                                                     1519.89
                                                     1666.44
                                                     1666.44
                                                     1666.44
                                                     1666.44
                                                     1666.44
                                                     1666.44];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(8).cname = 'TIV';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(9).c = [42.16
                                                     42.16
                                                     42.16
                                                     42.16
                                                     42.16
                                                     42.16
                                                     56.77
                                                     56.77
                                                     56.77
                                                     56.77
                                                     56.77
                                                     56.77
                                                     43.24
                                                     43.24
                                                     43.24
                                                     43.24
                                                     43.24
                                                     43.24];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(9).cname = 'age';
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(10).c = [1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      1
                                                      0
                                                      0
                                                      0
                                                      0
                                                      0
                                                      0];
      %%
      matlabbatch{1}.spm.tools.swe.smodel.cov(10).cname = 'sex';
      matlabbatch{1}.spm.tools.swe.smodel.multi_cov = struct('files', {});
      matlabbatch{1}.spm.tools.swe.smodel.masking.tm.tma.athresh = 0.1;
      matlabbatch{1}.spm.tools.swe.smodel.masking.im = 1;
      matlabbatch{1}.spm.tools.swe.smodel.masking.em = {''};
      matlabbatch{1}.spm.tools.swe.smodel.WB.WB_no = 0;
      matlabbatch{1}.spm.tools.swe.smodel.globalc.g_omit = 1;
      matlabbatch{1}.spm.tools.swe.smodel.globalm.gmsca.gmsca_no = 1;
      matlabbatch{1}.spm.tools.swe.smodel.globalm.glonorm = 1;



& these are the results at uncorrected p < 0.001.... 

Given the above, I had several questions: 
1) Is this the correct way to model the 6 time points in SwE? i.e, making one covariate column for each time point and assigning 1's and 0's to the scans depending on whether they were collected at that time point vs. not? 
2) Is it correct here to create an intercept column of all 1's ?
3) It's not a realistic analysis because I have only 3 subjects here, but I'm guessing it is not correct that the p<0.001 results look like this with one cluster covering the whole brain? Any feedback on potential reasons for this would be greatly appreciated. 

Thanks!! 
Kathleen 


khup...@ufl.edu

unread,
May 27, 2020, 9:49:05 PM5/27/20
to SwE-Toolbox Support
& here is my labeled SwE design matrix: 

Bryan Guillaume

unread,
May 28, 2020, 11:03:01 AM5/28/20
to swe-t...@googlegroups.com
Hi Kathleen,

First quick answer:

The global intercept is a linear combination of the 6 time-specific intercepts. As such, you have a perfect multicollinearity in your model and the intercept parameters will not be identifiable (i.e. there exists an infinity of solutions for the parameters). There is somehow a discrete warning in your design review window when you can see that the parameter estimability blocks are grey (the comment next to them are “gray -> \beta not uniquely specified”; that is unfortunately not a very obvious warning message). In consequence, the toolbox is likely to fail estimating any sensible values for the intercept parameters in this case, most likely explaining the odd results you got. The solution is to remove the global intercept or one of the time-specific intercept (the latter will make the interpretation of the time-specific intercepts be differential effects between the specific time they indicates and the baseline time represented by the global intercept, which would be the time removed from your design). At the view of your contrast tested, you probably just want to remove the global intercept.

Could you then please try to run the model again without the global intercept and tell us if this is fixing the observed issue?

Hope this helps,
Bryan


On 28 May 2020, at 03:49, khup...@ufl.edu wrote:

& here is my labeled SwE design matrix: 
<Auto Generated Inline Image 1.png>
      matlabbatch{1}.spm.tools.swe.smodel.ciftiAdditionalInfo.ciftiGeomFile =struct('brainStructureLabel', {}, 'geomFile', {}, 'areaFile', {});

-- 
You received this message because you are subscribed to the Google Groups "SwE-Toolbox Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swe-toolbox...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swe-toolbox/9d26d07f-c8ed-4644-8136-e42ed8819f5b%40googlegroups.com.
<Auto Generated Inline Image 1.png>

Hupfeld,Kathleen E

unread,
May 28, 2020, 11:30:16 AM5/28/20
to swe-t...@googlegroups.com
Thanks Bryan! That potentially fixed the issue. Now my design matrix looks like this, although there are no significant results at p<0.001 as there were in the SPM flexible factorial model. (Although, this has only 3 subjects to test everything, so I'm not sure we'd expect much...) 

With taking out the global intercept column, would you say that this is the generally correct approach for modelling such a change over time with the SwE toolbox?  

Thanks so much for your help! 

Best wishes,  
Kathleen 



From: swe-t...@googlegroups.com <swe-t...@googlegroups.com> on behalf of Bryan Guillaume <bryan.g...@hotmail.com>
Sent: Thursday, May 28, 2020 11:02 AM
To: swe-t...@googlegroups.com <swe-t...@googlegroups.com>
Subject: Re: [SwE] Re: longitudinal model with 6 time points
 
[External Email]
You received this message because you are subscribed to a topic in the Google Groups "SwE-Toolbox Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swe-toolbox/AfJi5FNj7is/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swe-toolbox...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swe-toolbox/DB6PR01MB388077E7BAE0A6520EEE6254E08E0%40DB6PR01MB3880.eurprd01.prod.exchangelabs.com.

Bryan Guillaume

unread,
May 28, 2020, 2:27:46 PM5/28/20
to swe-t...@googlegroups.com
With only three subjects, it is unlikely to be enough with the SwE method to get a sufficiently low variance of the parameters and a sufficiently high effective number of degrees of freedom for the test to find any significant effects. In particular, the flexible factorial model approach is using some assumptions that helps to have a higher effective number of degrees of freedom for the tests (at the cost that these assumptions may not hold and may yield an increase of false positives). Thus, even with 3 subjects, you could expect to get significant voxels with the flexible factorial model but none with SwE. As a rough rule of thumb (things are a bit more complicated than that), the effective number of degrees of freedom with SwE can be expected to be, at maximum, the number of subjects involved in the contrast tested minus the number of cross-sectional covariates (that do not vary within subjects). Thus, in your case, it should be 0, leaving no degrees of freedom left for your tests -> no significant results.

Hopefully, having more subjects would definitively help to improve that.  

The approach you used with the 6 intercepts seems fine to me. Nevertheless, I can think about another option that could also be considered. It would be to have a global intercept and then use the values you used in your contrast vector (i.e. [-4.1 -4.1 6.4 4.8 1.1 -4.1]) to create a covariate encoding directly the trend you are expecting. The test would then be done on this covariate alone. This type of approach is often used when one wants to model directly polynomial effects of a time varying covariate (i.e. linear effect, quadratic effect,…) and to also add easily interaction of it with other covariates. However, I believe its use is mostly useful when the time varying covariate is also varying across subjects. At first glance, in your case, I am not really sure you would gain much using this approach compared to the 6-intercept approach unless you would have some subjects with missing scans (in which case, your covariate might be considered to be also varying across subjects and both approaches may model things a bit differently).
  
Hope this helps,
Bryan

On 28 May 2020, at 17:27, Hupfeld,Kathleen E <khup...@ufl.edu> wrote:

Thanks Bryan! That potentially fixed the issue. Now my design matrix looks like this, although there are no significant results at p<0.001 as there were in the SPM flexible factorial model. (Although, this has only 3 subjects to test everything, so I'm not sure we'd expect much...) 

With taking out the global intercept column, would you say that this is the generally correct approach for modelling such a change over time with the SwE toolbox?  

Thanks so much for your help! 

Best wishes,  
Kathleen 
<image.png>

khup...@ufl.edu

unread,
Jun 4, 2020, 11:16:52 AM6/4/20
to SwE-Toolbox Support
Thanks for all of your help Bryan!! It looks like, with including more subjects, both of your suggested approaches worked, and the results are very similar to each other and to the flexible factorial output (although as you discussed previously, both SWE models yield fewer results than the flexible factorial approach). 

Voxelwise FDR<0.05 flexible factorial model (covariates = age, sex, TIV): 


SWE one column for each time point (other covariates = age, sex, TIV; no global intercept), voxelwise FDR < 0.05: 


SWE one column for time (other cols = age, sex, TIV, and global intercept), voxelwise FDR < 0.05: 

I had a couple of follow-up questions: 
1) If I wanted to compare also the results of running a nonparametric SWE analysis, what do I need to put for the "Contrast" field? So far, I've tried running nonparametric with all of the defaults, and e.g., tried to select a T contrast of  [-4.1 -4.1 6.4 4.8 1.1 -4.1] for my first SWE model above (to model the predicted effects of time) and [0 0 0 1] for my second SWE model above (to put a 1 over the time column). However, in both cases I received the following error; am I specifying the contrast incorrectly in these cases? 
Error using swe_run_smodel (line 827)
contrast not well specified

2) In general, in the SWE toolbox, is there a way to look at voxelwise FWE<0.05 results, as there is in regular SPM? In the results GUI for SWE it only provides the option to look at FDR and uncorr. p results. 

Thank you so much for your speedy responses & for all of your help so far. It is much appreciated. 

Best wishes, 
Kathleen 
[External Email]
To unsubscribe from this group and stop receiving emails from it, send an email to swe-t...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/swe-toolbox/9d26d07f-c8ed-4644-8136-e42ed8819f5b%40googlegroups.com.
<Auto Generated Inline Image 1.png>

-- 
You received this message because you are subscribed to a topic in the Google Groups "SwE-Toolbox Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swe-toolbox/AfJi5FNj7is/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swe-t...@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "SwE-Toolbox Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swe-t...@googlegroups.com.

Thomas Nichols

unread,
Jun 4, 2020, 12:29:04 PM6/4/20
to swe-t...@googlegroups.com
Dear Kathleen,

One quick question about the flexible factorial vs SwE approach is that I count 4 nuisance variables in the former and only 3 in SwE that look *really* different in the design matrix image.  Are you sure they models are equivalent with the exception of the subject intercepts in the flexible factorial?

1) If I wanted to compare also the results of running a nonparametric SWE analysis, what do I need to put for the "Contrast" field? So far, I've tried running nonparametric with all of the defaults, and e.g., tried to select a T contrast of  [-4.1 -4.1 6.4 4.8 1.1 -4.1] for my first SWE model above (to model the predicted effects of time) and [0 0 0 1] for my second SWE model above (to put a 1 over the time column). However, in both cases I received the following error; am I specifying the contrast incorrectly in these cases? 
Error using swe_run_smodel (line 827)
contrast not well specified

Sorry, SwE doesn't pad the contrast with extra zeros at the end.  You need to add zeros so that the contrast has the same number of columns as the design matrix. I've added an issue to remind us to add zero-padding functionality at some point.   


2) In general, in the SWE toolbox, is there a way to look at voxelwise FWE<0.05 results, as there is in regular SPM? In the results GUI for SWE it only provides the option to look at FDR and uncorr. p results. 

When you use the nonparametric, wild bootstrap mode you'll be able to look at FWE<0.05 results.

-Tom


Thomas Nichols, PhD
Professor of Neuroimaging Statistics
Nuffield Department of Population Health | University of Oxford
Big Data Institute | Li Ka Shing Centre for Health Information and Discovery
Old Road Campus | Headington | Oxford | OX3 7LF | United Kingdom
T: +44 1865 743590 | E: thomas....@bdi.ox.ac.uk
W: http://nisox.org | http://www.bdi.ox.ac.uk

khup...@ufl.edu

unread,
Jun 4, 2020, 1:41:03 PM6/4/20
to SwE-Toolbox Support
Hi Dr. Nichols, 

1) Whoops, I included a screenshot of the flexible factorial model that included one extra covariate. This is the model with the same covariates as the SWE models: TIV, age, sex. I double checked that these are the same as the above SWE models (same values & in the same order). 
--The third covariate (sex) looks reasonable when comparing between FF and SWE. In the results, it is bright for two subjects at the top and for two subjects in the middle of the sample. 
--I agree, however, that the TIV and age covariates do look different in the FF model vs. SWE models. Could this perhaps be due to differences in centering options? For the FF model, I have retained the SPM default for centering the covariates based on the overall mean. Looking at the SWE toolbox options, for covariates we just enter the vector and name. If I mean-centered the covariates myself, then they would perhaps look more similar to the FF model? 


2) Zero padding the contrasts worked; easy fix. Thank you!! 

Thanks so much for your helpful answers! 

Best, 
Kathleen 

Thomas Nichols

unread,
Jun 5, 2020, 1:22:16 AM6/5/20
to swe-t...@googlegroups.com
Dear Kathleen,

1) Whoops, I included a screenshot of the flexible factorial model that included one extra covariate. This is the model with the same covariates as the SWE models: TIV, age, sex. I double checked that these are the same as the above SWE models (same values & in the same order). 
--The third covariate (sex) looks reasonable when comparing between FF and SWE. In the results, it is bright for two subjects at the top and for two subjects in the middle of the sample.

Your screen snapshots have revealed a small bug in SwE, where we weren't showing the the design matrix in the same way as SPM does; I've entered a fix that future versions will use -- thank you!
  
 --I agree, however, that the TIV and age covariates do look different in the FF model vs. SWE models. Could this perhaps be due to differences in centering options? For the FF model, I have retained the SPM default for centering the covariates based on the overall mean. Looking at the SWE toolbox options, for covariates we just enter the vector and name. If I mean-centered the covariates myself, then they would perhaps look more similar to the FF model? 

It's just our display problem... no worries.

As for the differences, all I can say is that SPM is using a different model, in particular one that assumes the repeated measures correlation is the same everywhere.  SwE is not making any such assumption, but it is then of course true that we have less data to learn that correlation/covariance at each voxel, and hence may be less sensitive.  But it's one of those "bias variance trade offs", our model is surely more correct (voxelwise repeated measures correlation) and provides less biased inferences but you pay a price for it.

-Tom
 
image.png


2) Zero padding the contrasts worked; easy fix. Thank you!! 

Thanks so much for your helpful answers! 

Best, 
Kathleen 



On Thursday, June 4, 2020 at 12:29:04 PM UTC-4, Thomas Nichols wrote:
Dear Kathleen,

One quick question about the flexible factorial vs SwE approach is that I count 4 nuisance variables in the former and only 3 in SwE that look *really* different in the design matrix image.  Are you sure they models are equivalent with the exception of the subject intercepts in the flexible factorial?

1) If I wanted to compare also the results of running a nonparametric SWE analysis, what do I need to put for the "Contrast" field? So far, I've tried running nonparametric with all of the defaults, and e.g., tried to select a T contrast of  [-4.1 -4.1 6.4 4.8 1.1 -4.1] for my first SWE model above (to model the predicted effects of time) and [0 0 0 1] for my second SWE model above (to put a 1 over the time column). However, in both cases I received the following error; am I specifying the contrast incorrectly in these cases? 
Error using swe_run_smodel (line 827)
contrast not well specified

Sorry, SwE doesn't pad the contrast with extra zeros at the end.  You need to add zeros so that the contrast has the same number of columns as the design matrix. I've added an issue to remind us to add zero-padding functionality at some point.   


2) In general, in the SWE toolbox, is there a way to look at voxelwise FWE<0.05 results, as there is in regular SPM? In the results GUI for SWE it only provides the option to look at FDR and uncorr. p results. 

When you use the nonparametric, wild bootstrap mode you'll be able to look at FWE<0.05 results.

-Tom


Thomas Nichols, PhD
Professor of Neuroimaging Statistics
Nuffield Department of Population Health | University of Oxford
Big Data Institute | Li Ka Shing Centre for Health Information and Discovery
Old Road Campus | Headington | Oxford | OX3 7LF | United Kingdom
T: +44 1865 743590 | E: thomas...@bdi.ox.ac.uk
W: http://nisox.org | http://www.bdi.ox.ac.uk

--
You received this message because you are subscribed to the Google Groups "SwE-Toolbox Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swe-toolbox...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swe-toolbox/192c4310-5a0f-4a4b-9b74-32e382aafb80o%40googlegroups.com.


--
__________________________________________________________
Thomas Nichols, PhD
Professor of Neuroimaging Statistics
Nuffield Department of Population Health | University of Oxford
Big Data Institute | Li Ka Shing Centre for Health Information and Discovery
Old Road Campus | Headington | Oxford | OX3 7LF | United Kingdom

Kathleen Hupfeld

unread,
Aug 19, 2020, 9:06:55 PM8/19/20
to SwE-Toolbox Support
Hi- 

I had a follow-up question to this post. I ran one of these models with the default settings & it worked fine. Then, I tried to run the same model with the nonparametric wild bootstrap defaults, and it failed.

Specify model worked fine (screenshot below): 
Picture1.png

& then run model makes it to ~80% done but crashes here. Do you have any insight into why this may be happening? 

------------------------------------------------------------------------
19-Aug-2020 20:58:16 - Running job #1
------------------------------------------------------------------------
19-Aug-2020 20:58:16 - Running 'Run Model'
Initialising parameters                 :                        ...done
Output images                           :                 ...initialised
Original statistics: Chunk   5/5        :                  ...processing19-Aug-2020 21:02:50 - Failed  'Run Model'
In an assignment  A(:) = B, the number of elements in A and B must be the same.
In file "C:\Users\admin\Desktop\spm12\toolbox\SwE\swe_cp_WB.m" (???), function "swe_cp_WB" at line 1107.
In file "C:\Users\admin\Desktop\spm12\toolbox\SwE\swe_cp.m" (???), function "swe_cp" at line 75.
In file "C:\Users\admin\Desktop\spm12\toolbox\SwE\swe_run_rmodel.m" (???), function "swe_run_rmodel" at line 34.

The following modules did not run:
Failed: Run Model

Thomas Nichols

unread,
Aug 21, 2020, 6:53:14 AM8/21/20
to swe-t...@googlegroups.com
Dear Kathleen,

This seems reminiscent of some bugs we fixed with a recent release.  Can you confirm that you're using the most current version, v2.2.1?

-Tom

Kathleen Hupfeld

unread,
Aug 21, 2020, 8:20:47 AM8/21/20
to SwE-Toolbox Support
Hi Dr. Nichols, 

Thank you! I updated my toolbox to 2.2.1. I am now running into this error and playing around with it- 

------------------------------------------------------------------------
21-Aug-2020 08:09:27 - Running job #1
------------------------------------------------------------------------
21-Aug-2020 08:09:27 - Running 'Run Model'
21-Aug-2020 08:09:27 - Failed  'Run Model'
Error: File: swe_DataType.m Line: 12 Column: 12
The input character is not valid in MATLAB statements or expressions.
In file "C:\Users\admin\Desktop\spm12\toolbox\SwE\swe_cp_WB.m" (???), function "swe_cp_WB" at line 157.
In file "C:\Users\admin\Desktop\spm12\toolbox\SwE\swe_cp.m" (???), function "swe_cp" at line 75.
In file "C:\Users\admin\Desktop\spm12\toolbox\SwE\swe_run_rmodel.m" (???), function "swe_run_rmodel" at line 34.

The following modules did not run:
Failed: Run Model

In swe_DataType.m, MatLab doesn't like the " --> not sure if this is a MatLab version issue? I'm on an old MatLab (2016a) at the moment.

if nargin == 0
    error( "swe_DataType cannot be initialized empty; choose from 'Nifti', 'Gifti', 'Cifti', 'Mat', 'VolumeMat' or 'SurfaceMat'.");
  end

  if ~ismember(dataType, availableDataTypes)
    error("%s is not a valid swe_DataType. Choose from 'Nifti', 'Gifti', 'Cifti', 'Mat', 'VolumeMat' or 'SurfaceMat'.", dataType);
  end

Thanks for you help! 

Thomas Nichols

unread,
Aug 21, 2020, 8:36:46 AM8/21/20
to swe-t...@googlegroups.com
So sorry for the trouble!  We originally started using double quotes until we realised how many people didn't have the most current Matlab version.  We then reverted back but obviously missed one file.  See attached for a corrected file to replace @swe_DataType/swe_DataType.m ... let me know if that works.

-Tom

swe_DataType.m

Kathleen Hupfeld

unread,
Aug 21, 2020, 8:48:38 AM8/21/20
to SwE-Toolbox Support
Not a worry! COVID has slowed our normal process of MatLab upgrades on lab computers; hopefully soon I'll be on a newer version. It looks like the 2.2.1 update is working! It is currently running 'parameter estimation bootstrap #1' which is further along than that previous error I was running into, so looks like it's working! Thanks again for your help!! 
-K 

------------------------------------------------------------------------
21-Aug-2020 08:39:14 - Running job #1
------------------------------------------------------------------------
21-Aug-2020 08:39:14 - Running 'Run Model'
>> 
Initialising parameters                 :                        ...done
Output images                           :                 ...initialised
Original statistics: Chunk   5/5        :                        ...done
Bootstrap # 1: Chunk   1/1              :     ..done in 147.1470 seconds
Bootstrap # 2: Chunk   1/1              :                  ...processing>> 

Thomas Nichols

unread,
Aug 21, 2020, 9:12:21 AM8/21/20
to swe-t...@googlegroups.com
Super.  I'll include that change in our next updates.

Reply all
Reply to author
Forward
0 new messages