Skip to contents

Normalises observed counts by the posterior estimate of their sample size factor and re-expresses them at a chosen r_pred, giving \(\lfloor y_{imj} / \exp(\hat r_{im} - r^{\mathrm{pred}}_m)\rfloor\). These are the values plotted as crosses on top of the posterior predictive densities in the paper.

Usage

normalize_counts(fit, features = NULL, r_pred = 0, log = FALSE)

Arguments

fit

A fitted "spbgfm" object.

features

Integer vector of feature (column) indices in the concatenated table, or NULL (default) for all features.

r_pred

Sample size factor of the new sample: a single number applied to all domains, or a length-\(M\) vector. Default 0, matching the figures in the paper.

log

Logical; return log(count + 1) instead of the count. Default FALSE.

Value

An n x length(features) matrix.