order_stats_accumulate (os, n_os,
casereader_clone (metric->up_reader),
- wv, dependent_vars[v]);
+ wv, dependent_vars[v], MV_ANY);
free (os);
}
}
order_stats_accumulate ((struct order_stats **) &metric->box_whisker,
1,
casereader_clone (metric->up_reader),
- wv, dependent_vars[v]);
+ wv, dependent_vars[v], MV_ANY);
}
}
#include <data/casereader.h>
#include <string.h>
+#if 0
+
+#include <stdio.h>
+
+static void
+order_stats_dump_k1 (const struct order_stats *os)
+{
+ struct k *k = &os->k[0];
+ printf ("K1: tc %g; c %g cc %g ccp %g\n",
+ k->tc, k->c, k->cc, k->cc_p1);
+
+}
+
+static void
+order_stats_dump_k2 (const struct order_stats *os)
+{
+ struct k *k = &os->k[1];
+ printf ("K2: tc %g; c %g cc %g ccp %g\n",
+ k->tc, k->c, k->cc, k->cc_p1);
+}
+
+
+void
+order_stats_dump (const struct order_stats *os)
+{
+ order_stats_dump_k1 (os);
+ order_stats_dump_k2 (os);
+}
+
+#endif
static void
update_k_lower (struct k *kk,
struct order_stats **os, size_t n_os)
{
int j;
+
for (j = 0 ; j < n_os ; ++j)
{
int k;
if ( stat->accumulate )
stat->accumulate (stat, cx, c_i, cc_i, y_i);
+
+ tos->cc = cc_i;
}
}
void
order_stats_accumulate (struct order_stats **os, size_t nos,
- struct casereader *reader,
- const struct variable *wv,
- const struct variable *var)
+ struct casereader *reader,
+ const struct variable *wv,
+ const struct variable *var,
+ enum mv_class exclude)
{
struct ccase cx;
struct ccase prev_cx;
/* The casereader MUST be sorted */
assert (this_value >= prev_value);
+ if ( var_is_value_missing (var, case_data (&cx, var), exclude))
+ continue;
+
case_destroy (&prev_cx);
if ( prev_value == -DBL_MAX || prev_value == this_value)
casereader_destroy (reader);
}
+
+
+
struct k
{
double tc;
-
double cc;
-
double cc_p1;
-
double c;
-
double c_p1;
-
double y;
-
double y_p1;
};
struct statistic parent;
int n_k;
struct k *k;
-};
-
-
-void dump_ptile_k1 (const struct order_stats *ptl);
+ double cc;
+};
-void dump_ptile_k2 (const struct order_stats *ptl);
+enum mv_class;
+void order_stats_dump (const struct order_stats *os);
void order_stats_accumulate (struct order_stats **ptl, size_t nos,
- struct casereader *reader,
- const struct variable *wv,
- const struct variable *var);
+ struct casereader *reader,
+ const struct variable *wv,
+ const struct variable *var,
+ enum mv_class exclude);
#endif
struct percentile *mutable = (struct percentile *) ptl;
const struct order_stats *os = &ptl->parent;
+ assert (os->cc == ptl->w);
+
if ( ptl->g1 == SYSMIS)
mutable->g1 = (os->k[0].tc - os->k[0].cc) / os->k[0].c_p1;
assert (p <= 1.0);
ptl->ptile = p;
+ ptl->w = W;
os->n_k = 2;
os->k = xcalloc (sizeof (*os->k), 2);
return os;
}
-#if 0
-void
-percentile_dump (const struct percentile *ptl)
-{
- printf ("Percentile %g:\n\tk1: ", ptl->ptile);
-
- dump_os_k1 ((const struct os *)ptl);
- printf ("\tk2: ");
- dump_os_k2 ((const struct os *)ptl);
- printf ("\n");
-}
-#endif