GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
shapiroe.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <math.h>
3
4
5
double
*
shapiro_wilk_exp
(
double
*x,
int
n)
6
{
7
static
double
y[2];
8
double
mean,
b
, s1, xs, sum1 = 0.0, sum2 = 0.0;
9
int
i;
10
11
for
(i = 0; i < n; ++i)
12
if
(i == 0 || xs > x[i])
13
xs = x[i];
14
15
for
(i = 0; i < n; ++i) {
16
sum1 += x[i];
17
sum2 += x[i] * x[i];
18
}
19
20
s1 = sum2 - sum1 * sum1 / n;
21
mean = sum1 / n;
22
b = (mean - xs) * sqrt((
double
)n / (n - 1.0));
23
y[0] = b * b / s1;
24
25
#ifdef NOISY
26
fprintf(stdout,
" TEST15 SW(E) =%10.4f\n"
, y[0]);
27
#endif
/* NOISY */
28
29
return
y;
30
}
lib
cdhc
shapiroe.c
Generated on Wed Jun 6 2012 14:04:28 for GRASS Programmer's Manual by
1.8.1