# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
# generate two random NMF models
a <- rnmf(3, 100, 20)
b <- rnmf(3, 100, 20)
# Compute auto-correlations
basiscor(a)
profcor(a)
# Compute correlations with b
basiscor(a, b)
profcor(a, b)
# try to recover the underlying NMF model 'a' from noisy data
res <- nmf(fitted(a) + rmatrix(a), 3)
# Compute correlations with the true model
basiscor(a, res)
profcor(a, res)
# Compute correlations with a random compatible matrix
W <- rmatrix(basis(a))
basiscor(a, W)
identical(basiscor(a, W), basiscor(W, a))
H <- rmatrix(coef(a))
profcor(a, H)
identical(profcor(a, H), profcor(H, a))
Run the code above in your browser using DataLab