[#9707] Risk of infinite loop in calc_EC.m

Please log in

State: more information
Open
Date:
2020-11-20 02:51
Priority: more information
3
Submitted By:
stevenho (stevenho)
Assigned To: more information
Nobody (None)
Hardware: 
PC
Product: 
None
Operating System: 
other
Component: 
None
Version: 
None
Severity: 
None
Resolution: 
None
Summary: more information
Risk of infinite loop in calc_EC.m

Detailed description

In calc_EC.m, Line 16-27:
for i=1:length(t)
    p0 = 1-spm_Tcdf(t(i),df(2));
    p1 = power(1+t(i)*t(i)/df(2), (1-df(2))/2)/(2*pi);
    p2 = gamma((df(2)+1)/2)*t(i)*power(1+t(i)*t(i)/df(2), (1-df(2))/2) / power(2*pi,3/2) / sqrt(df(2)/2) / gamma(df(2)/2);
    p(i) = p0*L0 + p1*L1 + p2*L2;
end
index_th=[];
dp = 10^(-8);
while isempty(index_th) == 1;
    index_th=find(p > p_value - dp & p < p_value + dp);
    dp = dp*10;
end

When the degree of freedom (df) enlarges to an extent, its related gamma-function values will turn "Inf", thus making p2 and p "NaN", and then the loop to find the index of threshold (index_th) will keep running endlessly.

BTW, does this mean that no significant voxel can be indentified?

Response

No Responses Have Been Posted

Attached Files:

Name Download
微信截图_20201120104337.png Download

Changes:

Field Old Value Date By
DetailsIn calc_EC.m, Line 16-27:
for i=1:length(t)
    p0 = 1-spm_Tcdf(t(i),df(2));
    p1 = power(1+t(i)*t(i)/df(2), (1-df(2))/2)/(2*pi);
    p2 = gamma((df(2)+1)/2)*t(i)*power(1+t(i)*t(i)/df(2), (1-df(2))/2) / power(2*pi,3/2) / sqrt(df(2)/2) / gamma(df(2)/2);
    p(i) = p0*L0 + p1*L1 + p2*L2;
end
index_th=[];
dp = 10^(-8);
while isempty(index_th) == 1;
    index_th=find(p>p_value - dp & p
    dp = dp*10;
end

When the degree of freedom (df) enlarges to an extent, its related gamma-function values will turn "Inf", thus making p2 and p "NaN", and then the loop to find the index of threshold (index_th) will keep running endlessly.

BTW, does this mean that no significant voxel can be indentified?
2020-11-20 02:55stevenho
DetailsIn calc_EC.m, Line 16-27:
for i=1:length(t)
    p0 = 1-spm_Tcdf(t(i),df(2));
    p1 = power(1+t(i)*t(i)/df(2), (1-df(2))/2)/(2*pi);
    p2 = gamma((df(2)+1)/2)*t(i)*power(1+t(i)*t(i)/df(2), (1-df(2))/2) / power(2*pi,3/2) / sqrt(df(2)/2) / gamma(df(2)/2);
    p(i) = p0*L0 + p1*L1 + p2*L2;
end
index_th=[];
dp = 10^(-8);
while isempty(index_th) == 1;
    index_th=find(p>p_value - dp & p    dp = dp*10;
end

When the degree of freedom (df) enlarges to an extent, its related gamma-function values will turn "Inf", thus making p2 and p "NaN", and then the loop to find the index of threshold (index_th) will keep running endlessly.

BTW, does this mean that no significant voxel can be indentified?
2020-11-20 02:53stevenho
DetailsIn calc_EC.m, Line 16-27:
for i=1:length(t)
    p0 = 1-spm_Tcdf(t(i),df(2));
    p1 = power(1+t(i)*t(i)/df(2), (1-df(2))/2)/(2*pi);
    p2 = gamma((df(2)+1)/2)*t(i)*power(1+t(i)*t(i)/df(2), (1-df(2))/2) / power(2*pi,3/2) / sqrt(df(2)/2) / gamma(df(2)/2);
    p(i) = p0*L0 + p1*L1 + p2*L2;
end
index_th=[];
dp = 10^(-8);
while isempty(index_th) == 1;
    index_th=find(p>p_value - dp & p
    dp = dp*10;
end

When the degree of freedom (df) enlarges to an extent, its related gamma-function values will turn "Inf", thus making p2 and p "NaN", and then the loop to find the index of threshold (index_th) will keep running endlessly.

BTW, does this mean that no significant voxel can be indentified?
2020-11-20 02:53stevenho
File Added1108: 微信截图_20201120104337.png2020-11-20 02:51stevenho