simulate_whx {ccfindR} | R Documentation

## Simulate factor matrices and data using priors

### Description

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

### Usage

    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

    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)

[Package ccfindR version 1.4.2 Index]