# Create a collection of 5 variable sets each of size 10
var.sets = list(set1=1:10,
set2=11:20,
set3=21:30,
set4=31:40,
set5=41:50)
# Simulate a 100-by-100 matrix of random Poisson data
X = matrix(rpois(10000, lambda=1), nrow=100)
# Inflate first 10 rows for first 10 variables, i.e., the first
# 10 samples should have elevated scores for the first variable set
X[1:10,1:10] = rpois(100, lambda=5)
# Execute RESET using non-randomized basis computation
reset(X, var.sets=var.sets, k=2, random.threshold=10)
# Execute RESET with randomized basis computation
# (random.threshold will default to k value which is less
# than the size of all variable sets)
reset(X, var.sets=var.sets, k=2, k.buff=2)
# Execute RESET with non-zero k.buff
reset(X, var.sets=var.sets, k=2, k.buff=2)
# Execute RESET with non-zero q
reset(X, var.sets=var.sets, k=2, q=1)
# Execute RESET with L1 vs L2 norm
reset(X, var.sets=var.sets, k=2, norm.type="1")
# Project the X matrix onto the first 5 PCs and use that as X.test
# Scale X before calling prcomp() so that no centering or scaling
# is needed within reset()
X = scale(X)
X.test = prcomp(X,center=FALSE,scale=FALSE,retx=TRUE)$x[,1:5]
reset(X, X.test=X.test, center.X=FALSE, scale.X=FALSE,
center.X.test=FALSE, scale.X.test=FALSE, var.sets=var.sets, k=2)
Run the code above in your browser using DataLab