[gnumeric] Extend normality tool dialog



commit faf6b160cc5b75e0205618ad93d1c7ea4aa2bd92
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Nov 24 16:23:11 2009 -0700

    Extend normality tool dialog
    
    2009-11-24 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* analysis-normality.h (analysis_tools_data_normality_t):
    	  modify fields
    	* analysis-normality.c (analysis_tool_normality_engine_run):
    	  handle additional tests.
    
    2009-11-24  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* functions.c (help_cvmtest): use proper escapes
    
    2009-11-24  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* normality-tests.glade: add more test seelction buttons
    	* dialog-analysis-tool-normality.c (normality_tool_ok_clicked_cb):
    	  handle additional test selections

 plugins/fn-stat/ChangeLog                    |    4 +
 plugins/fn-stat/functions.c                  |    4 +-
 src/dialogs/ChangeLog                        |    6 ++
 src/dialogs/dialog-analysis-tool-normality.c |   13 +++-
 src/dialogs/normality-tests.glade            |  108 ++++++++++++++++++++++----
 src/tools/ChangeLog                          |    7 ++
 src/tools/analysis-normality.c               |   26 ++++++-
 src/tools/analysis-normality.h               |   10 ++-
 8 files changed, 155 insertions(+), 23 deletions(-)
---
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index dc0a777..57d72db 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -1,4 +1,8 @@
 2009-11-24  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* functions.c (help_cvmtest): use proper escapes
