# 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 when reconstruction measured on top 10 PCs
# with mean centering performed before computing PCs
resetViaPCA(X, num.pcs=10, var.sets=var.sets, k=2, random.threshold=10)
# Execute RESET when reconstruction measured on top 10
# uncentered PCs with centering performed as needed inside reset()
resetViaPCA(X, center=FALSE, num.pcs=10, var.sets=var.sets, k=2, random.threshold=10)
Run the code above in your browser using DataLab