Open xychen-ION opened 4 years ago
Dear @xychen-ION,
Sorry we missed this (I didn't have notifications set up right).
Can you tell us more about your data? What is the resolution? How many voxels do you have in your mask?
-Tom
CC: @BryanGuillaume
I have not had the time to dig into the code yet, but hereafter a quick explanation of the issue. It is coming from the estimation of the effective degrees of freedom. For this, the toolbox needs to estimate the covariances between the elements of the common within-subject covariance matrix (assuming only one homogeneous group). As there are 32 repeated measures in this dataset, the within-subject covariance matrix contains 32^2 = 1024 elements in total and 32 33 / 2 = 528 non-redundant elements (due to the symmetry of the covariance matrix). The covariance matrix of these non-redundant 528 elements has 528^2 = 278784 elements in total and 528 529 / 2 = 139656 non-redundant elements. When stacking all these 2 sets of elements into two column-vectors (mathematically using the operator vec and vech, respectively), there exists a matrix, called duplication matrix, of size 278784 x 139656 and composed of ones and zeros that transforms one column vector into the other. This matrix was convenient to derive theoretically the equations for the degrees of freedom estimation. Unfortunately, for convenience, I believe that this matrix has also been also used in the toolbox, which is definitively not an optimal way to go from vech to vec because it can create a very huge matrix like it is observed here.
At first thought, I believe it is possible to optimize the code to avoid the computation of this matrix altogether, solving the observed issue. However, I would need to look at the code and equations to see how to optimize this properly.
Hi @BryanGuillaume,
Thanks for the quick reply. Is there a practical modification to suggest to the analysis? For example, while I couldn't recommend the classic SwE with only 8 subjects, would that avoid this problem here?
Well, that is a good point. And thinking about this, I believe this duplication matrix is only used for the "approx II" and "approx III" estimator of the effective number of degrees of freedom. Thus, it should not be an issue for the "approx I" estimator. The latter is not the recommended estimator because it does not generally work well if there is missing data. However, if there are no missing data, it becomes equivalent to the default estimator "approx III" and should be safe to use. Thus, using "approx I" could be a way to circumvent the issue but only if there is no missing data, which seems to be the case here.
Thanks for your replies!
The resolution of the image is 2x2x2 mm3 with the image size 36x48x30 voxels. The brain mask I used has 23947 voxels in total. I also think it is due to some super big matrix formed during the program, as explained by Bryan, and seems can not be solved easily.
So, what I really need is just to ensure that the statistic model really counts the repeated meassure issue of the data, to make sure the statistics is right. As such, I finally used the repeated-measures 1-way ANOVA option in the 2nd-level analysis module of SPM12 to do the analysis. I model all 6 conditions in the design matrix and maunally set the contrast to test the interaction of the factors in the original 2-way ANOVA.
Best, Xiaoyu Chen
@xychen-ION:
As @BryanGuillaume noted, it turns out your design is just fine... it was a memory-hungry algorithm used for computing the degrees of freedom that is killing you (due to having 32 repeated measurements).
For the modified SwE we have four types of DF estimation, naive, approx I, approx II and approx III, with approx II used by default.
Can you please try your analyses again but changing the degrees of freedom method to "approx I", which should not be as memory intensive. (naive will also definitely work too, but approx I should be more accurate).
Hi, I am trying to use SwE toolbox for my longitudinal image data. But here comes an error in the final result display step:
I think it is due to some super big matrix formed during the algorithm. Is it related with my datasize? I got 8 subjects but 32 repeated measures each subject, 256 scans in total. For each subject, there is a two-way ANOVA designed experiments (2X3 = 6 conditions), which has also been modelled as the covariates. Everything goes fine in the previous steps but this error in the final display step.
Best wishes, Xiaoyu Chen