GRASS GIS 8 Programmer's Manual
8.3.2(2024)-exported
Loading...
Searching...
No Matches
shapiroe.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <math.h>
3
4
double
*
Cdhc_shapiro_wilk_exp
(
double
*x,
int
n)
5
{
6
static
double
y[2];
7
double
mean,
b
, s1, xs, sum1 = 0.0, sum2 = 0.0;
8
int
i;
9
10
for
(i = 0; i < n; ++i)
11
if
(i == 0 || xs >
x
[i])
12
xs =
x
[i];
13
14
for
(i = 0; i < n; ++i) {
15
sum1 +=
x
[i];
16
sum2 +=
x
[i] *
x
[i];
17
}
18
19
s1 = sum2 - sum1 * sum1 / n;
20
mean = sum1 / n;
21
b
= (mean - xs) * sqrt((
double
)n / (n - 1.0));
22
y[0] =
b
*
b
/ s1;
23
24
#ifdef NOISY
25
fprintf(stdout,
" TEST15 SW(E) =%10.4f\n"
, y[0]);
26
#endif
/* NOISY */
27
28
return
y;
29
}
b
double b
Definition
driver/set_window.c:5
Cdhc_shapiro_wilk_exp
double * Cdhc_shapiro_wilk_exp(double *x, int n)
Definition
shapiroe.c:4
x
#define x
cdhc
shapiroe.c
Generated on Fri May 24 2024 09:06:59 for GRASS GIS 8 Programmer's Manual by
1.9.8