Skip to content

make MCTol work in adtest - #548

Merged
pr0m1th3as merged 1 commit into
gnu-octave:mainfrom
AvanishSalunke:adtest
Nov 13, 2026
Merged

pr0m1th3as merged 1 commit into
gnu-octave:mainfrom
AvanishSalunke:adtest

Conversation

@AvanishSalunke

Copy link
Copy Markdown
Contributor

Using the MCTol option made adtest stop with 'mctol' undefined, because the Monte Carlo helper was called with a variable name that does not exist. It was affected for every distribution, composite or fully specified. The helper is now called with the correct variable, so the p-value and critical value are computed by simulation.

MCTol is also now required to be a real positive scalar. NaN and complex values used to pass the check, and a cell failed with an operator error instead of an adtest error. They now all give invalid Monte Carlo Tolerance.

BEFORE:

octave:2> load examgrades
octave:3> x = grades(:,1);
octave:4> [h, ~, adstat] = adtest (x, 'MCTol', 0.01)
error: 'mctol' undefined near line 326, column 64
error: called from
    adtest at line 326 column 10

AFTER:

octave:2> load examgrades
octave:3> x = grades(:,1);
octave:4> [h, ~, adstat] = adtest (x, 'MCTol', 0.01)
h = 0
adstat = 0.5194

MATLAB:

>> load examgrades
>> x = grades(:,1);
>> [h, ~, adstat] = adtest (x, 'MCTol', 0.01)

h =

  logical

   0


adstat =

    0.5194

@pr0m1th3as
pr0m1th3as merged commit 2990f48 into gnu-octave:main Nov 13, 2026
8 checks passed
pr0m1th3as added a commit that referenced this pull request Nov 13, 2026
  The MCTol check takes a positive real scalar of type double or single,
  and an empty value only as double or single.  The help text says so.
  Tests use assert_equal and cover NaN, cell, char, logical, integer and
  empty char tolerances.
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.

2 participants