/* Sum of all weights, including those for missing values */
double n;
+ /* Sum of weights of non_missing values */
+ double n_valid;
+
double mean;
double variance;
case_data_idx (c, casereader_get_value_cnt (reader) - 1)->f;
const double weight = wv ? case_data (c, wv)->f : 1.0;
+ const union value *value = case_data (c, dependent_vars[v]);
if (weight != SYSMIS)
minimize (&result->metrics[v].cmin, weight);
moments1_add (result->metrics[v].moments,
- case_data (c, dependent_vars[v])->f,
+ value->f,
weight);
result->metrics[v].n += weight;
+ if ( ! var_is_value_missing (dependent_vars[v], value, MV_ANY) )
+ result->metrics[v].n_valid += weight;
+
extrema_add (result->metrics[v].maxima,
- case_data (c, dependent_vars[v])->f,
+ value->f,
weight,
loc);
extrema_add (result->metrics[v].minima,
- case_data (c, dependent_vars[v])->f,
+ value->f,
weight,
loc);
for (i = 0 ; i < metric->n_ptiles; ++i)
{
metric->ptl[i] = (struct percentile *)
- percentile_create (percentile_list.data[i] / 100.0, metric->n);
+ percentile_create (percentile_list.data[i] / 100.0, metric->n_valid);
if ( percentile_list.data[i] == 25)
metric->quartiles[0] = metric->ptl[i];
cd $TEMPDIR
-activity="create program"
+activity="create program 1"
cat > $TESTFILE << EOF
DATA LIST LIST /x * y *.
BEGIN DATA.
if [ $? -ne 0 ] ; then no_result ; fi
-activity="run program"
+activity="run program 1"
$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
EOF
if [ $? -ne 0 ] ; then fail ; fi
+
+#Make sure this doesn't interfere with percentiles operation.
+
+activity="create program 2"
+cat > $TESTFILE << EOF
+DATA LIST LIST /X *.
+BEGIN DATA.
+99
+99
+5.00
+END DATA.
+
+MISSING VALUE X (99).
+
+EXAMINE /x
+ /PERCENTILES=HAVERAGE.
+
+
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 2"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then fail ; fi
+
+
pass;