GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
omnibus.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <math.h>
3 
4 
5 double *omnibus_moments(double *x, int n)
6 {
7  double diff, mean = 0., fssm, tssm, sum_cube = 0., sum_four = 0.,
8  sum_sq = 0.;
9  static double y[2];
10  int i;
11 
12  for (i = 0; i < n; ++i)
13  mean += x[i];
14 
15  mean /= n;
16 
17  for (i = 0; i < n; ++i) {
18  diff = x[i] - mean;
19  sum_sq += diff * diff;
20  sum_cube += diff * diff * diff;
21  sum_four += diff * diff * diff * diff;
22  }
23 
24  /*
25  fprintf (stdout,"n %d x-bar %g sum^2 %g sum^3 %g sum^4 %g \n",n,mean,sum_sq,sum_cube,sum_four);
26  */
27  tssm = sqrt((double)n) * sum_cube / pow(sum_sq, 1.5);
28  fssm = n * sum_four / (sum_sq * sum_sq);
29 
30 #ifdef NOISY
31  fprintf(stdout,
32  " TESTS OF COMPOSITE DISTRIBUTIONAL HYPOTHESES\n");
33  fprintf(stdout, " TEST1 TSM =%10.4f FSM =%10.4f\n", tssm, fssm);
34 #endif /* NOISY */
35 
36  y[0] = tssm;
37  y[1] = fssm;
38 
39  return y;
40 }
int y
Definition: plot.c:34
double * omnibus_moments(double *x, int n)
Definition: omnibus.c:5
int n
Definition: dataquad.c:291