R/ptest.R

Defines functions ptest

Documented in ptest

ptest <- function(x, B = 100) {
  d <- dim(x)[2]
  u <- Directional::riag(B, numeric(d))
  z <- tcrossprod(x, u) 
  p <- numeric(B)
  for (i in 1:B)  
  p[i] <- ks.test(z[, i], "punif", -1, 1)$p.value
  p <- sort(p)
  i <- 1:B
  pval <- min(B / i * p )
  list(pvalues = p, pvalue = pval)
}

Try the Directional package in your browser

Any scripts or data that you put into this service are public.

Directional documentation built on Oct. 12, 2023, 1:07 a.m.