R/posterior_predict.R
posterior_predict.paramedic.Rd
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,
...
)
An object of class "paramedic"
,
resulting from a call to run_paramedic
.
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.
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.
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.
the number of draws to return. The default and maximum number of draws is the size of the posterior sample.
Hyperparameter specifying the shape parameter of the prior distribution on \(\sigma_e\). Defaults to 2.
Hyperparameter specifying the scale parameter of the prior distribution on \(\sigma_e\). Defaults to 1.
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
).
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.
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.
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)
Hyperparameters specifying the variance of efficiencies
over batches. Only used if k
is greater than zero.
Defaults to 1. (currently not used)
Ignored
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.