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
21 #define statistics_h 1
23 /* These are all sample statistics except for mean since uses
24 population statistics for whatever reason. */
26 /* Define pi to the maximum precision available. */
27 #include <math.h> /* defines M_PI on many systems */
31 #else /* !PI && !M_PI */
32 #define PI 3.14159265358979323846264338327
33 #endif /* !PI && !M_PI */
36 /* Returns the fourth power of its argument. */
44 /* Returns the cube of its argument. */
51 /* Returns the square of its argument. */
58 /* Mean, standard error of mean. */
59 #define calc_mean(D, N) \
61 #define calc_semean(STDDEV, N) \
64 /* Variance, standard deviation, coefficient of variance. */
65 #define calc_variance(D, N) \
66 ( ((D)[1] - sqr ((D)[0])/(N)) / ((N)-1) )
67 #define calc_stddev(VARIANCE) \
69 #define calc_cfvar(D, N) \
70 ( calc_stddev (calc_variance (D, N)) / calc_mean (D, N) )
72 /* Kurtosis, standard error of kurtosis. */
73 double calc_kurt (const double d[4], double n, double variance);
74 double calc_sekurt (double n);
76 /* Skewness, standard error of skewness. */
77 double calc_skew (const double d[3], double n, double stddev);
78 double calc_seskew (double n);
81 double normal_sig (double x);
82 double chisq_sig (double chisq, int df);
84 #endif /* !statistics_h */