From: John Darrington Date: Fri, 2 Jan 2015 13:42:15 +0000 (+0100) Subject: Examine: Change the positioning of the whiskers on boxplots. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=4680388eaf7959a704678d672770cdfba31a7911 Examine: Change the positioning of the whiskers on boxplots. The positioning of the whiskers on boxplots was unconventional. This change places the whiskers on the highest/lowest datum which is not an outlier. Thanks to Alan Mead for reporting this. --- diff --git a/src/math/box-whisker.c b/src/math/box-whisker.c index 0d893cb80c..c30be218fd 100644 --- a/src/math/box-whisker.c +++ b/src/math/box-whisker.c @@ -63,20 +63,28 @@ acc (struct statistic *s, const struct ccase *cx, bool extreme; struct outlier *o; - if ( y < bw->hinges[2] + bw->step) - bw->whiskers[1] = y; + if ( y > bw->hinges[2] + bw->step) /* Upper outlier */ + { + extreme = (y > bw->hinges[2] + 2 * bw->step) ; + } - if (bw->whiskers[0] == SYSMIS || bw->hinges[0] - bw->step > y) - bw->whiskers[0] = y; + else if (y < bw->hinges[0] - bw->step) /* Lower outlier */ + { + extreme = (y < bw->hinges[0] - 2 * bw->step) ; + } - if ( y > bw->hinges[2] + bw->step) - extreme = (y > bw->hinges[2] + 2 * bw->step) ; + else /* Not an outlier */ + { + if (bw->whiskers[0] == SYSMIS) + bw->whiskers[0] = y; - else if (y < bw->hinges[0] - bw->step) - extreme = (y < bw->hinges[0] - 2 * bw->step) ; + if (y > bw->whiskers[1]) + bw->whiskers[1] = y; + + return; + } - else - return; + /* y is an outlier */ o = xzalloc (sizeof *o) ; o->value = y;