Learn R Programming

RiemStiefel (version 0.1.1)

st.utestR: Test of Uniformity via Rayleigh Statistic on Stiefel Manifold

Description

This function is for hypothesis testing on Stiefel manifold \(St(p,r)\) whether the given data is uniformly distributed or not. We provide two options (original and modified) for Rayleigh-type statistics, which both follow Chi-squared distribution of degrees of freedom \(pr\).

Usage

st.utestR(x, method = c("Original", "Modified"))

Arguments

x

either an array of size \((p\times r\times n)\) or a list of length \(n\) whose elements are \((p\times r)\) matrix on Stiefel manifold.

method

"original" for conventional Rayleigh statistic or "modified" for better order of error.

Value

a (list) object of S3 class htest containing:

statistic

a test statistic.

p.value

\(p\)-value under \(H_0\).

alternative

alternative hypothesis.

method

name of the test.

data.name

name(s) of provided sample data.

References

mardia_directional_1999RiemStiefel

Examples

Run this code
# NOT RUN {
## Test of Uniformity for 100 samples from St(10,5)
#  Data Generation
mydat = st.runif(n=100, p=10, r=5, rtype='list')

#  Run Tests using two methods
st.utestR(mydat, method='original')
st.utestR(mydat, method='modified')

# }
# NOT RUN {
## empirical Type 1 error using the same setting as above.
niter   = 10000
counter = rep(0,niter)  # record p-values
for (i in 1:niter){
  X = st.runif(n=100, p=10, r=5, rtype='list')
  counter[i] = ifelse(st.utestR(X)$p.value < 0.05, 1, 0)
  print(paste0("iteration ",i,"/10000 complete..."))
}

## print the result
print(paste0("* empirical Type 1 error for 'st.utestR': ",round(sum(counter/niter),5)))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab