Predict concentrations (and efficiencies, if applicable), absolute abundances, and relative abundances based on the posterior distributions from a previously fitted model resulting from a call to run_paramedic.

# S3 method for paramedic
posterior_predict(
  object,
  W = NULL,
  V = NULL,
  X = V[, 1, drop = FALSE],
  draws = NULL,
  alpha_sigma = 2,
  kappa_sigma = 1,
  use_post_e = TRUE,
  alpha_phi = 0,
  beta_phi = 0,
  k = 0,
  sigma_xi = 1,
  ...
)

Arguments

object

An object of class "paramedic", resulting from a call to run_paramedic.

W

The new relative abundance data, e.g., from broad range 16S sequencing with "universal" primers. Expects data (e.g., matrix, data.frame, tibble) with sample identifiers in the first column. Sample identifiers must be the same between W and V, and the column must have the same name in W and V.

V

The new absolute abundance data, e.g., from taxon-specific absolute primers. Expects data (e.g., matrix, data.frame, tibble) with sample identifiers in the first column. Sample identifiers must be the same between W and V, and the column must have the same name in W and V.

X

The new covariate data. Expects data (e.g., matrix, data.frame, tibble) with sample identifiers in the first column. Sample identifiers must be the same between W, V, and X, and the column must have the same name in W, V, and X. If X only consists of the subject identifiers, then no covariates are used.

draws

the number of draws to return. The default and maximum number of draws is the size of the posterior sample.

alpha_sigma

Hyperparameter specifying the shape parameter of the prior distribution on \(\sigma_e\). Defaults to 2.

kappa_sigma

Hyperparameter specifying the scale parameter of the prior distribution on \(\sigma_e\). Defaults to 1.

use_post_e

A logical flag determining whether or not posterior samples of e should be used in generating predictions; if FALSE, uses posterior draws of sigma_e to generate predictions for e (defaults to TRUE).

alpha_phi

Hyperparameter specifying the shape parameter of the prior distribution on \(\phi\). Defaults to 0; a negative binomial model can be specified if both alpha_phi and beta_phi are nonzero.

beta_phi

Hyperparameter specifying the rate parameter of the prior distribution on \(\phi\). Defaults to 0; a negative binomial model can be specified if both alpha_phi and beta_phi are nonzero.

k

the number of batches that the relative abundance data W were analyzed in. If k = 0 (the default), then batch effects are not considered. (currently not used)

sigma_xi

Hyperparameters specifying the variance of efficiencies over batches. Only used if k is greater than zero. Defaults to 1. (currently not used)

...

Ignored

Value

A list of draws by ncol(W) matrices (for taxon-level parameters) or draws by nrow(W) by ncol(W) arrays (for individual-level parameters and data) of simulations from the posterior predictive distribution. Each row of the matrices, and each of the first dimension of the arrays, denotes the predictions generated using a single draw of the model parameters from the posterior distribution.