Mercurial > octave-nkf
comparison scripts/statistics/distributions/normcdf.m @ 12749:e7cc2d4a6db3 stable
Fix range of sigma in normal distribution to exclude 0.
* normcdf.m, normpdf.m: Correct 's >= 0' to 's > 0'.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 16 Jun 2011 21:05:10 -0700 |
parents | fd0a3ac60b0e |
children | 19b9f17d22af |
comparison
equal
deleted
inserted
replaced
12747:901d466ee55a | 12749:e7cc2d4a6db3 |
---|---|
48 | 48 |
49 sz = size (x); | 49 sz = size (x); |
50 cdf = zeros (sz); | 50 cdf = zeros (sz); |
51 | 51 |
52 if (isscalar (m) && isscalar(s)) | 52 if (isscalar (m) && isscalar(s)) |
53 if (find (isinf (m) | isnan (m) | !(s >= 0) | !(s < Inf))) | 53 if (find (isinf (m) | isnan (m) | !(s > 0) | !(s < Inf))) |
54 cdf = NaN (sz); | 54 cdf = NaN (sz); |
55 else | 55 else |
56 cdf = stdnormal_cdf ((x - m) ./ s); | 56 cdf = stdnormal_cdf ((x - m) ./ s); |
57 endif | 57 endif |
58 else | 58 else |
59 k = find (isinf (m) | isnan (m) | !(s >= 0) | !(s < Inf)); | 59 k = find (isinf (m) | isnan (m) | !(s > 0) | !(s < Inf)); |
60 if (any (k)) | 60 if (any (k)) |
61 cdf(k) = NaN; | 61 cdf(k) = NaN; |
62 endif | 62 endif |
63 | 63 |
64 k = find (!isinf (m) & !isnan (m) & (s >= 0) & (s < Inf)); | 64 k = find (!isinf (m) & !isnan (m) & (s > 0) & (s < Inf)); |
65 if (any (k)) | 65 if (any (k)) |
66 cdf(k) = stdnormal_cdf ((x(k) - m(k)) ./ s(k)); | 66 cdf(k) = stdnormal_cdf ((x(k) - m(k)) ./ s(k)); |
67 endif | 67 endif |
68 endif | 68 endif |
69 | 69 |