MultiBatch: Constructor for MultiBatch objects MultiBatch is the...

Description Usage Arguments Details Value See Also Examples

View source: R/MultiBatch.R

Description

Constructor for MultiBatch objects MultiBatch is the container used by CNPBayes for the organization of the primary data, current values of the mixture model parameters, hyperparameters, and MCMC chains.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
MultiBatch(
  model = "MB3",
  data = modelData(),
  specs = model_spec(model, data),
  iter = 1000L,
  burnin = 200L,
  thin = 1L,
  nStarts = 4L,
  max_burnin = burnin,
  hp = Hyperparameters(k = specs$k),
  mp = McmcParams(iter = iter, thin = thin, burnin = burnin, nStarts = nStarts,
    max_burnin = max_burnin),
  parameters = modelParameters(mp = mp, hp = hp),
  chains = mcmc_chains(specs, parameters),
  current_values = modelValues2(specs, data, hp),
  summaries = modelSummaries(specs),
  flags = modelFlags()
)

Arguments

model

character string abbreviation for the type of mixture model. See details.

data

one-dimensional summaries of log-ratios at a CNV-region for a collection of samples. See details for required columns.

specs

additional model specifications

iter

total number of saved MCMC iterations (after thinning and does not include burnin)

burnin

number of burnin MCMC simulations

thin

number indicating how often MCMC updates are saved in the McmcChains slot of a MultiBatch instance

nStarts

number of independent chains

max_burnin

ignored

hp

a Hyperparameters instance

mp

a McmcParams instance

parameters

Parameters of the finite Bayesian mixture model

chains

a McmcChains instance

current_values

values of mixture model parameters from the last iteration of the MCMC. These values can be used to initialize another chain if more MCMC simulations are needed.

summaries

list of model summaries

flags

list of flags that could indicate possible problems with convergence

Details

CNPBayes fits finite mixture models with batch-specific means and variances, where multi-batch models are denoted by MB. Special cases of the MB model include a pooled variance model (MBP) with a single variance estimate per batch. In addition, we evaluate models with a single batch (SB) and a single batch model with pooled variances (SBP). The abbreviation MB3 indicates a multi-batch model with 3 mixture components, while SBP2 corresponds to a single batch model with pooled variance with 2 mixture components. This short-hand for the type of model and number of mixture components can be passed as the 'model' argument to the MultiBatch constructor. As described in the vignette, our general strategy that works well in most cases is to instantiate a default MultiBatch instance without to create a general container without regard to the number of mixture components and whether to pool at this stage. Next, we fit some of the wrappers provided with CNPBayes that will explore several possible models. We refer the reader to the vignette for a detailed example of an example workflow. While an effort has been made to automate these processes, exploratory data analyses and associated visualizations are extremely helpful. Several such visualizations are provided in the vignette using the 'ggMixture' function.

Value

a MultiBatch instance

See Also

ggMixture revertToMultiBatch median_summary kolmogorov_batches

Examples

1
2
3
4
5
6
7
8
9
 extdir <- system.file("extdata", package="CNPBayes")
 fname <- file.path(extdir, "CNP_001",
                    "batched_data.rds")
 batched.data <- readRDS(fname)
 mb <- MultiBatch(data=batched.data)
 mb
 ## Batch information is ignored if a SB model is created, but can be recovered using `revertToMultiBatch`.
 sb <- MultiBatch(model="SBP2", data=batched.data)
 mb2 <- revertToMultiBatch(sb)

scristia/CNPBayes documentation built on Aug. 9, 2020, 7:31 p.m.