View source: R/special_stiefel.R
| stiefel.utest | R Documentation |
Given the data on Stiefel manifold St(k,p), it tests whether the data is distributed uniformly.
stiefel.utest(stobj, method = c("Rayleigh", "RayleighM"))
stobj |
a S3 |
method |
(case-insensitive) name of the test method containing
|
a (list) object of S3 class htest containing:
a test statistic.
p-value under H_0.
alternative hypothesis.
name of the test.
name(s) of provided sample data.
chikuse_statistics_2003Riemann
\insertRefmardia_directional_1999Riemann
wrap.stiefel
#-------------------------------------------------------------------
# Compare Rayleigh's original and modified versions of the test
#
# Test 1. sample uniformly from St(2,4)
# Test 2. use perturbed principal components from 'iris' data in R^4
# which is concentrated around a point to reject H0.
#-------------------------------------------------------------------
## DATA GENERATION
# 1. uniform data
myobj1 = stiefel.runif(n=100, k=2, p=4)
# 2. perturbed principal components
data(iris)
irdat = list()
for (n in 1:100){
tmpdata = iris[1:50,1:4] + matrix(rnorm(50*4,sd=0.5),ncol=4)
irdat[[n]] = eigen(cov(tmpdata))$vectors[,1:2]
}
myobj2 = wrap.stiefel(irdat)
## TEST
# 1. uniform data
stiefel.utest(myobj1, method="Rayleigh")
stiefel.utest(myobj1, method="RayleighM")
# 2. concentrated data
stiefel.utest(myobj2, method="rayleIgh") # method names are
stiefel.utest(myobj2, method="raYleiGhM") # CASE - INSENSITIVE !
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.