simulate_whx {ccfindR} | R Documentation |
Under Bayesian formulation, use prior distributions of factor matrices and generate simulated data
simulate_whx(nrow, ncol, rank, aw = 0.1, bw = 1, ah = 0.1, bh = 1)
nrow |
Number of features (genes). |
ncol |
Number of cells (samples). |
rank |
Rank (ncol of W, nrow of H). |
aw |
Shape parameter of basis prior. |
bw |
Mean of basis prior. Scale parameter is equal to |
ah |
Shape parameter of coefficient prior. |
bh |
Mean of coefficient prior. Scale parameter is equal to
|
Basis W
and coefficient matrices H
are sampled from
gamma distributions (priors) with shape (aw,ah
) and mean
(bw,bh
) parameters. Count data X
are sampled from Poisson
distribution with mean values given by WH
.
List with elements w
, h
, and x
, each
containing basis, coefficient, and count matrices.
set.seed(1) x <- simulate_whx(nrow=50,ncol=100,rank=5) s <- scNMFSet(count=x$x) s <- vb_factorize(s,ranks=seq(2,8),nrun=5) plot(s)