projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
output: Get rid of unused SOM_ROW, SOM_COLUMN enums.
[pspp-builds.git]
/
src
/
language
/
stats
/
wilcoxon.c
diff --git
a/src/language/stats/wilcoxon.c
b/src/language/stats/wilcoxon.c
index c0329f6c01e5277e33304377d7ed07c56f99dca5..37d2b191ccfe323804733d69d0d7c7a98f9260af 100644
(file)
--- a/
src/language/stats/wilcoxon.c
+++ b/
src/language/stats/wilcoxon.c
@@
-17,23
+17,33
@@
#include <config.h>
#include <config.h>
+
#include "wilcoxon.h"
#include "wilcoxon.h"
-#include <data/variable.h>
+
+#include <gsl/gsl_cdf.h>
+#include <math.h>
+#include <signal.h>
+#include <unistd.h>
+
#include <data/casereader.h>
#include <data/casewriter.h>
#include <data/casereader.h>
#include <data/casewriter.h>
+#include <data/dictionary.h>
+#include <data/format.h>
+#include <data/procedure.h>
#include <data/subcase.h>
#include <data/subcase.h>
-#include <math/sort.h>
+#include <data/variable.h>
+#include <gsl/gsl_cdf.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
-#include <xalloc.h>
-#include <output/table.h>
-#include <data/procedure.h>
-#include <data/dictionary.h>
+#include <libpspp/misc.h>
+#include <math/sort.h>
#include <math/wilcoxon-sig.h>
#include <math/wilcoxon-sig.h>
-#include <gsl/gsl_cdf.h>
-#include <unistd.h>
+#include <output/table.h>
#include <signal.h>
#include <signal.h>
-#include <libpspp/assertion.h>
-#include <data/format.h>
+#include <unistd.h>
+
+#include "minmax.h"
+#include "xalloc.h"
static double
append_difference (const struct ccase *c, casenumber n UNUSED, void *aux)
static double
append_difference (const struct ccase *c, casenumber n UNUSED, void *aux)
@@
-79,10
+89,17
@@
wilcoxon_execute (const struct dataset *ds,
struct wilcoxon_state *ws = xcalloc (sizeof (*ws), t2s->n_pairs);
const struct variable *weight = dict_get_weight (dict);
struct variable *weightx = var_create_internal (WEIGHT_IDX);
struct wilcoxon_state *ws = xcalloc (sizeof (*ws), t2s->n_pairs);
const struct variable *weight = dict_get_weight (dict);
struct variable *weightx = var_create_internal (WEIGHT_IDX);
+ struct caseproto *proto;
input =
casereader_create_filter_weight (input, dict, &warn, NULL);
input =
casereader_create_filter_weight (input, dict, &warn, NULL);
+ proto = caseproto_create ();
+ proto = caseproto_add_width (proto, 0);
+ proto = caseproto_add_width (proto, 0);
+ if (weight != NULL)
+ proto = caseproto_add_width (proto, 0);
+
for (i = 0 ; i < t2s->n_pairs; ++i )
{
struct casereader *r = casereader_clone (input);
for (i = 0 ; i < t2s->n_pairs; ++i )
{
struct casereader *r = casereader_clone (input);
@@
-91,8
+108,6
@@
wilcoxon_execute (const struct dataset *ds,
struct subcase ordering;
variable_pair *vp = &t2s->pairs[i];
struct subcase ordering;
variable_pair *vp = &t2s->pairs[i];
- const int reader_width = weight ? 3 : 2;
-
ws[i].sign = var_create_internal (0);
ws[i].absdiff = var_create_internal (1);
ws[i].sign = var_create_internal (0);
ws[i].absdiff = var_create_internal (1);
@@
-101,12
+116,12
@@
wilcoxon_execute (const struct dataset *ds,
NULL, NULL);
subcase_init_var (&ordering, ws[i].absdiff, SC_ASCEND);
NULL, NULL);
subcase_init_var (&ordering, ws[i].absdiff, SC_ASCEND);
- writer = sort_create_writer (&ordering,
reader_width
);
+ writer = sort_create_writer (&ordering,
proto
);
subcase_destroy (&ordering);
for (; (c = casereader_read (r)) != NULL; case_unref (c))
{
subcase_destroy (&ordering);
for (; (c = casereader_read (r)) != NULL; case_unref (c))
{
- struct ccase *output = case_create (
reader_width
);
+ struct ccase *output = case_create (
proto
);
double d = append_difference (c, 0, vp);
if (d > 0)
double d = append_difference (c, 0, vp);
if (d > 0)
@@
-140,6
+155,7
@@
wilcoxon_execute (const struct dataset *ds,
casereader_destroy (r);
ws[i].reader = casewriter_make_reader (writer);
}
casereader_destroy (r);
ws[i].reader = casewriter_make_reader (writer);
}
+ caseproto_unref (proto);
for (i = 0 ; i < t2s->n_pairs; ++i )
{
for (i = 0 ; i < t2s->n_pairs; ++i )
{
@@
-211,7
+227,7
@@
show_ranks_box (const struct wilcoxon_state *ws,
struct tab_table *table = tab_create (5, 1 + 4 * t2s->n_pairs, 0);
struct tab_table *table = tab_create (5, 1 + 4 * t2s->n_pairs, 0);
- tab_dim (table, tab_natural_dimensions);
+ tab_dim (table, tab_natural_dimensions
, NULL
);
tab_title (table, _("Ranks"));
tab_title (table, _("Ranks"));
@@
-292,7
+308,7
@@
show_tests_box (const struct wilcoxon_state *ws,
size_t i;
struct tab_table *table = tab_create (1 + t2s->n_pairs, exact ? 5 : 3, 0);
size_t i;
struct tab_table *table = tab_create (1 + t2s->n_pairs, exact ? 5 : 3, 0);
- tab_dim (table, tab_natural_dimensions);
+ tab_dim (table, tab_natural_dimensions
, NULL
);
tab_title (table, _("Test Statistics"));
tab_title (table, _("Test Statistics"));