X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fexamine.c;h=295fca1a4a7b2d8a7d7cc9a8595767ad1ac6626d;hb=e229a33394ba9708dd895760eabc47e9dc659c92;hp=46863cad9724f3b7899ab637ec8f3100a06df548;hpb=4a49e8177df96e6947609fcb6066d1d68e0f6675;p=pspp diff --git a/src/language/stats/examine.c b/src/language/stats/examine.c index 46863cad97..295fca1a4a 100644 --- a/src/language/stats/examine.c +++ b/src/language/stats/examine.c @@ -1532,6 +1532,25 @@ update_n (const void *aux1, void *aux2 UNUSED, void *user_data, const struct examine *examine = aux1; struct exploratory_stats *es = user_data; + bool this_case_is_missing = false; + /* LISTWISE missing must be dealt with here */ + if (!examine->missing_pw) + { + for (v = 0; v < examine->n_dep_vars; v++) + { + const struct variable *var = examine->dep_vars[v]; + + if (var_is_value_missing (var, case_data (c, var), examine->dep_excl)) + { + es[v].missing += weight; + this_case_is_missing = true; + } + } + } + + if (this_case_is_missing) + return; + for (v = 0; v < examine->n_dep_vars; v++) { struct ccase *outcase ; @@ -1588,7 +1607,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) struct casereader *reader; struct ccase *c; - if (examine->histogramplot) + if (examine->histogramplot && es[v].non_missing > 0) { /* Sturges Rule */ double bin_width = fabs (es[v].minimum - es[v].maximum) @@ -1655,7 +1674,7 @@ calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data) } casereader_destroy (reader); - if (examine->calc_extremes > 0) + if (examine->calc_extremes > 0 && es[v].non_missing > 0) { assert (es[v].minima[0].val == es[v].minimum); assert (es[v].maxima[0].val == es[v].maximum); @@ -1815,15 +1834,6 @@ run_examine (struct examine *cmd, struct casereader *input) case_unref (c); } - /* Remove cases on a listwise basis if requested */ - if ( cmd->missing_pw == false) - input = casereader_create_filter_missing (input, - cmd->dep_vars, - cmd->n_dep_vars, - cmd->dep_excl, - NULL, - NULL); - for (reader = input; (c = casereader_read (reader)) != NULL; case_unref (c)) { @@ -1836,6 +1846,10 @@ run_examine (struct examine *cmd, struct casereader *input) { summary_report (cmd, i); + const size_t n_cats = categoricals_n_count (cmd->cats, i); + if (n_cats == 0) + continue; + if (cmd->disp_extremes > 0) extremes_report (cmd, i);