From: Ben Pfaff Date: Fri, 6 Feb 2009 06:28:15 +0000 (-0800) Subject: wilcoxon: Drop now-unnecessary timer support. X-Git-Tag: v0.7.3~307 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d077bbfd3230959846621bbfb1447410e17dd8c;p=pspp-builds.git wilcoxon: Drop now-unnecessary timer support. Calculating the Wilcoxon significance level now takes only a fraction of a second, so there is no need to support a timer. Also, report the problem if the significance level cannot be calculated. --- diff --git a/AUTHORS b/AUTHORS index 43103dcd..af7e9075 100644 --- a/AUTHORS +++ b/AUTHORS @@ -14,10 +14,6 @@ to other modules. including lib/gslextras and the linear regression features. Jason is also an important contributor to GSL, which is used by PSPP. -* Rob van Son wrote the routine for calculation of the significance -of the Wilcoxon matched pairs signed rank statistic used by the - NPAR TEST command. - We also thank past contributors: @@ -26,3 +22,8 @@ We also thank past contributors: * Michael Kiefte contributed bug fixes and other enhancements. * Patrick Kobly contributed bug fixes and other enhancements. + +* Rob van Son wrote the original version of the routine for + calculation of the significance of the Wilcoxon matched pairs signed + rank statistic used by the NPAR TEST command. + diff --git a/src/language/stats/wilcoxon.c b/src/language/stats/wilcoxon.c index a485f350..e44233a7 100644 --- a/src/language/stats/wilcoxon.c +++ b/src/language/stats/wilcoxon.c @@ -34,9 +34,6 @@ #include #include -static double timed_wilcoxon_significance (double w, long int n, double timer); - - static double append_difference (const struct ccase *c, casenumber n UNUSED, void *aux) { @@ -280,7 +277,7 @@ static void show_tests_box (const struct wilcoxon_state *ws, const struct two_sample_test *t2s, bool exact, - double timer + double timer UNUSED ) { size_t i; @@ -342,14 +339,10 @@ show_tests_box (const struct wilcoxon_state *ws, if (exact) { - double p = - timed_wilcoxon_significance (ws[i].positives.sum, - n, - timer ); - - if ( p == SYSMIS) + double p = LevelOfSignificanceWXMPSR (ws[i].positives.sum, n); + if (p < 0) { - msg (MW, _("Exact significance was not calculated after %.2f minutes. Skipping test."), timer); + msg (MW, ("Too many pairs to calculate exact significance.")); } else { @@ -365,48 +358,3 @@ show_tests_box (const struct wilcoxon_state *ws, tab_submit (table); } - - - -#include - -static sigjmp_buf env; - -static void -give_up_callback (int signal UNUSED) -{ - siglongjmp (env, 1); -} - -static double -timed_wilcoxon_significance (double w, long int n, double timer) -{ - double p = SYSMIS; - - sigset_t set; - - struct sigaction timeout_action; - struct sigaction old_action; - - if (timer <= 0 ) - return LevelOfSignificanceWXMPSR (w, n); - - sigemptyset (&set); - - timeout_action.sa_mask = set; - timeout_action.sa_flags = 0; - - timeout_action.sa_handler = give_up_callback; - - if ( 0 == sigsetjmp (env, 1)) - { - sigaction (SIGALRM, &timeout_action, &old_action); - alarm (timer * 60.0); - - p = LevelOfSignificanceWXMPSR (w, n); - } - - sigaction (SIGALRM, &old_action, NULL); - - return p; -} diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index 2918238c..9dd3b713 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation 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 @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -144,9 +143,6 @@ initialize (struct command_line_processor *clp, int argc, char **argv) journal_enable (); textdomain (PACKAGE); - /* Ignore alarm clock signals */ - signal (SIGALRM, SIG_IGN); - command_line_processor_replace_aux (clp, &post_init_argp, the_source_stream); command_line_processor_replace_aux (clp, &non_option_argp, the_source_stream); diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 904c9a1d..e37cace3 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009 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 @@ -89,7 +89,6 @@ main (int argc, char **argv) signal (SIGABRT, bug_handler); signal (SIGSEGV, bug_handler); signal (SIGFPE, bug_handler); - signal (SIGALRM, SIG_IGN); at_fatal_signal (clean_up); i18n_init ();