/*
PSPP - a program for statistical analysis.
- Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2012, 2013, 2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
const struct ccase *c =
categoricals_get_case_by_category_real (cmd->cats, iact_idx, grp);
- const struct exploratory_stats *es =
+ struct exploratory_stats *es =
categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp);
ds_init_empty (&label);
}
boxplot_add_box (boxplot, es[v].box_whisker, ds_cstr (&label));
+ es[v].box_whisker = NULL;
ds_destroy (&label);
}
for (v = 0; v < cmd->n_dep_vars; ++v)
{
- const struct exploratory_stats *es =
+ struct exploratory_stats *es =
categoricals_get_user_data_by_category_real (cmd->cats, iact_idx, grp);
boxplot_add_box (boxplot, es[v].box_whisker,
var_to_string (cmd->dep_vars[v]));
+ es[v].box_whisker = NULL;
}
boxplot_submit (boxplot);
int v;
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 ;
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)
value_init_pool (examine->pool, &es[v].maxima[i].identity, examine->id_width) ;
value_init_pool (examine->pool, &es[v].minima[i].identity, examine->id_width) ;
}
-
+
+ bool warn = true;
for (reader = casereader_clone (es[v].sorted_reader);
(c = casereader_read (reader)) != NULL; case_unref (c))
{
const double val = case_data_idx (c, EX_VAL)->f;
- const double wt = case_data_idx (c, EX_WT)->f;
-
+ double wt = case_data_idx (c, EX_WT)->f;
+ wt = var_force_valid_weight (examine->wv, wt, &warn);
+
moments_pass_two (es[v].mom, val, wt);
if (es[v].histogram)
}
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);
statistic_destroy (&es[v].histogram->parent);
moments_destroy (es[v].mom);
+ if (es[v].box_whisker)
+ {
+ stat = &es[v].box_whisker->parent.parent;
+ stat->destroy (stat);
+ }
+
casereader_destroy (es[v].sorted_reader);
}
}
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))
{
{
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);
examine.boxplot = false;
examine.spreadlevelplot = false;
examine.sl_power = 0;
-
+ examine.dep_vars = NULL;
+ examine.n_dep_vars = 0;
examine.dict = dataset_dict (ds);
/* Accept an optional, completely pointless "/VARIABLES=" */
int extr = 5;
if (lex_match (lexer, T_LPAREN))
{
+ if (!lex_force_int (lexer))
+ goto error;
extr = lex_integer (lexer);
if (extr < 0)