Functions in paramedic expect data (W, V, and X) in matrix, data.frame , or tibble form, with the first column being sample identifiers. Sample identifiers must be the same between W, V, and X and the column must have the same name in W and V. This function checks the incoming data, transforms it into the data list that is passed to the Stan functions, and computes any initial values of model parameters.

check_entered_data(
  W,
  V,
  X,
  k,
  inits_lst,
  sigma_beta,
  sigma_Sigma,
  alpha_sigma,
  kappa_sigma
)

make_paramedic_tibbles(
  W,
  V,
  X,
  k,
  inits_lst,
  sigma_beta,
  sigma_Sigma,
  alpha_sigma,
  kappa_sigma
)

make_paramedic_stan_data(
  k,
  W_mat,
  V_mat,
  X_mat,
  inits_lst,
  sigma_beta,
  sigma_Sigma,
  alpha_sigma,
  kappa_sigma,
  alpha_phi,
  beta_phi,
  n_chains,
  centered = FALSE
)

Arguments

W

The 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 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 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.

k

the number of batches (0 if a single batch)

inits_lst

An optional list of initial values of the parameters. Must be a named list; see stan.

sigma_beta

Hyperparameter specifying the prior variance on \(\beta_0\). Defaults to \(\sqrt{50}\).

sigma_Sigma

Hyperparameter specifying the prior variance on \(\Sigma\). Defaults to \(\sqrt{50}\).

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.

W_mat

the pre-processed matrix W

V_mat

the pre-processed matrix V

X_mat

the pre-processed matrix X

alpha_phi

Hyperparameter specifying the shape parameter of the prior distribution on \(phi\) (the optional Negative Binomial dispersion parameter). Defaults to 0 (in which case a Poisson distribution on V is used).

beta_phi

Hyperparameter specifying the scale parameter of the prior distribution on \(phi\) (the optional Negative Binomial dispersion parameter). Defaults to 0 (in which case a Poisson distribution on V is used).

n_chains

the number of chains to run

centered

whether or not to use the centered parameterization of the stan algorithm. Defaults to FALSE.

Functions

  • make_paramedic_tibbles: Make tibbles from entered data

  • make_paramedic_stan_data: Make data and initial values lists to pass to stan