Various Goodness-of-fit Test Statistics
gofBTstat()
computes supposedly Beta distributed test
statistics for checking uniformity of u
on the unit sphere.
gofBTstat(u)
u |
(n,d)-matrix of values whose rows supposedly follow a uniform distribution on the unit sphere in IR^d. |
An (n,d-1)-matrix
where the (i,k)th entry is
B[ik] = (u[i,1]^2+..+u[i,k]^2) / (u[i,1]^2+..+u[i,d]^2).
Li, R.-Z., Fang, K.-T., and Zhu, L.-X. (1997). Some Q-Q probability plots to test spherical and elliptical symmetry. Journal of Computational and Graphical Statistics 6(4), 435–450.
## generate data on the unit sphere n <- 360 d <- 5 set.seed(1) x <- matrix(rnorm(n*d), ncol=d) U <- x/sqrt(rowSums(x^2)) ## compute the test statistics B_k, k in {1,..,d-1} Bmat <- gofBTstat(U) ## (graphically) check if Bmat[,k] follows a Beta(k/2, (d-k)/2) distribution qqp <- function(k, Bmat) { d <- ncol(Bmat)+1L tit <- substitute(plain("Beta")(.A.,.B.)~~ bold("Q-Q Plot"), list(.A. = k/2, .B. = (d-k)/2)) qqplot2(Bmat[,k], qF=function(p) qbeta(p, shape1=k/2, shape2=(d-k)/2), main.args=list(text=tit, side=3, cex=1.3, line=1.1, xpd=NA)) } qqp(1, Bmat=Bmat) # k=1 qqp(3, Bmat=Bmat) # k=3
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.