fit_GP: Fit a Gaussian process to a single host series using basset

Description Usage Arguments Details Examples

View source: R/model_fitting.R

Description

Fit a Gaussian process to a single host series using basset

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
fit_GP(
  data,
  host,
  taxa_covariance,
  sample_covariance,
  tax_level = "ASV",
  alr_ref = NULL,
  n_samples = 100,
  MAP = FALSE,
  holdout_proportion = 0,
  return_model = FALSE,
  scramble = FALSE
)

Arguments

data

a phyloseq object

host

host short name (e.g. ACA)

taxa_covariance

list of prior covariance parameters over taxa

sample_covariance

kernel function

tax_level

taxonomic level at which to agglomerate data

alr_ref

index of reference ALR coordinate

n_samples

number of posterior samples to draw

MAP

compute MAP estimate only (as single posterior sample)

holdout_proportion

if non-zero, proportion of host's sample to use as a test set

return_model

if TRUE, returns the fitted model instead of saving it

scramble

if TRUE, host samples are scrambled in time; this serve the diagnostic purpose of identifying whether some of the correlation we see between individual hosts' dynamics are the result of systematic differences in abundances (etc.)

rho

bandwidth for SE kernel

Details

Fitted model and metadata saved to designated model output directory.

Examples

1
2
3
4
5
6
tax_level <- "ASV"
data <- load_data(tax_level = tax_level)
params <- formalize_parameters(data)
sample_covariance <- get_Gamma(kernel_scale = 2, proportions = c(1, 0, 0), min_correlation = 0.1, days_to_baseline = 90)
taxa_covariance <- get_Xi(phyloseq::ntaxa(data), total_variance = 1)
fit_GP(data, host = "GAB", taxa_covariance = taxa_covariance, sample_covariance = sample_covariance, tax_level = tax_level, alr_ref = params$alr_ref, MAP = TRUE)

kimberlyroche/ROL documentation built on Dec. 10, 2020, 2:18 a.m.