simulate_count_data {fastTopics} | R Documentation |
Simulate Count Data from Poisson NMF Model
Description
Simulate a counts matrix X
such that
X[i,j]
is Poisson with rate (mean) Y[i,j]
, where
Y = tcrossprod(L,F)
, L
is an n x k loadings
(“activations”) matrix, and F
is an m x k factors
(“basis vectors”) matrix. The entries of matrix L
are
drawn uniformly at random between zero and lmax
, and the
entries of matrix F
are drawn uniformly at random between 0
and fmax
.
Usage
simulate_count_data(n, m, k, fmax = 1, lmax = 1, sparse = FALSE)
Arguments
n |
Number of rows in simulated count matrix. The number of rows should be at least 2. |
m |
Number of columns in simulated count matrix. The number of columns should be at least 2. |
k |
Number of factors, or “topics”, used to determine Poisson rates. The number of topics should be 1 or more. |
fmax |
Factors are drawn uniformly at random between zero and
|
lmax |
Loadings are drawn uniformly at random between zero and
|
sparse |
If |
Details
Note that only minimal argument checking is performed. This function is mainly used to simulate small data sets for the examples and package tests.
Value
The return value is a list containing the counts matrix
X
and the factorization, F
and L
, used to
generate the counts.