+	
+2009-11-24  Andreas J. Guelzow <aguelzow pyrshep ca>
 	* plugin.xml.in: add CVMTEST, SFTEST, LKSTEST
 	* functions.c (help_cvmtest): new
 	(gnumeric_sftest): new
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index 7b07a8a..d59a1ff 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -5063,9 +5063,9 @@ gnumeric_sftest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 /***************************************************************************/
 
 static GnmFuncHelp const help_cvmtest[] = {
-	{ GNM_FUNC_HELP_NAME, F_("CVMTEST: Cramér-von Mises Test of Normality") },
+	{ GNM_FUNC_HELP_NAME, F_("CVMTEST: Cram\xc3\xa9r-von Mises Test of Normality") },
 	{ GNM_FUNC_HELP_ARG, F_("x:array of sample values") },
-	{ GNM_FUNC_HELP_DESCRIPTION, F_("This function returns an array with the first row giving the p-value of the Cramér-von Mises Test,"
+	{ GNM_FUNC_HELP_DESCRIPTION, F_("This function returns an array with the first row giving the p-value of the Cram\xc3\xa9r-von Mises Test,"
 					" the second row the test statistic of the test, and the third the number of observations in the sample.")},
 	{ GNM_FUNC_HELP_NOTE, F_("If there are less than 8 sample values, CVMTEST returns #VALUE!") },
 	{ GNM_FUNC_HELP_SEEALSO, "CHITEST,ADTEST,LKSTEST,SFTEST" },
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 0e94bd0..4b90f93 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-24  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* normality-tests.glade: add more test seelction buttons
+	* dialog-analysis-tool-normality.c (normality_tool_ok_clicked_cb):
+	  handle additional test selections
+
 2009-11-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* normality-tests.glade: new
diff --git a/src/dialogs/dialog-analysis-tool-normality.c b/src/dialogs/dialog-analysis-tool-normality.c
index 0a9d447..ee7323b 100644
--- a/src/dialogs/dialog-analysis-tool-normality.c
+++ b/src/dialogs/dialog-analysis-tool-normality.c
@@ -69,6 +69,14 @@ static char const * const grouped_by_group[] = {
 	NULL
 };
 
+static char const * const test_group[] = {
+	"andersondarling",
+	"cramervonmises",
+	"lilliefors",
+	"shapirofrancia",
+	NULL
+};
+
 /**
  * normality_tool_update_sensitivity_cb:
  * @dummy:
@@ -149,7 +157,10 @@ normality_tool_ok_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
 	data->alpha = gtk_spin_button_get_value
 		(GTK_SPIN_BUTTON (state->alpha_entry));
 
-	data->type = 'A';
+	data->type = gnumeric_glade_group_value (state->base.gui, test_group);
+
+	w = glade_xml_get_widget (state->base.gui, "normalprobabilityplot");
+	data->graph = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
 
 	if (!cmd_analysis_tool (WORKBOOK_CONTROL (state->base.wbcg), state->base.sheet,
 				dao, data, analysis_tool_normality_engine))
diff --git a/src/dialogs/normality-tests.glade b/src/dialogs/normality-tests.glade
index f02654c..e5bd7b6 100644
--- a/src/dialogs/normality-tests.glade
+++ b/src/dialogs/normality-tests.glade
@@ -1,7 +1,5 @@
 <?xml version="1.0"?>
 <glade-interface>
-  <!-- interface-requires gtk+ 2.6 -->
-  <!-- interface-naming-policy toplevel-contextual -->
   <widget class="GtkDialog" id="Normality-Tests">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Normality Tests</property>
@@ -10,7 +8,6 @@
     <child internal-child="vbox">
       <widget class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
           <widget class="GtkNotebook" id="notebook1">
@@ -21,7 +18,7 @@
               <widget class="GtkTable" id="input-table">
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
-                <property name="n_rows">5</property>
+                <property name="n_rows">6</property>
                 <property name="n_columns">2</property>
                 <property name="column_spacing">12</property>
                 <property name="row_spacing">6</property>
@@ -52,7 +49,7 @@
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
@@ -68,7 +65,7 @@
                     <property name="top_attach">4</property>
                     <property name="bottom_attach">5</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
@@ -99,7 +96,7 @@
                     <property name="right_attach">2</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
-                    <property name="y_options">GTK_FILL</property>
+                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
@@ -118,7 +115,7 @@
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
@@ -137,7 +134,7 @@
                     <property name="top_attach">3</property>
                     <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
@@ -152,6 +149,12 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </widget>
             </child>
             <child>
@@ -171,7 +174,7 @@
                   <widget class="GtkTable" id="table2">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="n_rows">2</property>
+                    <property name="n_rows">7</property>
                     <property name="n_columns">2</property>
                     <property name="column_spacing">12</property>
                     <property name="row_spacing">6</property>
@@ -185,8 +188,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">4</property>
+                        <property name="bottom_attach">5</property>
                         <property name="x_options">GTK_FILL</property>
                         <property name="y_options"></property>
                       </packing>
@@ -204,8 +207,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">4</property>
+                        <property name="bottom_attach">5</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
@@ -213,7 +216,7 @@
                       <widget class="GtkRadioButton" id="andersondarling">
                         <property name="label" translatable="yes">Anderson-Darling Test</property>
                         <property name="visible">True</property>
-                        <property name="sensitive">False</property>
+                        <property name="sensitive">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="active">True</property>
@@ -221,9 +224,82 @@
                       </widget>
                       <packing>
                         <property name="right_attach">2</property>
-                        <property name="y_options">GTK_FILL</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
                       </packing>
                     </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="cramervonmises">
+                        <property name="label" translatable="yes">Cram&#xE9;r-von Mises Test</property>
+                        <property name="visible">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">andersondarling</property>
+                      </widget>
+                      <packing>
+                        <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="GtkRadioButton" id="lilliefors">
+                        <property name="label" translatable="yes">Lilliefors (Kolmogorov-Smirnov) Test</property>
+                        <property name="visible">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">andersondarling</property>
+                      </widget>
+                      <packing>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="shapirofrancia">
+                        <property name="label" translatable="yes">Shapiro-Francia Test</property>
+                        <property name="visible">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">andersondarling</property>
+                      </widget>
+                      <packing>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkCheckButton" id="normalprobabilityplot">
+                        <property name="label" translatable="yes">Create Normal Probability Plot</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="sensitive">False</property>
+                      </widget>
+                      <packing>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
+                        <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                   <packing>
                     <property name="position">0</property>
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 600c755..8b5c792 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* analysis-normality.h (analysis_tools_data_normality_t):
+	  modify fields
+	* analysis-normality.c (analysis_tool_normality_engine_run):
+	  handle additional tests.
+	
 2009-11-24  Morten Welinder  <terra gnome org>
 
 	* scenarios.c (scenarios_insert_rows, scenarios_insert_cols,
diff --git a/src/tools/analysis-normality.c b/src/tools/analysis-normality.c
index bcc03ae..5982f3c 100644
--- a/src/tools/analysis-normality.c
+++ b/src/tools/analysis-normality.c
@@ -54,13 +54,33 @@ analysis_tool_normality_engine_run (data_analysis_output_t *dao,
 	char const *n_comment;
 
 	switch (info->type) {
-	case 'a':
-	default:
+	case normality_test_type_andersondarling:
 		fdname = "ADTEST";
 		testname = N_("Anderson-Darling Test");
 		n_comment = N_("For the Anderson-Darling Test\n"
-			       "the size the sample must be at\n"
+			       "the sample size must be at\n"
+			       "least 8.");
+		break;
+	case normality_test_type_cramervonmises:
+		fdname = "CVMTEST";
+		testname = N_("Cram\xc3\xa9r-von Mises Test");
+		n_comment = N_("For the Cram\xc3\xa9r-von Mises Test\n"
+			       "the sample size must be at\n"
 			       "least 8.");
+		break;
+	case normality_test_type_lilliefors:
+		fdname = "LKSTEST";
+		testname = N_("Lilliefors (Kolmogorov-Smirnov) Test");
+		n_comment = N_("For the Lilliefors (Kolmogorov-Smirnov) Test\n"
+			       "the sample size must be at least 5.");
+		break;
+	case normality_test_type_shapirofrancia:
+		fdname = "SFTEST";
+		testname = N_("Shapiro-Francia Test");
+		n_comment = N_("For the Shapiro-Francia Test\n"
+			       "the sample size must be at\n"
+			       "least 5 and at most 5000.");
+		break;		
 	}
 
 	fd = gnm_func_lookup_or_add_placeholder 
diff --git a/src/tools/analysis-normality.h b/src/tools/analysis-normality.h
index fdc3e78..67e09f2 100644
--- a/src/tools/analysis-normality.h
+++ b/src/tools/analysis-normality.h
@@ -35,10 +35,18 @@
 
 /****************  Normality  Tests ***************/
 
+typedef enum {
+	normality_test_type_andersondarling = 0,
+	normality_test_type_cramervonmises,
+	normality_test_type_lilliefors,
+	normality_test_type_shapirofrancia
+} normality_test_type_t;
+
 typedef struct {
 	analysis_tools_data_generic_t base;
 	gnm_float alpha;
-	char type; /* 'A'= Anderson-Darling */
+	normality_test_type_t type;
+	gboolean graph;
 } analysis_tools_data_normality_t;
 
 gboolean analysis_tool_normality_engine (data_analysis_output_t *dao, gpointer specs,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]