nullmodel_GoM: Null models for Grade of Membership (GoM) cluster validation

Description Usage Arguments Value Examples

View source: R/nullmodel_GoM.R

Description

Use null models (popular in ecology) to generate randomized matrix of counts given the observed data matrix, fit the GoM model to these null matrices and compare the fit on null model data with that on the observed data. Used for validating the GoM clusters

Usage

1
2
3
nullmodel_GoM(counts, K, tol = 0.1, null.model = c("frequency",
  "richness", "independentswap", "trialswap"), iter_fill = 1000,
  iter_randomized = 100, plot = TRUE)

Arguments

counts

The counts matrix (N x G): N- the number of samples, G- number of features

K

The number of clusters to fit

tol

The tolerance of the GoM model fitted

null.model

The type of nullmodel used (similar to the randomizeMatrix() function argument in picante package)

iter_fill

The number of swaps/fills in each randomized matrix build

iter_randomized

The number of randomization matrices generated

plot

If TRUE, plots density of log Bayes factor

Value

Returns a list with

GoMBF.obs

log BF for the observed counts with K=2 against the null with no clusters

GoMBF.rand

a vector of log BF for each randomized count matrix with K=2 against the null with no clusters

pval

the p-value of the observed log Bayes factor against the ones from randomized matrices

Examples

1
2
3
4
5
6
7
data("ex.counts")
nullmodel_GoM(ex.counts,
              K=2,
              tol=500,
              null.model="frequency",
              iter_randomized=3,
              plot=FALSE)

kkdey/CountClust documentation built on Jan. 17, 2021, 5:32 p.m.