[gnumeric] Add Wilcoxon Signed Rank Test tools for one and two populations.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Add Wilcoxon Signed Rank Test tools for one and two populations.
- Date: Mon, 31 May 2010 23:52:39 +0000 (UTC)
commit 4e13534f2cde1b665be5350f7ba7b4579cf0df86
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Mon May 31 17:48:27 2010 -0600
Add Wilcoxon Signed Rank Test tools for one and two populations.
2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
* component/Gnumeric-embed.xml.in: added Wilcoxon Signed-Rank items
and rearrange into separate statistics menu.
* src/GNOME_Gnumeric-gtk.xml.in: ditto
* src/HILDON_Gnumeric-gtk.xml.in: ditto
* src/wbc-gtk-actions.c: ditto
(cb_tools_sign_test_two_medians): use new tool
(cb_tools_wilcoxon_signed_rank_two_medians): new
(cb_tools_wilcoxon_signed_rank_two_medians): new
2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
* POTFILES.in: added src/tools/analysis-signed-rank-test.c
2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
* POTFILES.in: added src/tools/analysis-signed-rank-test.c
2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
* analysis-signed-rank-test.[ch]: new
* Makefile.am: add the above
* analysis-tools.h (analysis_tool_get_function): new
* analysis-tools.c (analysis_tool_get_function): new
* analysis-sign-test.h: minor formatting
* analysis-sign-test.c
(analysis_tool_sign_test_two_engine_run): fix statistic
2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialogs.h (dialog_sign_test_two_tool): new
* dialog-analysis-tool-sign-test.c
(sign_test_tool_update_common_sensitivity_cb): new
(sign_test_tool_update_sensitivity_cb): split
(sign_test_two_tool_update_sensitivity_cb): new
(sign_test_two_tool_ok_clicked_cb): handle Signed-Rank
(sign_test_tool_ok_clicked_cb): ditto
(dialog_sign_test_two_tool): new
(dialog_sign_test_tool): handle Signed-Rank
* sign-test-two.glade: add radio buttons
* sign-test.glade: ditto
ChangeLog | 11 +
NEWS | 3 +
component/Gnumeric-embed.xml.in | 85 +++--
po-functions/ChangeLog | 7 +-
po-functions/POTFILES.in | 1 +
po/ChangeLog | 4 +
po/POTFILES.in | 1 +
src/GNOME_Gnumeric-gtk.xml.in | 85 +++--
src/HILDON_Gnumeric-gtk.xml.in | 76 ++--
src/dialogs/ChangeLog | 14 +
src/dialogs/dialog-analysis-tool-sign-test.c | 343 +++++++++++-----
src/dialogs/dialogs.h | 9 +-
src/dialogs/sign-test-two.glade | 52 ++-
src/dialogs/sign-test.glade | 51 ++-
src/tools/ChangeLog | 10 +
src/tools/Makefile.am | 2 +
src/tools/analysis-sign-test.c | 9 +-
src/tools/analysis-sign-test.h | 4 +-
src/tools/analysis-signed-rank-test.c | 591 ++++++++++++++++++++++++++
src/tools/analysis-signed-rank-test.h | 52 +++
src/tools/analysis-tools.c | 12 +
src/tools/analysis-tools.h | 4 +
src/wbc-gtk-actions.c | 181 +++++----
23 files changed, 1317 insertions(+), 290 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 15a9b4f..c8bb786 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * component/Gnumeric-embed.xml.in: added Wilcoxon Signed-Rank items
+ and rearrange into separate statistics menu.
+ * src/GNOME_Gnumeric-gtk.xml.in: ditto
+ * src/HILDON_Gnumeric-gtk.xml.in: ditto
+ * src/wbc-gtk-actions.c: ditto
+ (cb_tools_sign_test_two_medians): use new tool
+ (cb_tools_wilcoxon_signed_rank_two_medians): new
+ (cb_tools_wilcoxon_signed_rank_two_medians): new
+
2010-05-31 Morten Welinder <terra gnome org>
* src/hlink.c (gnm_hlink_external_activate): Use go_gtk_url_show.
diff --git a/NEWS b/NEWS
index 612c05f..f21e0ea 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
Gnumeric 1.10.6
+Andreas:
+ * Add Wilcoxon Signed Rank Test tools for one and two populations.
+
Morten:
* Make sure windows for help commands show up on right screen.
diff --git a/component/Gnumeric-embed.xml.in b/component/Gnumeric-embed.xml.in
index f9d5ab5..61cbb61 100644
--- a/component/Gnumeric-embed.xml.in
+++ b/component/Gnumeric-embed.xml.in
@@ -160,48 +160,63 @@
<menuitem action="ToolsScenarioAdd"/>
</menu>
<menuitem action="ToolsSimulation"/>
- <menu name="ToolStatisticalAnalysis" action="MenuToolStatisticalAnalysis">
- <menu name="ANOVA" action="MenuANOVA">
- <menuitem action="ToolsANOVAoneFactor"/>
- <menuitem action="ToolsANOVAtwoFactor"/>
- </menu>
- <menu name="ChiSquareTests" action="MenuContingencyTests">
- <menuitem action="ToolsHomogeneity"/>
- <menuitem action="ToolsIndependence"/>
- </menu>
- <menuitem action="ToolsCorrelation"/>
- <menuitem action="ToolsCovariance"/>
- <menuitem action="ToolsDescStatistics"/>
- <menu name="ToolForecast" action="MenuToolForecast">
- <menuitem action="ToolsExpSmoothing"/>
- <menuitem action="ToolsAverage"/>
- </menu>
- <menuitem action="ToolsFourier"/>
- <menu name="ToolFrequencies" action="MenuToolFrequencies">
+ <separator/>
+ <menuitem action="ToolsPlugins"/>
+ </menu>
+ <menu name="Statistics" action="MenuStatistics">
+ <menu name="StatisticsDescriptive" action="MenuStatisticsDescriptive">
+ <menuitem action="ToolsCorrelation"/>
+ <menuitem action="ToolsCovariance"/>
+ <menuitem action="ToolsDescStatistics"/>
+ <menu name="ToolFrequencies" action="MenuToolFrequencies">
<menuitem action="ToolsFrequency"/>
<menuitem action="ToolsHistogram"/>
- </menu>
- <menuitem action="ToolsKaplanMeier"/>
- <menuitem action="ToolsNormalityTests"/>
- <menuitem action="ToolsPrincipalComponents"/>
- <menuitem action="ToolsRanking"/>
- <menuitem action="ToolsRegression"/>
- <menuitem action="ToolsSampling"/>
- <menuitem action="ToolsOneMedianSignTest"/>
- <menu name="ToolTwoMedians" action="MenuToolTwoMedians">
- <menuitem action="ToolsTwoMedianSignTest"/>
- <menuitem action="ToolsTwoMedianWilcoxonMannWhitney"/>
- </menu>
- <menu name="ToolTTest" action="MenuToolTTest">
+ </menu>
+ <menuitem action="ToolsRanking"/>
+ </menu>
+ <menuitem action="ToolsSampling"/>
+ <menu name="StatisticsTimeSeries" action="MenuStatisticsTimeSeries">
+ <menu name="ToolForecast" action="MenuToolForecast">
+ <menuitem action="ToolsExpSmoothing"/>
+ <menuitem action="ToolsAverage"/>
+ </menu>
+ <menuitem action="ToolsFourier"/>
+ <menuitem action="ToolsKaplanMeier"/>
+ <menuitem action="ToolsPrincipalComponents"/>
+ <menuitem action="ToolsRegression"/>
+ </menu>
+ <separator/>
+ <menu name="StatisticsOneSample" action="MenuStatisticsOneSample">
+ <menuitem action="ToolsNormalityTests"/>
+ <menu name="ToolOneMedian" action="MenuToolOneMedian">
+ <menuitem action="ToolsOneMedianSignTest"/>
+ <menuitem action="ToolsOneMedianWilcoxonSignedRank"/>
+ </menu>
+ </menu>
+ <menu name="StatisticsTwoSamples" action="MenuStatisticsTwoSamples">
+ <menu name="ToolTTest" action="MenuToolTTest">
<menuitem action="ToolTTestPaired"/>
<menuitem action="ToolTTestEqualVar"/>
<menuitem action="ToolTTestUnequalVar"/>
<menuitem action="ToolZTest"/>
- </menu>
- <menuitem action="ToolsFTest"/>
+ </menu>
+ <menu name="ToolTwoMedians" action="MenuToolTwoMedians">
+ <menuitem action="ToolsTwoMedianSignTest"/>
+ <menuitem action="ToolsTwoMedianWilcoxonSignedRank"/>
+ <menuitem action="ToolsTwoMedianWilcoxonMannWhitney"/>
+ </menu>
+ <menuitem action="ToolsFTest"/>
+ </menu>
+ <menu name="StatisticsMultipleSamples" action="MenuStatisticsMultipleSamples">
+ <menu name="ANOVA" action="MenuANOVA">
+ <menuitem action="ToolsANOVAoneFactor"/>
+ <menuitem action="ToolsANOVAtwoFactor"/>
+ </menu>
+ <menu name="ChiSquareTests" action="MenuContingencyTests">
+ <menuitem action="ToolsHomogeneity"/>
+ <menuitem action="ToolsIndependence"/>
+ </menu>
</menu>
- <separator/>
- <menuitem action="ToolsPlugins"/>
</menu>
<menu name="Data" action="MenuData">
<menuitem action="DataSort"/>
diff --git a/po-functions/ChangeLog b/po-functions/ChangeLog
index 7eaf5dd..fb7f007 100644
--- a/po-functions/ChangeLog
+++ b/po-functions/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * POTFILES.in: added src/tools/analysis-signed-rank-test.c
+
2010-05-30 Morten Welinder <terra gnome org>
* Release 1.10.5
@@ -203,7 +207,8 @@
2007-12-31 Yannig Marchegay <yannig marchegay org>
* oc.po: Updated Occitan translation.
-2007-12-21 Jody Goldberg <jody gnome org>
+
+2007-12-21 Jody Goldberg <jody gnome org>
* Release 1.8.0
diff --git a/po-functions/POTFILES.in b/po-functions/POTFILES.in
index 46c9cb2..4afa5b2 100644
--- a/po-functions/POTFILES.in
+++ b/po-functions/POTFILES.in
@@ -205,6 +205,7 @@ src/tools/analysis-kaplan-meier.c
src/tools/analysis-normality.c
src/tools/analysis-principal-components.c
src/tools/analysis-sign-test.c
+src/tools/analysis-signed-rank-test.c
src/tools/analysis-tools.c
src/tools/analysis-wilcoxon-mann-whitney.c
src/tools/dao.c
diff --git a/po/ChangeLog b/po/ChangeLog
index 7408720..97b7ddc 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * POTFILES.in: added src/tools/analysis-signed-rank-test.c
+
2010-05-30 Morten Welinder <terra gnome org>
* Release 1.10.5
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ba075ba..0e02c5d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -344,6 +344,7 @@ src/tools/analysis-kaplan-meier.c
src/tools/analysis-normality.c
src/tools/analysis-principal-components.c
src/tools/analysis-sign-test.c
+src/tools/analysis-signed-rank-test.c
src/tools/analysis-tools.c
src/tools/analysis-wilcoxon-mann-whitney.c
src/tools/dao.c
diff --git a/src/GNOME_Gnumeric-gtk.xml.in b/src/GNOME_Gnumeric-gtk.xml.in
index 1f36919..a93f4b0 100644
--- a/src/GNOME_Gnumeric-gtk.xml.in
+++ b/src/GNOME_Gnumeric-gtk.xml.in
@@ -161,48 +161,63 @@
<menuitem action="ToolsScenarioAdd"/>
</menu>
<menuitem action="ToolsSimulation"/>
- <menu name="ToolStatisticalAnalysis" action="MenuToolStatisticalAnalysis">
- <menu name="ANOVA" action="MenuANOVA">
- <menuitem action="ToolsANOVAoneFactor"/>
- <menuitem action="ToolsANOVAtwoFactor"/>
- </menu>
- <menu name="ChiSquareTests" action="MenuContingencyTests">
- <menuitem action="ToolsHomogeneity"/>
- <menuitem action="ToolsIndependence"/>
- </menu>
- <menuitem action="ToolsCorrelation"/>
- <menuitem action="ToolsCovariance"/>
- <menuitem action="ToolsDescStatistics"/>
- <menu name="ToolForecast" action="MenuToolForecast">
- <menuitem action="ToolsExpSmoothing"/>
- <menuitem action="ToolsAverage"/>
- </menu>
- <menuitem action="ToolsFourier"/>
- <menu name="ToolFrequencies" action="MenuToolFrequencies">
+ <separator/>
+ <menuitem action="ToolsPlugins"/>
+ </menu>
+ <menu name="Statistics" action="MenuStatistics">
+ <menu name="StatisticsDescriptive" action="MenuStatisticsDescriptive">
+ <menuitem action="ToolsCorrelation"/>
+ <menuitem action="ToolsCovariance"/>
+ <menuitem action="ToolsDescStatistics"/>
+ <menu name="ToolFrequencies" action="MenuToolFrequencies">
<menuitem action="ToolsFrequency"/>
<menuitem action="ToolsHistogram"/>
- </menu>
- <menuitem action="ToolsKaplanMeier"/>
- <menuitem action="ToolsNormalityTests"/>
- <menuitem action="ToolsPrincipalComponents"/>
- <menuitem action="ToolsRanking"/>
- <menuitem action="ToolsRegression"/>
- <menuitem action="ToolsSampling"/>
- <menuitem action="ToolsOneMedianSignTest"/>
- <menu name="ToolTwoMedians" action="MenuToolTwoMedians">
- <menuitem action="ToolsTwoMedianSignTest"/>
- <menuitem action="ToolsTwoMedianWilcoxonMannWhitney"/>
- </menu>
- <menu name="ToolTTest" action="MenuToolTTest">
+ </menu>
+ <menuitem action="ToolsRanking"/>
+ </menu>
+ <menuitem action="ToolsSampling"/>
+ <menu name="StatisticsTimeSeries" action="MenuStatisticsTimeSeries">
+ <menu name="ToolForecast" action="MenuToolForecast">
+ <menuitem action="ToolsExpSmoothing"/>
+ <menuitem action="ToolsAverage"/>
+ </menu>
+ <menuitem action="ToolsFourier"/>
+ <menuitem action="ToolsKaplanMeier"/>
+ <menuitem action="ToolsPrincipalComponents"/>
+ <menuitem action="ToolsRegression"/>
+ </menu>
+ <separator/>
+ <menu name="StatisticsOneSample" action="MenuStatisticsOneSample">
+ <menuitem action="ToolsNormalityTests"/>
+ <menu name="ToolOneMedian" action="MenuToolOneMedian">
+ <menuitem action="ToolsOneMedianSignTest"/>
+ <menuitem action="ToolsOneMedianWilcoxonSignedRank"/>
+ </menu>
+ </menu>
+ <menu name="StatisticsTwoSamples" action="MenuStatisticsTwoSamples">
+ <menu name="ToolTTest" action="MenuToolTTest">
<menuitem action="ToolTTestPaired"/>
<menuitem action="ToolTTestEqualVar"/>
<menuitem action="ToolTTestUnequalVar"/>
<menuitem action="ToolZTest"/>
- </menu>
- <menuitem action="ToolsFTest"/>
+ </menu>
+ <menu name="ToolTwoMedians" action="MenuToolTwoMedians">
+ <menuitem action="ToolsTwoMedianSignTest"/>
+ <menuitem action="ToolsTwoMedianWilcoxonSignedRank"/>
+ <menuitem action="ToolsTwoMedianWilcoxonMannWhitney"/>
+ </menu>
+ <menuitem action="ToolsFTest"/>
+ </menu>
+ <menu name="StatisticsMultipleSamples" action="MenuStatisticsMultipleSamples">
+ <menu name="ANOVA" action="MenuANOVA">
+ <menuitem action="ToolsANOVAoneFactor"/>
+ <menuitem action="ToolsANOVAtwoFactor"/>
+ </menu>
+ <menu name="ChiSquareTests" action="MenuContingencyTests">
+ <menuitem action="ToolsHomogeneity"/>
+ <menuitem action="ToolsIndependence"/>
+ </menu>
</menu>
- <separator/>
- <menuitem action="ToolsPlugins"/>
</menu>
<menu name="Data" action="MenuData">
<menuitem action="DataSort"/>
diff --git a/src/HILDON_Gnumeric-gtk.xml.in b/src/HILDON_Gnumeric-gtk.xml.in
index 3056470..39116f2 100644
--- a/src/HILDON_Gnumeric-gtk.xml.in
+++ b/src/HILDON_Gnumeric-gtk.xml.in
@@ -172,42 +172,60 @@
<menuitem action="ToolsScenarioAdd"/>
</menu>
<menuitem action="ToolsSimulation"/>
- <separator/>
- <menu name="ToolStatisticalAnalysis" action="MenuToolStatisticalAnalysis">
- <menu name="ANOVA" action="MenuANOVA">
- <menuitem action="ToolsANOVAoneFactor"/>
- <menuitem action="ToolsANOVAtwoFactor"/>
- </menu>
- <menuitem action="ToolsCorrelation"/>
- <menuitem action="ToolsCovariance"/>
- <menuitem action="ToolsDescStatistics"/>
- <menu name="ToolForecast" action="MenuToolForecast">
- <menuitem action="ToolsExpSmoothing"/>
- <menuitem action="ToolsAverage"/>
- </menu>
- <menuitem action="ToolsFourier"/>
- <menu name="ToolFrequencies" action="MenuToolFrequencies">
+ </menu>
+ <menu name="Statistics" action="MenuStatistics">
+ <menu name="StatisticsDescriptive" action="MenuStatisticsDescriptive">
+ <menuitem action="ToolsCorrelation"/>
+ <menuitem action="ToolsCovariance"/>
+ <menuitem action="ToolsDescStatistics"/>
+ <menu name="ToolFrequencies" action="MenuToolFrequencies">
<menuitem action="ToolsFrequency"/>
<menuitem action="ToolsHistogram"/>
</menu>
- <menuitem action="ToolsKaplanMeier"/>
- <menuitem action="ToolsNormalityTests"/>
- <menuitem action="ToolsPrincipalComponents"/>
- <menuitem action="ToolsRanking"/>
- <menuitem action="ToolsRegression"/>
- <menuitem action="ToolsSampling"/>
- <menuitem action="ToolsOneMedianSignTest"/>
- <menu name="ToolTwoMedians" action="MenuToolTwoMedians">
- <menuitem action="ToolsTwoMedianSignTest"/>
- <menuitem action="ToolsTwoMedianWilcoxonMannWhitney"/>
- </menu>
- <menu name="ToolTTest" action="MenuToolTTest">
+ <menuitem action="ToolsRanking"/>
+ </menu>
+ <menuitem action="ToolsSampling"/>
+ <menu name="StatisticsTimeSeries" action="MenuStatisticsTimeSeries">
+ <menu name="ToolForecast" action="MenuToolForecast">
+ <menuitem action="ToolsExpSmoothing"/>
+ <menuitem action="ToolsAverage"/>
+ </menu>
+ <menuitem action="ToolsFourier"/>
+ <menuitem action="ToolsKaplanMeier"/>
+ <menuitem action="ToolsPrincipalComponents"/>
+ <menuitem action="ToolsRegression"/>
+ </menu>
+ <separator/>
+ <menu name="StatisticsOneSample" action="MenuStatisticsOneSample">
+ <menuitem action="ToolsNormalityTests"/>
+ <menu name="ToolOneMedian" action="MenuToolOneMedian">
+ <menuitem action="ToolsOneMedianSignTest"/>
+ <menuitem action="ToolsOneMedianWilcoxonSignedRank"/>
+ </menu>
+ </menu>
+ <menu name="StatisticsTwoSamples" action="MenuStatisticsTwoSamples">
+ <menu name="ToolTTest" action="MenuToolTTest">
<menuitem action="ToolTTestPaired"/>
<menuitem action="ToolTTestEqualVar"/>
<menuitem action="ToolTTestUnequalVar"/>
<menuitem action="ToolZTest"/>
- </menu>
- <menuitem action="ToolsFTest"/>
+ </menu>
+ <menu name="ToolTwoMedians" action="MenuToolTwoMedians">
+ <menuitem action="ToolsTwoMedianSignTest"/>
+ <menuitem action="ToolsTwoMedianWilcoxonSignedRank"/>
+ <menuitem action="ToolsTwoMedianWilcoxonMannWhitney"/>
+ </menu>
+ <menuitem action="ToolsFTest"/>
+ </menu>
+ <menu name="StatisticsMultipleSamples" action="MenuStatisticsMultipleSamples">
+ <menu name="ANOVA" action="MenuANOVA">
+ <menuitem action="ToolsANOVAoneFactor"/>
+ <menuitem action="ToolsANOVAtwoFactor"/>
+ </menu>
+ <menu name="ChiSquareTests" action="MenuContingencyTests">
+ <menuitem action="ToolsHomogeneity"/>
+ <menuitem action="ToolsIndependence"/>
+ </menu>
</menu>
</menu>
<menu name="Data" action="MenuData">
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 816f35b..627c418 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,17 @@
+2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * dialogs.h (dialog_sign_test_two_tool): new
+ * dialog-analysis-tool-sign-test.c
+ (sign_test_tool_update_common_sensitivity_cb): new
+ (sign_test_tool_update_sensitivity_cb): split
+ (sign_test_two_tool_update_sensitivity_cb): new
+ (sign_test_two_tool_ok_clicked_cb): handle Signed-Rank
+ (sign_test_tool_ok_clicked_cb): ditto
+ (dialog_sign_test_two_tool): new
+ (dialog_sign_test_tool): handle Signed-Rank
+ * sign-test-two.glade: add radio buttons
+ * sign-test.glade: ditto
+
2010-05-30 Morten Welinder <terra gnome org>
* Release 1.10.5
diff --git a/src/dialogs/dialog-analysis-tool-sign-test.c b/src/dialogs/dialog-analysis-tool-sign-test.c
index 3ee8a26..027cbc1 100644
--- a/src/dialogs/dialog-analysis-tool-sign-test.c
+++ b/src/dialogs/dialog-analysis-tool-sign-test.c
@@ -3,9 +3,9 @@
* dialog-analysis-tool-sign-test.c:
*
* Authors:
- * Andreas J. Guelzow <aguelzow taliesin ca>
+ * Andreas J. Guelzow <aguelzow pyrshep ca>
*
- * (C) Copyright 2009 by Andreas J. Guelzow <aguelzow pyrshep ca>
+ * (C) Copyright 2009-2010 by Andreas J. Guelzow <aguelzow pyrshep ca>
*
* 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
@@ -27,6 +27,7 @@
#include <gnumeric.h>
#include "dialogs.h"
#include "analysis-sign-test.h"
+#include "analysis-signed-rank-test.h"
#include "analysis-tools.h"
#include <workbook.h>
@@ -71,49 +72,19 @@ typedef struct {
} SignTestToolState;
/**
- * sign_test_tool_update_sensitivity_cb:
+ * sign_test_tool_update_common_sensitivity_cb:
* @dummy:
* @state:
*
* Update the dialog widgets sensitivity
**/
-static void
-sign_test_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
- SignTestToolState *state)
+static gboolean
+sign_test_tool_update_common_sensitivity_cb (SignTestToolState *state)
{
gnm_float alpha;
gnm_float median;
- GSList *input_range;
gboolean err;
- /* Checking first input range*/
- input_range = gnm_expr_entry_parse_as_list
- (GNM_EXPR_ENTRY (state->base.input_entry),
- state->base.sheet);
- if (input_range == NULL) {
- gtk_label_set_text (GTK_LABEL (state->base.warning),
- (state->base.input_entry_2 == NULL)
- ? _("The input range is invalid.")
- : _("The first input range is invalid."));
- gtk_widget_set_sensitive (state->base.ok_button, FALSE);
- return;
- } else
- range_list_destroy (input_range);
-
- /* Checking second input range*/
- if (state->base.input_entry_2 != NULL) {
- input_range = gnm_expr_entry_parse_as_list
- (GNM_EXPR_ENTRY (state->base.input_entry_2),
- state->base.sheet);
- if (input_range == NULL) {
- gtk_label_set_text (GTK_LABEL (state->base.warning),
- _("The second input range is invalid."));
- gtk_widget_set_sensitive (state->base.ok_button, FALSE);
- return;
- } else
- range_list_destroy (input_range);
- }
-
/* Checking Median*/
err = entry_to_float
(GTK_ENTRY (state->median_entry), &median, FALSE);
@@ -121,7 +92,7 @@ sign_test_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
gtk_label_set_text (GTK_LABEL (state->base.warning),
_("The predicted median should be a number."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
- return;
+ return FALSE;
}
/* Checking Alpha*/
@@ -132,7 +103,7 @@ sign_test_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
_("The alpha value should "
"be a number between 0 and 1."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
- return;
+ return FALSE;
}
/* Checking Output Page */
@@ -141,154 +112,318 @@ sign_test_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
_("The output specification "
"is invalid."));
gtk_widget_set_sensitive (state->base.ok_button, FALSE);
- return;
+ return FALSE;
}
- gtk_label_set_text (GTK_LABEL (state->base.warning), "");
- gtk_widget_set_sensitive (state->base.ok_button, TRUE);
-
+ return TRUE;
}
/**
- * sign_test_tool_ok_clicked_cb:
- * @button:
+ * sign_test_tool_update_sensitivity_cb:
+ * @dummy:
* @state:
*
- * Retrieve the information from the dialog and call the sign_test_tool.
- * Note that we assume that the ok_button is only active if the entry fields
- * contain sensible data.
+ * Update the dialog widgets sensitivity
**/
static void
-sign_test_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
+sign_test_two_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
+ SignTestToolState *state)
+{
+ GnmValue *input_range;
+ gint w, h;
+
+ /* Checking first input range*/
+ input_range = gnm_expr_entry_parse_as_value
+ (GNM_EXPR_ENTRY (state->base.input_entry),
+ state->base.sheet);
+ if (input_range == NULL || input_range->type != VALUE_CELLRANGE) {
+ gtk_label_set_text (GTK_LABEL (state->base.warning),
+ (state->base.input_entry_2 == NULL)
+ ? _("The input range is invalid.")
+ : _("The first input range is invalid."));
+ gtk_widget_set_sensitive (state->base.ok_button, FALSE);
+ value_release (input_range);
+ return;
+ } else {
+ GnmRange r;
+ range_init_rangeref (&r, &(input_range->v_range.cell));
+ w = range_width (&r);
+ h = range_height (&r);
+ value_release (input_range);
+ }
+
+ /* Checking second input range*/
+ if (state->base.input_entry_2 != NULL) {
+ input_range = gnm_expr_entry_parse_as_value
+ (GNM_EXPR_ENTRY (state->base.input_entry_2),
+ state->base.sheet);
+ if (input_range == NULL || input_range->type != VALUE_CELLRANGE) {
+ gtk_label_set_text (GTK_LABEL (state->base.warning),
+ _("The second input range is invalid."));
+ gtk_widget_set_sensitive (state->base.ok_button, FALSE);
+ value_release (input_range);
+ return;
+ } else {
+ GnmRange r;
+ range_init_rangeref (&r, &(input_range->v_range.cell));
+ value_release (input_range);
+ if (w != range_width (&r) ||
+ h != range_height (&r)) {
+ gtk_label_set_text
+ (GTK_LABEL (state->base.warning),
+ _("The input ranges do not have the same shape."));
+ gtk_widget_set_sensitive
+ (state->base.ok_button, FALSE);
+ return;
+
+ }
+ }
+ }
+
+ if (sign_test_tool_update_common_sensitivity_cb (state)) {
+ gtk_label_set_text (GTK_LABEL (state->base.warning), "");
+ gtk_widget_set_sensitive (state->base.ok_button, TRUE);
+ }
+}
+
+static void
+sign_test_two_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
SignTestToolState *state)
{
data_analysis_output_t *dao;
GtkWidget *w;
- analysis_tools_data_sign_test_t *data;
+ analysis_tools_data_sign_test_two_t *data;
gboolean err;
+ analysis_tool_engine engine;
- data = g_new0 (analysis_tools_data_sign_test_t, 1);
+ data = g_new0 (analysis_tools_data_sign_test_two_t, 1);
dao = parse_output ((GenericToolState *)state, NULL);
- data->base.input = gnm_expr_entry_parse_as_list (
- GNM_EXPR_ENTRY (state->base.input_entry), state->base.sheet);
- data->base.group_by = gnumeric_glade_group_value (state->base.gui, grouped_by_group);
-
+ data->base.range_1 = gnm_expr_entry_parse_as_value
+ (GNM_EXPR_ENTRY (state->base.input_entry), state->base.sheet);
+
+ data->base.range_2 = gnm_expr_entry_parse_as_value
+ (GNM_EXPR_ENTRY (state->base.input_entry_2), state->base.sheet);
+
w = glade_xml_get_widget (state->base.gui, "labels_button");
data->base.labels = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (w));
err = entry_to_float
(GTK_ENTRY (state->median_entry), &data->median, FALSE);
- data->alpha = gtk_spin_button_get_value
+
+ data->base.alpha = gtk_spin_button_get_value
(GTK_SPIN_BUTTON (state->alpha_entry));
- if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg), state->base.sheet,
- dao, data, analysis_tool_sign_test_engine))
+ w = glade_xml_get_widget (state->base.gui, "signtest");
+ engine = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w))
+ ? analysis_tool_sign_test_two_engine
+ : analysis_tool_signed_rank_test_two_engine;
+
+ if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg),
+ state->base.sheet,
+ dao, data, engine))
gtk_widget_destroy (state->base.dialog);
return;
}
+/**
+ * dialog_sign_test_two_tool:
+ *
+ **/
+int
+dialog_sign_test_two_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type type)
+{
+ char const * plugins[] = { "Gnumeric_fnstat",
+ "Gnumeric_fnlogical",
+ "Gnumeric_fnmath",
+ "Gnumeric_fninfo",
+ NULL};
+ SignTestToolState *state;
+ GtkWidget *w;
+
+ if ((wbcg == NULL) ||
+ gnm_check_for_plugins_missing (plugins, wbcg_toplevel (wbcg)))
+ return 1;
+
+ /* Only pop up one copy per workbook */
+ if (gnumeric_dialog_raise_if_exists (wbcg, SIGN_TEST_KEY_TWO))
+ return 0;
+
+ state = g_new0 (SignTestToolState, 1);
+
+ if (dialog_tool_init (&state->base, wbcg, sheet,
+ GNUMERIC_HELP_LINK_SIGN_TEST,
+ "sign-test-two.glade", "Sign-Test",
+ _("Could not create the Sign Test Tool dialog."),
+ SIGN_TEST_KEY_TWO,
+ G_CALLBACK (sign_test_two_tool_ok_clicked_cb),
+ NULL,
+ G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
+ GNM_EE_SINGLE_RANGE))
+ return 0;
+
+
+ state->alpha_entry = glade_xml_get_widget (state->base.gui,
+ "alpha-entry");
+ float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
+ g_signal_connect (G_OBJECT (state->alpha_entry),
+ "value-changed",
+ G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
+ state);
+ gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
+ GTK_WIDGET (state->alpha_entry));
+
+ state->median_entry = glade_xml_get_widget (state->base.gui,
+ "median-entry");
+ int_to_entry (GTK_ENTRY (state->median_entry), 0);
+ g_signal_connect_after (G_OBJECT (state->median_entry),
+ "changed",
+ G_CALLBACK (sign_test_two_tool_update_sensitivity_cb),
+ state);
+ gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
+ GTK_WIDGET (state->median_entry));
+ w = glade_xml_get_widget (state->base.gui,
+ (type == SIGNTEST) ? "signtest" : "signedranktest");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE);
+
+ gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
+ sign_test_two_tool_update_sensitivity_cb (NULL, state);
+ tool_load_selection ((GenericToolState *)state, TRUE);
+
+ return 0;
+
+}
+
+/************************************************************************************/
+
+/**
+ * sign_test_tool_ok_clicked_cb:
+ * @button:
+ * @state:
+ *
+ * Retrieve the information from the dialog and call the sign_test_tool.
+ * Note that we assume that the ok_button is only active if the entry fields
+ * contain sensible data.
+ **/
static void
-sign_test_two_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
+sign_test_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
SignTestToolState *state)
{
data_analysis_output_t *dao;
GtkWidget *w;
- analysis_tools_data_sign_test_two_t *data;
+ analysis_tools_data_sign_test_t *data;
gboolean err;
+ analysis_tool_engine engine;
- data = g_new0 (analysis_tools_data_sign_test_two_t, 1);
+ data = g_new0 (analysis_tools_data_sign_test_t, 1);
dao = parse_output ((GenericToolState *)state, NULL);
- data->base.range_1 = gnm_expr_entry_parse_as_value
- (GNM_EXPR_ENTRY (state->base.input_entry), state->base.sheet);
-
- data->base.range_2 = gnm_expr_entry_parse_as_value
- (GNM_EXPR_ENTRY (state->base.input_entry_2), state->base.sheet);
-
+ data->base.input = gnm_expr_entry_parse_as_list (
+ GNM_EXPR_ENTRY (state->base.input_entry), state->base.sheet);
+ data->base.group_by = gnumeric_glade_group_value (state->base.gui, grouped_by_group);
+
w = glade_xml_get_widget (state->base.gui, "labels_button");
data->base.labels = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (w));
err = entry_to_float
(GTK_ENTRY (state->median_entry), &data->median, FALSE);
-
- data->base.alpha = gtk_spin_button_get_value
+ data->alpha = gtk_spin_button_get_value
(GTK_SPIN_BUTTON (state->alpha_entry));
+ w = glade_xml_get_widget (state->base.gui, "signtest");
+ engine = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w))
+ ? analysis_tool_sign_test_engine
+ : analysis_tool_signed_rank_test_engine;
+
if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg), state->base.sheet,
- dao, data, analysis_tool_sign_test_two_engine))
+ dao, data, engine))
gtk_widget_destroy (state->base.dialog);
return;
}
/**
- * dialog_sign_test_tool:
- * @wbcg:
- * @sheet:
+ * sign_test_tool_update_sensitivity_cb:
+ * @dummy:
+ * @state:
*
- * Show the dialog (guru).
+ * Update the dialog widgets sensitivity
+ **/
+static void
+sign_test_tool_update_sensitivity_cb (G_GNUC_UNUSED GtkWidget *dummy,
+ SignTestToolState *state)
+{
+ GSList *input_range;
+
+ /* Checking first input range*/
+ input_range = gnm_expr_entry_parse_as_list
+ (GNM_EXPR_ENTRY (state->base.input_entry),
+ state->base.sheet);
+ if (input_range == NULL) {
+ gtk_label_set_text (GTK_LABEL (state->base.warning),
+ (state->base.input_entry_2 == NULL)
+ ? _("The input range is invalid.")
+ : _("The first input range is invalid."));
+ gtk_widget_set_sensitive (state->base.ok_button, FALSE);
+ return;
+ } else
+ range_list_destroy (input_range);
+
+ if (sign_test_tool_update_common_sensitivity_cb (state)) {
+ gtk_label_set_text (GTK_LABEL (state->base.warning), "");
+ gtk_widget_set_sensitive (state->base.ok_button, TRUE);
+ }
+
+}
+
+/**
+ * dialog_sign_test_tool:
*
**/
int
-dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type n_median)
+dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type type)
{
- char const *key, *glade;
char const * plugins[] = { "Gnumeric_fnstat",
"Gnumeric_fnlogical",
"Gnumeric_fnmath",
"Gnumeric_fninfo",
NULL};
SignTestToolState *state;
- GnmExprEntryFlags flags = 0;
- GCallback cb;
+ GtkWidget *w;
if ((wbcg == NULL) ||
gnm_check_for_plugins_missing (plugins, wbcg_toplevel (wbcg)))
return 1;
-
- switch (n_median) {
- case SIGNTEST_2:
- key = SIGN_TEST_KEY_TWO;
- glade = "sign-test-two.glade";
- flags = GNM_EE_SINGLE_RANGE;
- cb = G_CALLBACK (sign_test_two_tool_ok_clicked_cb);
- break;
- case SIGNTEST_1:
- default:
- key = SIGN_TEST_KEY_ONE;
- glade = "sign-test.glade";
- cb = G_CALLBACK (sign_test_tool_ok_clicked_cb);
- break;
- }
-
/* Only pop up one copy per workbook */
- if (gnumeric_dialog_raise_if_exists (wbcg, key))
+ if (gnumeric_dialog_raise_if_exists (wbcg, SIGN_TEST_KEY_ONE))
return 0;
state = g_new0 (SignTestToolState, 1);
if (dialog_tool_init (&state->base, wbcg, sheet,
GNUMERIC_HELP_LINK_SIGN_TEST,
- glade, "Sign-Test",
+ "sign-test.glade", "Sign-Test",
_("Could not create the Sign Test Tool dialog."),
- key, cb, NULL,
- G_CALLBACK (sign_test_tool_update_sensitivity_cb),
- flags))
+ SIGN_TEST_KEY_ONE,
+ G_CALLBACK (sign_test_tool_ok_clicked_cb),
+ NULL,
+ G_CALLBACK (sign_test_tool_update_sensitivity_cb),
+ 0))
return 0;
state->alpha_entry = glade_xml_get_widget (state->base.gui,
"alpha-entry");
float_to_entry (GTK_ENTRY (state->alpha_entry), 0.05);
- g_signal_connect_after (G_OBJECT (state->alpha_entry),
- "changed",
- G_CALLBACK (sign_test_tool_update_sensitivity_cb), state);
+ g_signal_connect (G_OBJECT (state->alpha_entry),
+ "value-changed",
+ G_CALLBACK (sign_test_tool_update_sensitivity_cb),
+ state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->alpha_entry));
@@ -296,14 +431,18 @@ dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type n_median)
"median-entry");
int_to_entry (GTK_ENTRY (state->median_entry), 0);
g_signal_connect_after (G_OBJECT (state->median_entry),
- "changed",
- G_CALLBACK (sign_test_tool_update_sensitivity_cb), state);
+ "changed", G_CALLBACK (sign_test_tool_update_sensitivity_cb),
+ state);
gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
GTK_WIDGET (state->median_entry));
+ w = glade_xml_get_widget (state->base.gui,
+ (type == SIGNTEST) ? "signtest" : "signedranktest");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), TRUE);
gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
sign_test_tool_update_sensitivity_cb (NULL, state);
tool_load_selection ((GenericToolState *)state, TRUE);
return 0;
+
}
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index 1d1494f..6d2d7b7 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -97,11 +97,14 @@ int dialog_principal_components_tool (WBCGtk *wbcg, Sheet *sheet);
int dialog_wilcoxon_m_w_tool (WBCGtk *wbcg, Sheet *sheet);
typedef enum {
- SIGNTEST_1 = 1,
- SIGNTEST_2 = 2
+ SIGNTEST,
+ SIGNTEST_WILCOXON
} signtest_type;
-int dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet, signtest_type n_medians);
+int dialog_sign_test_tool (WBCGtk *wbcg, Sheet *sheet,
+ signtest_type type);
+int dialog_sign_test_two_tool (WBCGtk *wbcg, Sheet *sheet,
+ signtest_type type);
typedef enum {
TTEST_PAIRED = 1,
diff --git a/src/dialogs/sign-test-two.glade b/src/dialogs/sign-test-two.glade
index 6587c79..cdee5f3 100644
--- a/src/dialogs/sign-test-two.glade
+++ b/src/dialogs/sign-test-two.glade
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 2.6 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkDialog" id="Sign-Test">
- <property name="title" translatable="yes">Testing the Difference of 2 Means</property>
+ <property name="title" translatable="yes">Comparing 2 Medians (Paired Sample)</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@@ -94,7 +94,7 @@
<widget class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">12</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -111,6 +111,8 @@
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
@@ -123,12 +125,13 @@
<property name="justify">right</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
+
<child>
<widget class="GtkEntry" id="median-entry">
<property name="visible">True</property>
@@ -139,6 +142,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
@@ -156,9 +161,46 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="signtest">
+ <property name="label" translatable="yes">Sign Test</property>
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="signedranktest">
+ <property name="label" translatable="yes">Wilcoxon Signed Rank Test</property>
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">signtest</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options">GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
</widget>
diff --git a/src/dialogs/sign-test.glade b/src/dialogs/sign-test.glade
index 917f766..596b3bb 100644
--- a/src/dialogs/sign-test.glade
+++ b/src/dialogs/sign-test.glade
@@ -4,7 +4,7 @@
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkDialog" id="Sign-Test">
<property name="border_width">5</property>
- <property name="title" translatable="yes">Sign Test</property>
+ <property name="title" translatable="yes">Testing 1 Median</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@@ -176,6 +176,43 @@
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="signtest">
+ <property name="label" translatable="yes">Sign Test</property>
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="signedranktest">
+ <property name="label" translatable="yes">Wilcoxon Signed Rank Test</property>
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">signtest</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
@@ -186,8 +223,8 @@
<property name="mnemonic_widget">alpha-entry</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -205,8 +242,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
@@ -220,6 +257,8 @@
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
<child>
@@ -233,6 +272,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 952f9e1..c7a4963 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,13 @@
+2010-05-31 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * analysis-signed-rank-test.[ch]: new
+ * Makefile.am: add the above
+ * analysis-tools.h (analysis_tool_get_function): new
+ * analysis-tools.c (analysis_tool_get_function): new
+ * analysis-sign-test.h: minor formatting
+ * analysis-sign-test.c
+ (analysis_tool_sign_test_two_engine_run): fix statistic
+
2010-05-30 Morten Welinder <terra gnome org>
* Release 1.10.5
diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
index 2bbc09b..2c115f8 100644
--- a/src/tools/Makefile.am
+++ b/src/tools/Makefile.am
@@ -35,6 +35,8 @@ libtools_la_SOURCES = \
analysis-principal-components.h \
analysis-sign-test.c \
analysis-sign-test.h \
+ analysis-signed-rank-test.c \
+ analysis-signed-rank-test.h \
analysis-tools.c \
analysis-tools.h \
analysis-wilcoxon-mann-whitney.c \
diff --git a/src/tools/analysis-sign-test.c b/src/tools/analysis-sign-test.c
index 2fca6da..195646a 100644
--- a/src/tools/analysis-sign-test.c
+++ b/src/tools/analysis-sign-test.c
@@ -312,7 +312,14 @@ analysis_tool_sign_test_two_engine_run (data_analysis_output_t *dao,
expr = gnm_expr_new_funcall4 (fd_binomdist, make_cellref (0,-3), make_cellref (0,-2),
gnm_expr_new_constant (value_new_float (0.5)),
gnm_expr_new_constant (value_new_bool (TRUE)));
- dao_set_cell_array_expr (dao, 1, 6, expr);
+ dao_set_cell_array_expr (dao, 1, 6,
+ gnm_expr_new_funcall2
+ (fd_min,
+ gnm_expr_copy (expr),
+ gnm_expr_new_binary
+ (gnm_expr_new_constant (value_new_int (1)),
+ GNM_EXPR_OP_SUB,
+ expr)));
expr = gnm_expr_new_binary (gnm_expr_new_constant (value_new_int (2)),
GNM_EXPR_OP_MULT, make_cellref (0,-1));
diff --git a/src/tools/analysis-sign-test.h b/src/tools/analysis-sign-test.h
index c9e4e67..c032dc8 100644
--- a/src/tools/analysis-sign-test.h
+++ b/src/tools/analysis-sign-test.h
@@ -36,8 +36,8 @@
typedef struct {
analysis_tools_data_generic_t base;
- gnm_float median;
- gnm_float alpha;
+ gnm_float median;
+ gnm_float alpha;
} analysis_tools_data_sign_test_t;
typedef struct {
diff --git a/src/tools/analysis-signed-rank-test.c b/src/tools/analysis-signed-rank-test.c
new file mode 100644
index 0000000..30bb3c1
--- /dev/null
+++ b/src/tools/analysis-signed-rank-test.c
@@ -0,0 +1,591 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * analysis-signed-rank-test.c:
+ *
+ * Author:
+ * Andreas J. Guelzow <aguelzow pyrshep ca>
+ *
+ * (C) Copyright 2010 by Andreas J. Guelzow <aguelzow pyrshep ca>
+ *
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gnumeric-config.h>
+#include <glib/gi18n-lib.h>
+#include "gnumeric.h"
+#include "analysis-signed-rank-test.h"
+#include "analysis-tools.h"
+#include "value.h"
+#include "ranges.h"
+#include "expr.h"
+#include "func.h"
+#include "numbers.h"
+
+static inline GnmExpr const *
+make_int (int n)
+{
+ return gnm_expr_new_constant (value_new_int (n));
+}
+static inline GnmExpr const *
+make_float (gnm_float x)
+{
+ return gnm_expr_new_constant (value_new_float (x));
+}
+
+
+
+static gboolean
+analysis_tool_signed_rank_test_engine_run (data_analysis_output_t *dao,
+ analysis_tools_data_sign_test_t *info)
+{
+ guint col;
+ GSList *data = info->base.input;
+ gboolean first = TRUE;
+
+ GnmExpr const *expr;
+ GnmExpr const *expr_isnumber;
+ GnmExpr const *expr_diff;
+ GnmExpr const *expr_expect;
+ GnmExpr const *expr_var;
+ GnmExpr const *expr_abs;
+ GnmExpr const *expr_big;
+
+ GnmFunc *fd_median = analysis_tool_get_function ("MEDIAN", dao);
+ GnmFunc *fd_if = analysis_tool_get_function ("IF", dao);
+ GnmFunc *fd_sum = analysis_tool_get_function ("SUM", dao);
+ GnmFunc *fd_min = analysis_tool_get_function ("MIN", dao);
+ GnmFunc *fd_normdist = analysis_tool_get_function ("NORMDIST", dao);
+ GnmFunc *fd_isnumber = analysis_tool_get_function ("ISNUMBER", dao);
+ GnmFunc *fd_iferror = analysis_tool_get_function ("IFERROR", dao);
+ GnmFunc *fd_rank = analysis_tool_get_function ("RANK.AVG", dao);
+ GnmFunc *fd_abs = analysis_tool_get_function ("ABS", dao);
+ GnmFunc *fd_sqrt = analysis_tool_get_function ("SQRT", dao);
+ GnmFunc *fd_max = analysis_tool_get_function ("MAX", dao);
+
+ dao_set_italic (dao, 0, 0, 0, 9);
+ set_cell_text_col (dao, 0, 0, _("/Wilcoxon Signed Rank Test"
+ "/Median:"
+ "/Predicted Median:"
+ "/N:"
+ "/S\xe2\x88\x92:"
+ "/S+:"
+ "/Test Statistic:"
+ "/\xce\xb1:"
+ "/P(T\xe2\x89\xa4t) one-tailed:"
+ "/P(T\xe2\x89\xa4t) two-tailed:"));
+
+ for (col = 0; data != NULL; data = data->next, col++) {
+ GnmValue *val_org = value_dup (data->data);
+ GnmExpr const *expr_org;
+
+ /* Note that analysis_tools_write_label may modify val_org */
+ dao_set_italic (dao, col + 1, 0, col+1, 0);
+ analysis_tools_write_label (val_org, dao, &info->base, col + 1, 0, col + 1);
+ expr_org = gnm_expr_new_constant (val_org);
+
+ if (first) {
+ dao_set_cell_float (dao, col + 1, 2, info->median);
+ dao_set_cell_float (dao, col + 1, 7, info->alpha);
+ first = FALSE;
+ } else {
+ dao_set_cell_expr (dao, col + 1, 2, make_cellref (-1,0));
+ dao_set_cell_expr (dao, col + 1, 7, make_cellref (-1,0));
+ }
+
+ expr_isnumber = gnm_expr_new_funcall3
+ (fd_if, gnm_expr_new_funcall1
+ (fd_isnumber, gnm_expr_copy (expr_org)),
+ make_int (1),
+ make_int (0));
+
+ expr = gnm_expr_new_funcall1
+ (fd_median,
+ gnm_expr_copy (expr_org));
+ dao_set_cell_expr (dao, col + 1, 1, expr);
+
+ expr_diff = gnm_expr_new_binary
+ (gnm_expr_copy (expr_org), GNM_EXPR_OP_SUB, make_cellref (0,-2));
+ expr_abs = gnm_expr_new_funcall1
+ (fd_abs, gnm_expr_copy (expr_diff));
+ expr_big = gnm_expr_new_binary
+ (gnm_expr_new_funcall1
+ (fd_max, gnm_expr_copy (expr_abs)),
+ GNM_EXPR_OP_ADD,
+ make_int (1));
+ expr = gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_funcall1
+ (fd_isnumber, gnm_expr_copy (expr_org)),
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_org),
+ GNM_EXPR_OP_EQUAL,
+ make_cellref (0,-2)),
+ gnm_expr_copy (expr_big),
+ expr_abs),
+ expr_big);
+ expr = gnm_expr_new_funcall3
+ (fd_rank,
+ gnm_expr_new_unary (GNM_EXPR_OP_UNARY_NEG,
+ expr_diff),
+ expr,
+ make_int (1));
+
+ dao_set_cell_array_expr
+ (dao, col + 1, 4,
+ gnm_expr_new_funcall1
+ (fd_sum,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_isnumber),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_org),
+ GNM_EXPR_OP_LT,
+ make_cellref (0,-2)),
+ expr,
+ make_int (0)))));
+
+ expr = gnm_expr_new_funcall1
+ (fd_sum, gnm_expr_new_binary
+ (expr_isnumber, GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall2
+ (fd_iferror, gnm_expr_new_funcall3
+ (fd_if, gnm_expr_new_binary (expr_org,
+ GNM_EXPR_OP_NOT_EQUAL, make_cellref (0,-1)),
+ make_int (1),
+ make_int (0)),
+ make_int (0))));
+ dao_set_cell_array_expr (dao, col + 1, 3, expr);
+
+ dao_set_cell_expr (dao, col + 1, 5,
+ gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (make_cellref (0,-2),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_binary
+ (make_cellref (0,-2),
+ GNM_EXPR_OP_ADD,
+ make_int (1))),
+ GNM_EXPR_OP_DIV,
+ make_int (2)),
+ GNM_EXPR_OP_SUB,
+ make_cellref (0,-1)));
+ dao_set_cell_expr (dao, col + 1, 6,
+ gnm_expr_new_funcall2
+ (fd_min, make_cellref (0,-1), make_cellref (0,-2)));
+
+ expr_expect = gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (make_cellref (0,-5),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_binary
+ (make_cellref (0,-5),
+ GNM_EXPR_OP_ADD,
+ make_int (1))),
+ GNM_EXPR_OP_DIV,
+ make_int (4));
+ expr_var = gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (gnm_expr_copy (expr_expect),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (make_int (2),
+ GNM_EXPR_OP_MULT,
+ make_cellref (0,-5)),
+ GNM_EXPR_OP_ADD,
+ make_int (1))),
+ GNM_EXPR_OP_DIV,
+ make_int (6));
+ expr = gnm_expr_new_funcall4
+ (fd_normdist, gnm_expr_new_binary
+ (make_cellref (0,-2),
+ GNM_EXPR_OP_ADD,
+ make_float (0.5)),
+ expr_expect,
+ gnm_expr_new_funcall1 (fd_sqrt, expr_var),
+ gnm_expr_new_constant (value_new_bool (TRUE)));
+ dao_set_cell_expr (dao, col + 1, 8,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (make_cellref (0,-5),
+ GNM_EXPR_OP_LT,
+ make_int (12)),
+ gnm_expr_new_constant (value_new_error_NA (NULL)),
+ expr));
+ dao_set_cell_comment (dao, col + 1, 8,
+ _("This p-value is calculated by a normal approximation.\n"
+ "It is only valid if the sample size is at least 12."));
+
+ expr = gnm_expr_new_binary (make_int (2),
+ GNM_EXPR_OP_MULT, make_cellref (0,-1));
+ dao_set_cell_expr (dao, col + 1, 9, expr);
+ }
+
+ gnm_func_unref (fd_median);
+ gnm_func_unref (fd_if);
+ gnm_func_unref (fd_min);
+ gnm_func_unref (fd_sum);
+ gnm_func_unref (fd_normdist);
+ gnm_func_unref (fd_isnumber);
+ gnm_func_unref (fd_iferror);
+ gnm_func_unref (fd_rank);
+ gnm_func_unref (fd_abs);
+ gnm_func_unref (fd_sqrt);
+ gnm_func_unref (fd_max);
+
+ dao_redraw_respan (dao);
+
+ return FALSE;
+}
+
+static gboolean
+analysis_tool_signed_rank_test_two_engine_run (data_analysis_output_t *dao,
+ analysis_tools_data_sign_test_two_t *info)
+{
+ GnmValue *val_1;
+ GnmValue *val_2;
+
+ GnmExpr const *expr_1;
+ GnmExpr const *expr_2;
+
+ GnmExpr const *expr;
+ GnmExpr const *expr_diff;
+ GnmExpr const *expr_diff_pred;
+ GnmExpr const *expr_isnumber_1;
+ GnmExpr const *expr_isnumber_2;
+ GnmExpr const *expr_isnumber;
+ GnmExpr const *expr_expect;
+ GnmExpr const *expr_var;
+ GnmExpr const *expr_abs;
+ GnmExpr const *expr_big;
+
+ GnmFunc *fd_median = analysis_tool_get_function ("MEDIAN", dao);
+ GnmFunc *fd_if = analysis_tool_get_function ("IF", dao);
+ GnmFunc *fd_sum = analysis_tool_get_function ("SUM", dao);
+ GnmFunc *fd_min = analysis_tool_get_function ("MIN", dao);
+ GnmFunc *fd_normdist = analysis_tool_get_function ("NORMDIST", dao);
+ GnmFunc *fd_isnumber = analysis_tool_get_function ("ISNUMBER", dao);
+ GnmFunc *fd_iferror = analysis_tool_get_function ("IFERROR", dao);
+ GnmFunc *fd_rank = analysis_tool_get_function ("RANK.AVG", dao);
+ GnmFunc *fd_abs = analysis_tool_get_function ("ABS", dao);
+ GnmFunc *fd_sqrt = analysis_tool_get_function ("SQRT", dao);
+ GnmFunc *fd_max = analysis_tool_get_function ("MAX", dao);
+
+ dao_set_italic (dao, 0, 0, 0, 10);
+ set_cell_text_col (dao, 0, 0, _("/Wilcoxon Signed Rank Test"
+ "/Median:"
+ "/Observed Median Difference:"
+ "/Predicted Median Difference:"
+ "/N:"
+ "/S\xe2\x88\x92:"
+ "/S+:"
+ "/Test Statistic:"
+ "/\xce\xb1:"
+ "/P(T\xe2\x89\xa4t) one-tailed:"
+ "/P(T\xe2\x89\xa4t) two-tailed:"));
+ val_1 = value_dup (info->base.range_1);
+ val_2 = value_dup (info->base.range_2);
+
+ /* Labels */
+ dao_set_italic (dao, 1, 0, 2, 0);
+ analysis_tools_write_label_ftest (val_1, dao, 1, 0,
+ info->base.labels, 1);
+ analysis_tools_write_label_ftest (val_2, dao, 2, 0,
+ info->base.labels, 2);
+
+ expr_1 = gnm_expr_new_constant (value_dup (val_1));
+ expr_2 = gnm_expr_new_constant (value_dup (val_2));
+
+ dao_set_cell_float (dao, 1, 3, info->median);
+ dao_set_cell_float (dao, 1, 8, info->base.alpha);
+
+ expr_isnumber_1 = gnm_expr_new_funcall3
+ (fd_if, gnm_expr_new_funcall1
+ (fd_isnumber, gnm_expr_copy (expr_1)),
+ make_int (1),
+ make_int (0));
+ expr_isnumber_2 = gnm_expr_new_funcall3
+ (fd_if, gnm_expr_new_funcall1
+ (fd_isnumber, gnm_expr_copy (expr_2)),
+ make_int (1),
+ make_int (0));
+ expr_isnumber = gnm_expr_new_binary
+ (expr_isnumber_1,
+ GNM_EXPR_OP_MULT,
+ expr_isnumber_2);
+
+ expr = gnm_expr_new_funcall1
+ (fd_median,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_isnumber),
+ GNM_EXPR_OP_EQUAL,
+ make_int (1)),
+ gnm_expr_copy (expr_1),
+ gnm_expr_new_constant (value_new_string(""))));
+ dao_set_cell_array_expr (dao, 1, 1, expr);
+
+ expr = gnm_expr_new_funcall1
+ (fd_median,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_isnumber),
+ GNM_EXPR_OP_EQUAL,
+ make_int (1)),
+ gnm_expr_copy (expr_2),
+ gnm_expr_new_constant (value_new_string(""))));
+ dao_set_cell_array_expr (dao, 2, 1, expr);
+
+ expr_diff = gnm_expr_new_binary (gnm_expr_copy (expr_1),
+ GNM_EXPR_OP_SUB,
+ gnm_expr_copy (expr_2));
+ dao_set_cell_array_expr
+ (dao, 1, 2,
+ gnm_expr_new_funcall1
+ (fd_median,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_isnumber),
+ GNM_EXPR_OP_EQUAL,
+ make_int (1)),
+ gnm_expr_copy (expr_diff),
+ gnm_expr_new_constant (value_new_string("")))));
+
+ expr = gnm_expr_new_funcall1
+ (fd_sum, gnm_expr_new_binary
+ (gnm_expr_copy (expr_isnumber),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall2
+ (fd_iferror, gnm_expr_new_funcall3
+ (fd_if, gnm_expr_new_binary
+ (gnm_expr_copy (expr_diff),
+ GNM_EXPR_OP_NOT_EQUAL, make_cellref (0,-2)),
+ make_int (1),
+ make_int (0)),
+ make_int (0))));
+ dao_set_cell_array_expr (dao, 1, 4, expr);
+
+ expr_diff_pred = gnm_expr_new_binary
+ (gnm_expr_copy (expr_diff),
+ GNM_EXPR_OP_SUB,
+ make_cellref (0,-2));
+ expr_abs = gnm_expr_new_funcall1
+ (fd_abs, gnm_expr_copy (expr_diff_pred));
+ expr_big = gnm_expr_new_binary
+ (gnm_expr_new_funcall1
+ (fd_max, gnm_expr_copy (expr_abs)),
+ GNM_EXPR_OP_ADD,
+ make_int (1));
+ expr = gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_funcall1
+ (fd_isnumber, expr_1),
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_funcall1
+ (fd_isnumber, expr_2),
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (gnm_expr_copy (expr_diff),
+ GNM_EXPR_OP_EQUAL,
+ make_cellref (0,-2)),
+ gnm_expr_copy (expr_big),
+ expr_abs),
+ gnm_expr_copy (expr_big)),
+ expr_big);
+ expr = gnm_expr_new_funcall3
+ (fd_rank,
+ gnm_expr_new_unary (GNM_EXPR_OP_UNARY_NEG,
+ expr_diff_pred),
+ expr,
+ make_int (1));
+ expr = gnm_expr_new_funcall1
+ (fd_sum,
+ gnm_expr_new_binary
+ (expr_isnumber,
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (expr_diff,
+ GNM_EXPR_OP_LT,
+ make_cellref (0,-2)),
+ expr,
+ make_int (0))));
+
+ dao_set_cell_array_expr (dao, 1, 5, expr);
+
+ dao_set_cell_expr (dao, 1, 6,
+ gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (make_cellref (0,-2),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_binary
+ (make_cellref (0,-2),
+ GNM_EXPR_OP_ADD,
+ make_int (1))),
+ GNM_EXPR_OP_DIV,
+ make_int (2)),
+ GNM_EXPR_OP_SUB,
+ make_cellref (0,-1)));
+
+ dao_set_cell_expr
+ (dao, 1, 7,
+ gnm_expr_new_funcall2
+ (fd_min, make_cellref (0,-1), make_cellref (0,-2)));
+
+ expr_expect = gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (make_cellref (0,-5),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_binary
+ (make_cellref (0,-5),
+ GNM_EXPR_OP_ADD,
+ make_int (1))),
+ GNM_EXPR_OP_DIV,
+ make_int (4));
+ expr_var = gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (gnm_expr_copy (expr_expect),
+ GNM_EXPR_OP_MULT,
+ gnm_expr_new_binary
+ (gnm_expr_new_binary
+ (make_int (2),
+ GNM_EXPR_OP_MULT,
+ make_cellref (0,-5)),
+ GNM_EXPR_OP_ADD,
+ make_int (1))),
+ GNM_EXPR_OP_DIV,
+ make_int (6));
+ expr = gnm_expr_new_funcall4
+ (fd_normdist, gnm_expr_new_binary
+ (make_cellref (0,-2),
+ GNM_EXPR_OP_ADD,
+ make_float (0.5)),
+ expr_expect,
+ gnm_expr_new_funcall1 (fd_sqrt, expr_var),
+ gnm_expr_new_constant (value_new_bool (TRUE)));
+ dao_set_cell_expr (dao, 1, 9,
+ gnm_expr_new_funcall3
+ (fd_if,
+ gnm_expr_new_binary
+ (make_cellref (0,-5),
+ GNM_EXPR_OP_LT,
+ make_int (12)),
+ gnm_expr_new_constant (value_new_error_NA (NULL)),
+ expr));
+ dao_set_cell_comment
+ (dao, 1, 9,
+ _("This p-value is calculated by a normal approximation.\n"
+ "It is only valid if the sample size is at least 12."));
+
+ expr = gnm_expr_new_binary (make_int (2),
+ GNM_EXPR_OP_MULT, make_cellref (0,-1));
+ dao_set_cell_array_expr (dao, 1, 10, expr);
+
+ gnm_func_unref (fd_median);
+ gnm_func_unref (fd_if);
+ gnm_func_unref (fd_min);
+ gnm_func_unref (fd_sum);
+ gnm_func_unref (fd_normdist);
+ gnm_func_unref (fd_isnumber);
+ gnm_func_unref (fd_iferror);
+ gnm_func_unref (fd_rank);
+ gnm_func_unref (fd_abs);
+ gnm_func_unref (fd_sqrt);
+ gnm_func_unref (fd_max);
+
+ value_release (val_1);
+ value_release (val_2);
+
+ dao_redraw_respan (dao);
+
+ return FALSE;
+}
+
+gboolean
+analysis_tool_signed_rank_test_engine (data_analysis_output_t *dao, gpointer specs,
+ analysis_tool_engine_t selector, gpointer result)
+{
+ analysis_tools_data_sign_test_t *info = specs;
+
+ switch (selector) {
+ case TOOL_ENGINE_UPDATE_DESCRIPTOR:
+ return (dao_command_descriptor
+ (dao, _("Wilcoxon Signed Rank Test (%s)"), result)
+ == NULL);
+ case TOOL_ENGINE_UPDATE_DAO:
+ prepare_input_range (&info->base.input, info->base.group_by);
+ dao_adjust (dao, 1 + g_slist_length (info->base.input), 10);
+ return FALSE;
+ case TOOL_ENGINE_CLEAN_UP:
+ return analysis_tool_generic_clean (specs);
+ case TOOL_ENGINE_LAST_VALIDITY_CHECK:
+ return FALSE;
+ case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
+ dao_prepare_output (NULL, dao, _("Wilcoxon Signed Rank Test"));
+ return FALSE;
+ case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
+ return dao_format_output (dao, _("Wilcoxon Signed Rank Test"));
+ case TOOL_ENGINE_PERFORM_CALC:
+ default:
+ return analysis_tool_signed_rank_test_engine_run (dao, specs);
+ }
+ return TRUE;
+}
+
+gboolean
+analysis_tool_signed_rank_test_two_engine (data_analysis_output_t *dao, gpointer specs,
+ analysis_tool_engine_t selector, gpointer result)
+{
+ switch (selector) {
+ case TOOL_ENGINE_UPDATE_DESCRIPTOR:
+ return (dao_command_descriptor
+ (dao, _("Wilcoxon Signed Rank Test (%s)"), result)
+ == NULL);
+ case TOOL_ENGINE_UPDATE_DAO:
+ dao_adjust (dao, 3, 11);
+ return FALSE;
+ case TOOL_ENGINE_CLEAN_UP:
+ return analysis_tool_generic_b_clean (specs);
+ case TOOL_ENGINE_LAST_VALIDITY_CHECK:
+ return FALSE;
+ case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
+ dao_prepare_output (NULL, dao, _("Wilcoxon Signed Rank Test"));
+ return FALSE;
+ case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
+ return dao_format_output (dao, _("Wilcoxon Signed Rank Test"));
+ case TOOL_ENGINE_PERFORM_CALC:
+ default:
+ return analysis_tool_signed_rank_test_two_engine_run (dao, specs);
+ }
+ return TRUE; /* We shouldn't get here */
+}
+
+
+
+
diff --git a/src/tools/analysis-signed-rank-test.h b/src/tools/analysis-signed-rank-test.h
new file mode 100644
index 0000000..717c7b4
--- /dev/null
+++ b/src/tools/analysis-signed-rank-test.h
@@ -0,0 +1,52 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * analysis-signed-rank-test.h:
+ *
+ * Author:
+ * Andreas J. Guelzow <aguelzow pyrshep ca>
+ *
+ * (C) Copyright 2010 by Andreas J. Guelzow <aguelzow pyrshep ca>
+ *
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#ifndef ANALYSIS_SIGNED_RANK_TEST_H
+#define ANALYSIS_SIGNED_RANK_TEST_H
+
+#include "gnumeric.h"
+#include "numbers.h"
+#include "dao.h"
+#include "tools.h"
+#include "analysis-tools.h"
+#include "analysis-sign-test.h"
+#include "sheet.h"
+
+/* note: specs is a pointer to a analysis_tools_data_sign_test_t */
+
+gboolean analysis_tool_signed_rank_test_engine (data_analysis_output_t *dao,
+ gpointer specs,
+ analysis_tool_engine_t selector,
+ gpointer result);
+
+/* note: specs is a pointer to a analysis_tools_data_sign_test_two_t */
+
+gboolean analysis_tool_signed_rank_test_two_engine (data_analysis_output_t *dao,
+ gpointer specs,
+ analysis_tool_engine_t selector,
+ gpointer result);
+
+#endif
diff --git a/src/tools/analysis-tools.c b/src/tools/analysis-tools.c
index 0c22a5d..0b0d7fd 100644
--- a/src/tools/analysis-tools.c
+++ b/src/tools/analysis-tools.c
@@ -574,6 +574,18 @@ int analysis_tool_calc_length (analysis_tools_data_generic_t *info)
return result;
}
+GnmFunc *
+analysis_tool_get_function (char const *name,
+ data_analysis_output_t *dao)
+{
+ GnmFunc *fd;
+
+ fd = gnm_func_lookup_or_add_placeholder
+ (name, dao->sheet ? dao->sheet->workbook : NULL, FALSE);
+ gnm_func_ref (fd);
+ return fd;
+}
+
/************* Correlation Tool *******************************************
diff --git a/src/tools/analysis-tools.h b/src/tools/analysis-tools.h
index b21af92..bab0fa6 100644
--- a/src/tools/analysis-tools.h
+++ b/src/tools/analysis-tools.h
@@ -7,6 +7,7 @@
#include "tools.h"
#include "regression.h"
#include "complex.h"
+#include "func.h"
/*******************************************************************/
@@ -259,4 +260,7 @@ void set_cell_text_row (data_analysis_output_t *dao,
void set_cell_text_col (data_analysis_output_t *dao,
int col, int row, const char *text);
+GnmFunc *analysis_tool_get_function (char const *name,
+ data_analysis_output_t *dao);
+
#endif
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index c3840d0..11125b7 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -889,8 +889,10 @@ static GNM_ACTION_DEF (cb_tools_principal_components) { dialog_principal_compone
static GNM_ACTION_DEF (cb_tools_ranking) { dialog_ranking_tool (wbcg, wbcg_cur_sheet (wbcg)); }
static GNM_ACTION_DEF (cb_tools_regression) { dialog_regression_tool (wbcg, wbcg_cur_sheet (wbcg)); }
static GNM_ACTION_DEF (cb_tools_sampling) { dialog_sampling_tool (wbcg, wbcg_cur_sheet (wbcg)); }
-static GNM_ACTION_DEF (cb_tools_sign_test_one_median) { dialog_sign_test_tool (wbcg, wbcg_cur_sheet (wbcg), SIGNTEST_1); }
-static GNM_ACTION_DEF (cb_tools_sign_test_two_medians) { dialog_sign_test_tool (wbcg, wbcg_cur_sheet (wbcg), SIGNTEST_2); }
+static GNM_ACTION_DEF (cb_tools_sign_test_one_median) { dialog_sign_test_tool (wbcg, wbcg_cur_sheet (wbcg), SIGNTEST); }
+static GNM_ACTION_DEF (cb_tools_sign_test_two_medians) { dialog_sign_test_two_tool (wbcg, wbcg_cur_sheet (wbcg), SIGNTEST); }
+static GNM_ACTION_DEF (cb_tools_wilcoxon_signed_rank_one_median) { dialog_sign_test_tool (wbcg, wbcg_cur_sheet (wbcg), SIGNTEST_WILCOXON); }
+static GNM_ACTION_DEF (cb_tools_wilcoxon_signed_rank_two_medians) { dialog_sign_test_two_tool (wbcg, wbcg_cur_sheet (wbcg), SIGNTEST_WILCOXON); }
static GNM_ACTION_DEF (cb_tools_wilcoxon_mann_whitney) { dialog_wilcoxon_m_w_tool (wbcg, wbcg_cur_sheet (wbcg)); }
static GNM_ACTION_DEF (cb_tools_ttest_paired) { dialog_ttest_tool (wbcg, wbcg_cur_sheet (wbcg), TTEST_PAIRED); }
static GNM_ACTION_DEF (cb_tools_ttest_equal_var) { dialog_ttest_tool (wbcg, wbcg_cur_sheet (wbcg), TTEST_UNPAIRED_EQUALVARIANCES); }
@@ -1736,13 +1738,19 @@ static GtkActionEntry const permanent_actions[] = {
{ "MenuFormatSheet", NULL, N_("_Sheet") },
{ "MenuTools", NULL, N_("_Tools") },
{ "MenuToolsScenarios", NULL, N_("Sce_narios") },
- { "MenuToolStatisticalAnalysis", NULL, N_("Statistical Anal_ysis") },
- { "MenuANOVA", NULL, N_("_ANOVA") },
- { "MenuContingencyTests", NULL, N_("Contin_gency Table") },
- { "MenuToolForecast", NULL, N_("F_orecast") },
- { "MenuToolFrequencies", NULL, N_("Fre_quency Tables") },
- { "MenuToolTwoMedians", NULL, N_("Two _Medians") },
- { "MenuToolTTest", NULL, N_("Two _Means") },
+ { "MenuStatistics", NULL, N_("_Statistics") },
+ { "MenuStatisticsDescriptive", NULL, N_("_Descriptive Statistics") },
+ { "MenuToolFrequencies", NULL, N_("Fre_quency Tables") },
+ { "MenuStatisticsTimeSeries", NULL, N_("De_pendent Observations") },
+ { "MenuToolForecast", NULL, N_("F_orecast") },
+ { "MenuStatisticsOneSample", NULL, N_("_One Sample Tests") },
+ { "MenuToolOneMedian", NULL, N_("_One Median") },
+ { "MenuStatisticsTwoSamples", NULL, N_("_Two Sample Tests") },
+ { "MenuToolTwoMedians", NULL, N_("Two Me_dians") },
+ { "MenuToolTTest", NULL, N_("Two _Means") },
+ { "MenuStatisticsMultipleSamples", NULL, N_("_Multiple Sample Tests") },
+ { "MenuANOVA", NULL, N_("_ANOVA") },
+ { "MenuContingencyTests", NULL, N_("Contin_gency Table") },
{ "MenuData", NULL, N_("_Data") },
{ "MenuFilter", NULL, N_("_Filter") },
{ "MenuEditFill", NULL, N_("F_ill") },
@@ -2121,39 +2129,83 @@ static GtkActionEntry const actions[] = {
NULL, N_("Add a new scenario"),
G_CALLBACK (cb_tools_scenario_add) },
-/* Tools -> ANOVA */
- { "ToolsANOVAoneFactor", NULL, N_("_One Factor..."),
- NULL, N_("One Factor Analysis of Variance..."),
- G_CALLBACK (cb_tools_anova_one_factor) },
- { "ToolsANOVAtwoFactor", NULL, N_("_Two Factor..."),
- NULL, N_("Two Factor Analysis of Variance..."),
- G_CALLBACK (cb_tools_anova_two_factor) },
+/* Statistics */
-/* Tools -> Chi Square Tests */
- { "ToolsHomogeneity", NULL, N_("Test of _Homogeneity..."),
- NULL, N_("Chi Squared Test of Homogeneity..."),
- G_CALLBACK (cb_tools_chi_square_homogeneity) },
- { "ToolsIndependence", NULL, N_("Test of _Independence..."),
- NULL, N_("Chi Squared Test of Independence..."),
- G_CALLBACK (cb_tools_chi_square_independence) },
+ { "ToolsSampling", NULL, N_("_Sampling..."),
+ NULL, N_("Periodic and random samples"),
+ G_CALLBACK (cb_tools_sampling) },
-/* Tools -> Forecasting */
- { "ToolsExpSmoothing", NULL, N_("_Exponential Smoothing..."),
- NULL, N_("Exponential smoothing..."),
- G_CALLBACK (cb_tools_exp_smoothing) },
- { "ToolsAverage", NULL, N_("_Moving Average..."),
- NULL, N_("Moving average..."),
- G_CALLBACK (cb_tools_average) },
+/* Statistics -> Descriptive*/
+
+ { "ToolsCorrelation", NULL, N_("_Correlation..."),
+ NULL, N_("Pearson Correlation"),
+ G_CALLBACK (cb_tools_correlation) },
+ { "ToolsCovariance", NULL, N_("Co_variance..."),
+ NULL, N_("Covariance"),
+ G_CALLBACK (cb_tools_covariance) },
+ { "ToolsDescStatistics", NULL, N_("_Descriptive Statistics..."),
+ NULL, N_("Various summary statistics"),
+ G_CALLBACK (cb_tools_desc_statistics) },
+
+/* Statistics -> Descriptive -> Frequencies */
-/* Tools -> Frequency Tables */
{ "ToolsFrequency", NULL, N_("Fre_quency Tables..."),
NULL, N_("Frequency tables for non-numeric data"),
G_CALLBACK (cb_tools_frequency) },
{ "ToolsHistogram", NULL, N_("_Histogram..."),
NULL, N_("Various frequency tables for numeric data"),
G_CALLBACK (cb_tools_histogram) },
+ { "ToolsRanking", NULL, N_("Ranks And _Percentiles..."),
+ NULL, N_("Ranks, placements and percentiles"),
+ G_CALLBACK (cb_tools_ranking) },
+
+/* Statistics -> DependentObservations */
+
+ { "ToolsFourier", NULL, N_("_Fourier Analysis..."),
+ NULL, N_("Fourier Analysis"),
+ G_CALLBACK (cb_tools_fourier) },
+ { "ToolsPrincipalComponents", NULL,
+ N_("Principal Components Analysis..."),
+ NULL, N_("Principal Components Analysis"),
+ G_CALLBACK (cb_tools_principal_components) },
+/* Statistics -> DependentObservations -> Forecast*/
+
+ { "ToolsExpSmoothing", NULL, N_("_Exponential Smoothing..."),
+ NULL, N_("Exponential smoothing..."),
+ G_CALLBACK (cb_tools_exp_smoothing) },
+ { "ToolsAverage", NULL, N_("_Moving Average..."),
+ NULL, N_("Moving average..."),
+ G_CALLBACK (cb_tools_average) },
+ { "ToolsRegression", NULL, N_("_Regression..."),
+ NULL, N_("Regression Analysis"),
+ G_CALLBACK (cb_tools_regression) },
+ { "ToolsKaplanMeier", NULL, N_("_Kaplan-Meier Estimates..."),
+ NULL, N_("Creation of Kaplan-Meier Survival Curves"),
+ G_CALLBACK (cb_tools_kaplan_meier) },
+
+/* Statistics -> OneSample */
+
+ { "ToolsNormalityTests", NULL, N_("_Normality Tests..."),
+ NULL, N_("Testing a sample for normality"),
+ G_CALLBACK (cb_tools_normality_tests) },
+
+/* Statistics -> OneSample -> OneMedian*/
+
+ { "ToolsOneMedianSignTest", NULL, N_("_Sign Test..."),
+ NULL, N_("Testing the value of a median"),
+ G_CALLBACK (cb_tools_sign_test_one_median) },
+ { "ToolsOneMedianWilcoxonSignedRank", NULL, N_("_Wilcoxon Signed Rank Test..."),
+ NULL, N_("Testing the value of a median"),
+ G_CALLBACK (cb_tools_wilcoxon_signed_rank_one_median) },
+
+/* Statistics -> TwoSamples */
+
+ { "ToolsFTest", NULL, N_("_Two Variances: FTest..."),
+ NULL, N_("Comparing two population variances"),
+ G_CALLBACK (cb_tools_ftest) },
+
+/* Statistics -> TwoSamples -> Two Means*/
-/* Tools -> Analysis -> Two Means */
{ "ToolTTestPaired", NULL, N_("_Paired Samples: T-Test..."),
NULL, N_("Comparing two population means for two paired samples: t-test..."),
G_CALLBACK (cb_tools_ttest_paired) },
@@ -2170,53 +2222,38 @@ static GtkActionEntry const actions[] = {
NULL, N_("Comparing two population means from populations with known variances: z-test..."),
G_CALLBACK (cb_tools_ztest) },
-/* Tools -> Analysis -> Two Medias */
+/* Statistics -> TwoSamples -> Two Medians*/
{ "ToolsTwoMedianSignTest", NULL, N_("_Sign Test..."),
NULL, N_("Comparing the values of two medians of paired observations"),
G_CALLBACK (cb_tools_sign_test_two_medians) },
- { "ToolsTwoMedianWilcoxonMannWhitney", NULL, N_("_Wilcoxon-Mann-Whitney..."),
+ { "ToolsTwoMedianWilcoxonSignedRank", NULL, N_("_Wilcoxon Signed Rank Test..."),
+ NULL, N_("Comparing the values of two medians of paired observations"),
+ G_CALLBACK (cb_tools_wilcoxon_signed_rank_two_medians) },
+ { "ToolsTwoMedianWilcoxonMannWhitney", NULL, N_("_Wilcoxon-Mann-Whitney Test..."),
NULL, N_("Comparing the values of two medians of unpaired observations"),
G_CALLBACK (cb_tools_wilcoxon_mann_whitney) },
-/* Tools -> Analysis */
- { "ToolsCorrelation", NULL, N_("_Correlation..."),
- NULL, N_("Pearson Correlation"),
- G_CALLBACK (cb_tools_correlation) },
- { "ToolsCovariance", NULL, N_("Co_variance..."),
- NULL, N_("Covariance"),
- G_CALLBACK (cb_tools_covariance) },
- { "ToolsDescStatistics", NULL, N_("_Descriptive Statistics..."),
- NULL, N_("Various summary statistics"),
- G_CALLBACK (cb_tools_desc_statistics) },
- { "ToolsFourier", NULL, N_("_Fourier Analysis..."),
- NULL, N_("Fourier Analysis"),
- G_CALLBACK (cb_tools_fourier) },
- { "ToolsPrincipalComponents", NULL,
- N_("Principal Components Analysis..."),
- NULL, N_("Principal Components Analysis"),
- G_CALLBACK (cb_tools_principal_components) },
- { "ToolsRanking", NULL, N_("Ranks And _Percentiles..."),
- NULL, N_("Ranks, placements and percentiles"),
- G_CALLBACK (cb_tools_ranking) },
- { "ToolsRegression", NULL, N_("_Regression..."),
- NULL, N_("Regression Analysis"),
- G_CALLBACK (cb_tools_regression) },
- { "ToolsSampling", NULL, N_("_Sampling..."),
- NULL, N_("Periodic and random samples"),
- G_CALLBACK (cb_tools_sampling) },
- { "ToolsFTest", NULL, N_("_Two Variances: FTest..."),
- NULL, N_("Comparing two population variances"),
- G_CALLBACK (cb_tools_ftest) },
- { "ToolsKaplanMeier", NULL, N_("_Kaplan-Meier Estimates..."),
- NULL, N_("Creation of Kaplan-Meier Survival Curves"),
- G_CALLBACK (cb_tools_kaplan_meier) },
- { "ToolsNormalityTests", NULL, N_("_Normality Tests..."),
- NULL, N_("Testing a sample for normality"),
- G_CALLBACK (cb_tools_normality_tests) },
- { "ToolsOneMedianSignTest", NULL, N_("One M_edian Sign Test..."),
- NULL, N_("Testing the value of a median"),
- G_CALLBACK (cb_tools_sign_test_one_median) },
+/* Statistics -> MultipleSamples */
+
+/* Statistics -> MultipleSamples -> ANOVA*/
+
+ { "ToolsANOVAoneFactor", NULL, N_("_One Factor..."),
+ NULL, N_("One Factor Analysis of Variance..."),
+ G_CALLBACK (cb_tools_anova_one_factor) },
+ { "ToolsANOVAtwoFactor", NULL, N_("_Two Factor..."),
+ NULL, N_("Two Factor Analysis of Variance..."),
+ G_CALLBACK (cb_tools_anova_two_factor) },
+
+/* Statistics -> MultipleSamples -> ContingencyTable*/
+
+ { "ToolsHomogeneity", NULL, N_("Test of _Homogeneity..."),
+ NULL, N_("Chi Squared Test of Homogeneity..."),
+ G_CALLBACK (cb_tools_chi_square_homogeneity) },
+ { "ToolsIndependence", NULL, N_("Test of _Independence..."),
+ NULL, N_("Chi Squared Test of Independence..."),
+ G_CALLBACK (cb_tools_chi_square_independence) },
+
/* Data */
{ "DataSort", GTK_STOCK_SORT_ASCENDING, N_("_Sort..."),
NULL, N_("Sort the selected region"),
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]