simulate_whx: Simulate factor matrices and data using priors

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Under Bayesian formulation, use prior distributions of factor matrices and generate simulated data

Usage

1
simulate_whx(nrow, ncol, rank, aw = 0.1, bw = 1, ah = 0.1, bh = 1)

Arguments

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 aw/bw.

ah

Shape parameter of coefficient prior.

bh

Mean of coefficient prior. Scale parameter is equal to ah/bh.

Details

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.

Value

List with elements w, h, and x, each containing basis, coefficient, and count matrices.

Examples

1
2
3
4
5
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)  

ccfindR documentation built on Nov. 8, 2020, 5:12 p.m.