4 #include "local_proto.h" 10 double mean = 0.0, sdx = 0.0, sum3 = 0.0, *v;
13 k = rint(4.0 * pow(0.75 * (n - 1.0) * (n - 1.0), 0.2));
15 while ((
double)(n / k) < 5.0)
18 if ((f = (
int *)calloc(k,
sizeof(
int))) ==
NULL) {
19 fprintf(stderr,
"Memory error in Cdhc_chi_square\n");
22 if ((v = (
double *)
malloc((k + 1) *
sizeof(
double))) ==
NULL) {
23 fprintf(stderr,
"Memory error in Cdhc_chi_square\n");
27 for (i = 0; i < n; ++i) {
31 sdx = sqrt((n * sdx - mean * mean) / (n * (n - 1.0)));
35 for (i = 1; i < k; ++i)
40 for (i = 0; i < n; ++i) {
43 if (x[i] > v[j] && x[i] <= v[j + 1]) {
51 for (i = 0; i < k; ++i)
54 y[0] = sum3 * k / n - n;
55 y[1] = (double)k - 3.0;
58 fprintf(stdout,
" TEST12 CS(N) =%10.4f DOF =%10.4f\n", y[0], y[1]);
double * Cdhc_chi_square(double *x, int n)
double Cdhc_xinormal(double)
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.