MBP: Constructor for MultiBatchPooled model

Description Usage Arguments Value Examples

Description

Initializes a MultiBatchPooled model, a container for storing data, parameters, and MCMC output for mixture models with batch- and component-specific means. The variance is assumed to be the same for all components, but allowed to differ by batch.

Usage

1
2
3
MBP(dat = numeric(), hp = HyperparametersMultiBatch(),
  mp = McmcParams(iter = 1000, burnin = 1000, thin = 10, nStarts = 4),
  batches = integer())

Arguments

dat

the data for the simulation.

hp

An object of class 'Hyperparameters' used to specify the hyperparameters of the model.

mp

An object of class 'McmcParams'

batches

an integer-vector of the different batches

Value

An object of class 'MultiBatchPooled'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  model <- MBP(rnorm(10), batch=rep(1L, 10))
  set.seed(100)
  nbatch <- 3
  k <- 3
  means <- matrix(c(-2.1, -2, -1.95, -0.41, -0.4, -0.395, -0.1,
      0, 0.05), nbatch, k, byrow = FALSE)
  sds <- matrix(0.15, nbatch, k)
  sds[, 1] <- 0.3
  N <- 1000
  truth <- simulateBatchData(N = 2500,
                             batch = rep(letters[1:3],
                             length.out = 2500),
                             theta = means, sds = sds,
                             p = c(1/5, 1/3, 1 - 1/3 - 1/5))
  MBP(dat=y(truth), batches=batch(truth),
      hp=hpList(k=3)[["MB"]])

CNPBayes documentation built on May 6, 2019, 4:06 a.m.