1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
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.
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.
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
23 /* Vector representation. */
31 /* Allocate vectors. */
32 struct vector *vec_alloc (int n);
33 void vec_realloc (struct vector *, int n);
34 void vec_free (struct vector *);
36 /* Vector elements. */
37 #define vec_elem(VEC, INDEX) ((VEC)->data[INDEX])
39 /* Set the vector to a constant value. */
40 void vec_init (struct vector *, double);
42 /* Print out the vector to stdout. */
44 void vec_print (const struct vector *);
47 /* Sum the vector values. */
48 double vec_total (const struct vector *);
50 /* Matrix representation. */
58 /* Allocate matrices. */
59 struct matrix *mat_alloc (int nr, int nc);
60 void mat_realloc (struct matrix *, int nr, int nc);
61 void mat_free (struct matrix *);
63 /* Matrix elements. */
64 #define mat_elem(MAT, R, C) ((MAT)->data[(C) + (R) * (MAT)->nc])
66 /* Set matrix values to a constant. */
67 void mat_init (struct matrix *, double);
68 void mat_init_row (struct matrix *, int r, double);
69 void mat_init_col (struct matrix *, int c, double);
71 /* Print out the matrix values to stdout, optionally with row and
72 column labels (for debugging purposes). */
74 void mat_print (const struct matrix *,
75 const struct vector *row_labels, const struct vector *col_labels);
78 /* Sum matrix values. */
79 void mat_row_totals (const struct matrix *, struct vector *row_tots);
80 void mat_col_totals (const struct matrix *, struct vector *col_tots);
81 double mat_grand_total (const struct matrix *);
83 /* Chi-square statistics. */
87 CHISQ_LIKELIHOOD_RATIO,
94 void mat_chisq (const struct matrix *, double chisq[N_CHISQ], int df[N_CHISQ]);