Fit a simple multinomial model for count data, in which each sample (i.e., a row of the data matrix X) is assigned to a cluster. Under this simple multinomial model, \(x_{ij}\) assigned to cluster \(k\) is multinomial with sample size \(s_i = x_{i1} + ... + x_{im}\) and multinomial probabilities \(p_{1k}, ..., p_{mk}\). This is a special case of the multinomial topic model in which all the mixture proportions are either 0 or 1. The maximum-likelihood estimates (MLEs) of the multinomial probabilities have a closed-form solution; no iterative algorithm is needed to fit this simple model.

fit_multinom_model(cluster, X, verbose = c("none", "detailed"), ...)

Arguments

cluster

A factor specifying a grouping, or clustering, of the rows of X; e.g., the “cluster” output from kmeans.

X

The n x m matrix of counts; all entries of X should be non-negative. It can be a sparse matrix (class "dgCMatrix") or dense matrix (class "matrix"), with some exceptions (see ‘Details’).

verbose

This is passed as the “verbose” argument in the call to init_poisson_nmf.

...

Additional arguments passed to init_poisson_nmf.

Value

A multinomial topic model fit.

See also