Skip to content

handle Nan values in signtest.m#405

Open
AvanishSalunke wants to merge 1 commit intognu-octave:mainfrom
AvanishSalunke:signtest
Open

handle Nan values in signtest.m#405
AvanishSalunke wants to merge 1 commit intognu-octave:mainfrom
AvanishSalunke:signtest

Conversation

@AvanishSalunke
Copy link
Contributor

@AvanishSalunke AvanishSalunke commented Mar 1, 2026

  1. when NaN values were passed, the function never filtered them out :
XY_diff = x(:) - my(:);
NO_diff = (XY_diff == 0);
XY_diff(NO_diff | isnan (NO_diff)) = [];

so we got differences in the output
matlab :

>> x = [1, 2, 3, 4, NaN, NaN, NaN];

>> [p, h, stats] = signtest(x)


p =

    0.1250


h =

  logical

   0


stats = 

  struct with fields:

    zval: NaN
    sign: 4

octave :

octave:5> [p, h, stats] = signtest(x)
p = 1.0000
h = 0
stats =

  scalar structure containing the fields:

    zval = NaN
    sign = 4
    
  1. The null hypothesis is rejected also when p value is equal to the alpha value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant