# NOT RUN {
### ----<< Example 1 >>---- : biochem data
data(biochem)
X <- biochem[,1:2]
ojaRCM(X)
# Oja ranks are centered
# (i.e. they add up to zero), and
# the following two return the same.
ojaRCM(X)
(1 - 1/nrow(X))*cov(ojaRank(X))
### ----<< Example 2 >>---- : 300 points in R^7
# The merit of subsampling.
# The following example might take a bit longer:
# }
# NOT RUN {
A <- matrix(c(1,0.5,1,4,2,0.5,-0.5,1,4), ncol = 3)
B <- A %x% A; Sigma <- (B %*% t(B))[1:7, 1:7]
# Sigma is some arbitrary positive definite matrix.
set.seed(123)
X <- rmvnorm(n = 300, sigma = Sigma)
cov2cor(Sigma) # the true correlation matrix
cor(X) # Bravais-Pearson correlation
cov2cor(solve(ojaRCM(X))
# correlation estimate based on Oja ranks
# The subsampling fraction in this example
# is p = 1.081438e-10.
# Yet it returns a sensible estimate.
# }
Run the code above in your browser using DataLab