rangefunc.c (gnumeric-1.12.49.tar.xz) | : | rangefunc.c (gnumeric-1.12.50.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 413 | skipping to change at line 413 | |||
gnm_range_rsq_pop (gnm_float const *xs, const gnm_float *ys, int n, gnm_float *r es) | gnm_range_rsq_pop (gnm_float const *xs, const gnm_float *ys, int n, gnm_float *r es) | |||
{ | { | |||
if (gnm_range_correl_pop (xs, ys, n, res)) | if (gnm_range_correl_pop (xs, ys, n, res)) | |||
return 1; | return 1; | |||
*res *= *res; | *res *= *res; | |||
return 0; | return 0; | |||
} | } | |||
/* Most-common element. (The one whose first occurrence comes first in | /* Most-common element. (The one whose first occurrence comes first in | |||
case of several equally common. */ | case of several equally common.) */ | |||
int | int | |||
gnm_range_mode (gnm_float const *xs, int n, gnm_float *res) | gnm_range_mode (gnm_float const *xs, int n, gnm_float *res) | |||
{ | { | |||
GHashTable *h; | GHashTable *h; | |||
int i; | int i; | |||
gnm_float mode = 0; | gnm_float mode = 0; | |||
gconstpointer mode_key = NULL; | gconstpointer mode_key = NULL; | |||
int dups = 0; | int dups = 0; | |||
if (n <= 1) return 1; | if (n <= 1) return 1; | |||
skipping to change at line 479 | skipping to change at line 479 | |||
if ((n < 8) || gnm_range_average (xs, n, &mu) | if ((n < 8) || gnm_range_average (xs, n, &mu) | |||
|| gnm_range_stddev_est (xs, n, &sigma)) | || gnm_range_stddev_est (xs, n, &sigma)) | |||
return 1; | return 1; | |||
else { | else { | |||
int i; | int i; | |||
gnm_float total = 0.; | gnm_float total = 0.; | |||
gnm_float p; | gnm_float p; | |||
gnm_float *ys; | gnm_float *ys; | |||
ys = range_sort (xs, n); | ys = gnm_range_sort (xs, n); | |||
for (i = 0; i < n; i++) { | for (i = 0; i < n; i++) { | |||
gnm_float val = (pnorm (ys[i], mu, sigma, TRUE, TRUE) + | gnm_float val = (pnorm (ys[i], mu, sigma, TRUE, TRUE) + | |||
pnorm (ys[n - i - 1], | pnorm (ys[n - i - 1], | |||
mu, sigma, FALSE, TRUE)); | mu, sigma, FALSE, TRUE)); | |||
total += ((2*i+1)* val); | total += ((2*i+1)* val); | |||
} | } | |||
total = - n - total/n; | total = - n - total/n; | |||
g_free (ys); | g_free (ys); | |||
total *= (1 + 0.75 / n + 2.25 / (n * n)); | total *= (1 + 0.75 / n + 2.25 / ((gnm_float)n * n)); | |||
if (total < 0.2) | if (total < 0.2) | |||
p = 1. - gnm_exp (-13.436 + 101.14 * total - 223.73 * tot al * total); | p = 1. - gnm_exp (-13.436 + 101.14 * total - 223.73 * tot al * total); | |||
else if (total < 0.34) | else if (total < 0.34) | |||
p = 1. - gnm_exp (-8.318 + 42.796 * total - 59.938 * tota l * total); | p = 1. - gnm_exp (-8.318 + 42.796 * total - 59.938 * tota l * total); | |||
else if (total < 0.6) | else if (total < 0.6) | |||
p = gnm_exp (0.9177 - 4.279 * total - 1.38 * total * tot al); | p = gnm_exp (0.9177 - 4.279 * total - 1.38 * total * tot al); | |||
else | else | |||
p = gnm_exp (1.2937 - 5.709 * total + 0.0186 * total * to tal); | p = gnm_exp (1.2937 - 5.709 * total + 0.0186 * total * to tal); | |||
if (statistics) | if (statistics) | |||
*statistics = total; | *statistics = total; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |