I am trying to find out exactly how the test statistic is computed when performing a Shapiro-Wilk Normality Test in R. Here is the body of the function.
> shapiro.test
function (x)
{
DNAME <- deparse(substitute(x))
stopifnot(is.numeric(x))
x <- sort(x[complete.cases(x)])
n <- length(x)
if (is.na(n) || n < 3L || n > 5000L)
stop("sample size must be between 3 and 5000")
rng <- x[n] - x[1L]
if (rng == 0)
stop("all 'x' values are identical")
if (rng < 1e-10)
x <- x/rng
res <- .Call(C_SWilk, x)
RVAL <- list(statistic = c(W = res[1]), p.value = res[2],
method = "Shapiro-Wilk normality test", data.name = DNAME)
class(RVAL) <- "htest"
return(RVAL)
}
<bytecode: 0x0603f2a8>
<environment: namespace:stats>
I cannot understand this part:
.Call(C_SWilk, x)
It seems that a function (i.e. C_SWilk) is called. Does anyone know what this function is? I tried to see but it gives me an error,
> C_SWilk
Error: object 'C_SWilk' not found