Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions inst/Regression/mnrfit.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
n = numel (UY); ## number of unique response categories
endif

if (isempty (Y))
error ("mnrfit: X and Y must contain at least one observation.");
endif

if (isnumeric (Y))
if (! (all (Y > 0) && all (fix (Y) == Y)))
error ("mnrfit: Y must contain positive integer category numbers.")
Expand Down Expand Up @@ -661,3 +665,8 @@
%!error<mnrfit: 'estdisp' must be 'on' or 'off'.> ...
%! mnrfit (ones (5, 4), [1; 2; 1; 2; 1], 'estdisp', 'maybe')

## Edge cases with empty arrays
%!error <mnrfit: X and Y must contain at least one observation.> ...
%! mnrfit ([], [])
%!error <mnrfit: X and Y must contain at least one observation.> ...
%! mnrfit (zeros (0, 3), zeros (0, 1))