Skip to content

Commit

Permalink
Use correct n for calculating kstest pValue (#165)
Browse files Browse the repository at this point in the history
* [#164] fixed variable error in cdf table argument

* [#164] corrected n to be size of ecdf output
  • Loading branch information
ecky-l authored Sep 27, 2024
1 parent ebbc6ec commit 20bf1f3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions inst/kstest.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@
endif
## Remove NaNs, get sample size and compute empirical cdf
x(isnan (x)) = [];
n = length(x);
[sampleCDF, x] = ecdf (x);
n = length(x);
## Remove 1st element
x = x(2:end);
## Check the hypothesized CDF specified under the null hypothesis.
Expand All @@ -166,7 +166,7 @@
endif
## Remove duplicates. Check for consistency
rd = find (diff (xCDF) == 0);
if (! isempty (rm))
if (! isempty (rd))
if (! all (ydiff(rd) == 0))
error ("kstest: wrong duplicates in numericl CDF.");
endif
Expand Down Expand Up @@ -335,4 +335,3 @@
%! assert (p, 5.085438806199252e-05, 1e-14);
%! assert (k, 0.2197, 1e-4);
%! assert (c, 0.1207, 1e-4);

0 comments on commit 20bf1f3

Please sign in to comment.