# create data set
x1 = matrix(runif(200), ncol = 2)
x2 = matrix(rnorm(200), ncol = 2)
x = list(x1, x2)
# create weighting matrix
W = matrix(c(0, 1, 1, 0), ncol = 2)
# calculate ssMRCD
loccovs = ssMRCD(x, weights = W, lambda = 0.5)
# calculate PCA
pca = sparsePCAloc(eta = 1, gamma = 0.5, cor = FALSE,
COVS = loccovs$MRCDcov,
increase_rho = list(FALSE, 20, 1))
# calculate scores
scores(X = rbind(x1, x2), PC = pca$PC,
groups = rep(c(1,2), each = 100), ssMRCD = loccovs)
Run the code above in your browser using DataLab