1 /* PSPP - computes sample statistics.
2 Copyright (C) 2004 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
20 #ifndef HEADER_MOMENTS
21 #define HEADER_MOMENTS
26 /* Moments of the mean.
27 Higher-order moments have higher values. */
30 MOMENT_NONE, /* No moments. */
31 MOMENT_MEAN, /* First-order moment. */
32 MOMENT_VARIANCE, /* Second-order moment. */
33 MOMENT_SKEWNESS, /* Third-order moment. */
34 MOMENT_KURTOSIS /* Fourth-order moment. */
39 struct moments *moments_create (enum moment max_moment);
40 void moments_clear (struct moments *);
41 void moments_pass_one (struct moments *, double value, double weight);
42 void moments_pass_two (struct moments *, double value, double weight);
43 void moments_calculate (const struct moments *,
45 double *mean, double *variance,
46 double *skewness, double *kurtosis);
47 void moments_destroy (struct moments *);
49 void moments_of_doubles (const double *array, size_t cnt,
51 double *mean, double *variance,
52 double *skewness, double *kurtosis);
53 void moments_of_values (const union value *array, size_t cnt,
55 double *mean, double *variance,
56 double *skewness, double *kurtosis);
58 double calc_seskew (double weight);
59 double calc_sekurt (double weight);
61 #endif /* moments.h */