Closed LCNbalgrist closed 7 months ago
Hello! Everything looks OK in the details you sent, and it is indeed odd that this bug occurs for one case that is so similar to another case that works.
As checks: can you please provide:
df_diffLAS_contralat
and df_diffLAS_ipsilat
( both n x 2560 arrays? value of n? )nan
values in the arrays?Thank you for replying so quickly! Alpha is indeed 0.05. The size of both arrays is 22 x 2560. I have also checked again that neither arrays contain nans.. Depending on when I stop the operation it seems to break at different points in the script, e.g. after letting it run for roughly an hour the error was detected here:
In spm_uc (line 39) u = spm_uc_RF(a,df,STAT,R,n); In spm1d.rft1d.RFTCalculatorResels/isf (line 52) [u] = spm_uc(alpha, self.df, self.STAT, self.resels, self.n, self.Q); In spm1d.rft1d.t.isf_resels (line 45) u = calc.isf(alpha); In spm1d.stats.spm.SPM/get_critical_threshold (line 155) zstar = spm1d.rft1d.t.isf_resels(a, v(2), res, 'withBonf',withBonf, 'nNodes',n); In spm1d.stats.spm.SPM/inference (line 90) zstar = self.get_critical_threshold(pstar, withBonf);
From: Todd Pataky @.> Sent: Dienstag, 13. Februar 2024 03:57 To: 0todd0000/spm1dmatlab @.> Cc: Neumann Lennart @.>; Author @.> Subject: Re: [0todd0000/spm1dmatlab] Infinite run in inference calculation (Issue #198)
Hello! Everything looks OK in the details you sent, and it is indeed odd that this bug occurs for one case that is so similar to another case that works.
As checks: can you please provide:
- Reply to this email directly, view it on GitHubhttps://github.com/0todd0000/spm1dmatlab/issues/198#issuecomment-1940342446, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFGEMAF343JZWY554NNJFH3YTLJA5AVCNFSM6AAAAABDFARAUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBQGM2DENBUGY. You are receiving this because you authored the thread.Message ID: @.**@.>>
The calculation should only take a few hundred ms (about 300 ms?) so something is definitely wrong.
The only other issue I can see at the moment is that (a) the number of field nodes Q
is rather large at Q=2560
, and (b) the smoothness estimate fwhm
is very small relative to this Q
at fwhm=11
. This implies that the data are very rough. I do not expect this to affect the spm_uc_RF
calculation, but it may hint at the source of the problem.
In order to debug this problem can I please ask you to do the following:
0.4.11
, and you can find the version number in the VERSION.txt file in the top-level spm1d directory
Code snippet:
load('simdata.mat', 'y0', 'y1')
spm = spm1d.stats.ttest2(y0, y1).inference(0.05);
Optionally plot using:
figure;
plot(y0', 'k')
hold on
plot(y1', 'r')
figure;
spm.plot()
Hello everybody,
for some reason, I have a problem where the inference calculation of a spm struct object runs forever, but only with one specific dataset. I use the function on two datasets which are totally equal to each other, safe for the values contained, as far as I can tell. Still, it works fine for one dataset and runs infinitely for the other. These are the errore messages:
`Operation terminated by user during spm_Pcdf (line 75)
In spm_P_RF (line 108) P = 1 - spm_Pcdf(c - 1,(Em + eps)*p); In spm_uc_RF (line 38) [P P q] = spm_P_RF(1,0,u + du,df,STAT,R,n); In spm_uc (line 39) u = spm_uc_RF(a,df,STAT,R,n); In spm1d.rft1d.RFTCalculatorResels/isf (line 52) [u] = spm_uc(alpha, self.df, self.STAT, self.resels, self.n, self.Q); In spm1d.rft1d.t.isf_resels (line 45) u = calc.isf(alpha); In spm1d.stats.spm.SPM/get_critical_threshold (line 155) zstar = spm1d.rft1d.t.isf_resels(a, v(2), res, 'withBonf',withBonf, 'nNodes',n); In spm1d.stats.spm.SPM/inference (line 90) zstar = self.get_critical_threshold(pstar, withBonf);`
This is how I call the function:
spm_diffLAS_lat = spm1d.stats.ttest_paired(df_diffLAS_contralat, df_diffLAS_ipsilat);
spmi_diffLAS_lat = spm_diffLAS_lat.inference(alpha, 'two_tailed', true);
This is the SPM struct with which it works:
SPM{t} z: [1×2560 double] df: [1 21] fwhm: 11.7279 resels: [1 218.1984]
and with this it doesn't:
SPM{t} z: [1×2560 double] df: [1 21] fwhm: 11.1928 resels: [1 228.6288]
I am thankful for any input, as this is very mysterious to me.
Thanks and alle the best!