Description Usage Arguments Value Examples
The function syntheticNMF
generates random target
matrices that follow some defined NMF model, and may be
used to test NMF algorithms. It is designed to designed
to produce data with known or clear classes of samples.
1 2 
n 
number of rows of the target matrix. 
r 
specification of the factorization rank. It may
be a single It may also be a numerical vector, which contains the
number of samples in each class (i.e integers). In this
case argument 
p 
number of columns of the synthetic target
matrix. Not used if parameter 
offset 
specification of a common offset to be
added to the synthetic target matrix, before
noisification. Its may be a numeric vector of length

noise 
a logical that indicate if noise should be added to the matrix. 
factors 
a logical that indicates if the NMF factors should be return together with the matrix. 
seed 
a single numeric value used to seed the random number generator before generating the matrix. The state of the RNG is restored on exit. 
a matrix, or a list if argument factors=TRUE
.
When factors=FALSE
, the result is a matrix object,
with the following attributes set:
the true underlying coefficient
matrix (i.e. H
);
the true underlying
coefficient matrix (i.e. H
);
the offset if any;
a list
with one
element 'Group'
that contains a factor that
indicates the true groups of samples, i.e. the most
contributing basis component for each sample;
a list
with one element
'Group'
that contains a factor that indicates the
true groups of features, i.e. the basis component to
which each feature contributes the most.
Moreover, the result object is an
ExposeAttribute
object, which means that
relevant attributes are accessible via $
, e.g.,
res$coefficients
. In particular, methods
coef
and basis
will work as
expected and return the true underlying coefficient and
basis matrices respectively.
1 2 3 4 5 6 7 8 9 10 11  # generate a synthetic dataset with known classes: 50 features, 18 samples (5+5+8)
n < 50
counts < c(5, 5, 8)
# no noise
V < syntheticNMF(n, counts, noise=FALSE)
## Not run: aheatmap(V)
# with noise
V < syntheticNMF(n, counts)
## Not run: aheatmap(V)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.