Fixed the t-test model to be consistent with the anova model.
[pspp] / 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_EQ = 0,
33   };
34
35
36 /* Statistics for grouped data */
37 struct group_statistics
38   {
39     /* The value of the independent variable for this group */
40     union value id;
41
42     /* The arithmetic mean */
43     double mean;
44
45     /* Population std. deviation */
46     double std_dev;
47
48     /* Sample std. deviation */
49     double s_std_dev;
50     
51     /* count */
52     double n;
53
54     double sum;
55
56     /* Sum of squares */
57     double ssq;
58
59     /* Std Err of Mean */
60     double se_mean;
61
62     /* Sum of differences */
63     double sum_diff;
64
65     /* Mean of differences */
66     double mean_diff ;
67
68     /* Running total of the Levene for this group */
69     double lz_total;
70     
71     /* Group mean of Levene */
72     double lz_mean; 
73
74
75     /* min and max values */
76     double minimum ; 
77     double maximum ;
78
79
80   };
81
82
83
84
85 /* These funcs are usefull for hash tables */
86
87 /* Return -1 if the id of a is less than b; +1 if greater than and 
88    0 if equal */
89 int  compare_group(const struct group_statistics *a, 
90                    const struct group_statistics *b, 
91                    int width);
92
93 unsigned hash_group(const struct group_statistics *g, int width);
94
95 void  free_group(struct group_statistics *v, void *aux);
96
97
98
99 #endif