Amalgamated t-test.h and oneway.h into a single group_proc.h file
[pspp-builds.git] / src / group.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 2004 Free Software Foundation, Inc.
3    Written by John Darrington <john@darrington.wattle.id.au>
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18    02111-1307, USA. */
19
20
21
22 #ifndef GROUP_H
23 #define GROUP_H
24
25
26 #include "val.h"
27
28
29 enum comparison
30   {
31     CMP_LE = -2,
32     CMP_LT = -1,
33     CMP_EQ = 0,
34     CMP_GT = 1,
35     CMP_GE = 2
36   };
37
38
39 /* Statistics for grouped data */
40 struct group_statistics
41   {
42     /* The value of the independent variable for this group */
43     union value id;
44
45     /* The criterium matching for comparing with id 
46        (applicable only to T-TEST) FIXME: therefore it shouldn't be here
47      */
48     enum comparison criterion;
49
50     /* The arithmetic mean */
51     double mean;
52
53     /* Population std. deviation */
54     double std_dev;
55
56     /* Sample std. deviation */
57     double s_std_dev;
58     
59     /* count */
60     double n;
61
62     double sum;
63
64     /* Sum of squares */
65     double ssq;
66
67     /* Std Err of Mean */
68     double se_mean;
69
70     /* Sum of differences */
71     double sum_diff;
72
73     /* Mean of differences */
74     double mean_diff ;
75
76     /* Running total of the Levene for this group */
77     double lz_total;
78     
79     /* Group mean of Levene */
80     double lz_mean; 
81
82
83     /* min and max values */
84     double minimum ; 
85     double maximum ;
86
87
88   };
89
90
91
92
93 /* These funcs are usefull for hash tables */
94
95 /* Return -1 if the id of a is less than b; +1 if greater than and 
96    0 if equal */
97 int  compare_group(const struct group_statistics *a, 
98                    const struct group_statistics *b, 
99                    int width);
100
101 unsigned hash_group(const struct group_statistics *g, int width);
102
103 void  free_group(struct group_statistics *v, void *aux);
104
105
106
107 #endif