MultiBatchModel: Constructor for MultiBatchModel

Description Usage Arguments Value Examples

Description

Initializes a MultiBatchModel, a container for storing data, parameters, and MCMC output for mixture models with batch- and component-specific means and variances.

Initializes a MultiBatchModel, a container for storing data, parameters, and MCMC output for mixture models with batch- and component-specific means and variances.

Usage

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

MB(dat = numeric(), hp = HyperparametersMultiBatch(),
  mp = McmcParams(iter = 1000, thin = 10, burnin = 1000, 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

dat

the data for the simulation.

batches

an integer-vector of the different batches

hp

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

mp

An object of class 'McmcParams'

Value

An object of class 'MultiBatchModel'

An object of class 'MultiBatchModel'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  model <- MultiBatchModel2(rnorm(10), batch=rep(1:2, each=5))
  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 = N, batch = rep(letters[1:3],
                                                length.out = N),
                             p = c(1/10, 1/5, 1 - 0.1 - 0.2),
                             theta = means,
                             sds = sds)

    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))
    MultiBatchModel2(dat=y(truth), batches=batch(truth),
                     hp=hpList(k=3)[["MB"]])
  model <- MultiBatchModel2(rnorm(10), batch=rep(1:2, each=5))
  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 = N, batch = rep(letters[1:3],
                                                length.out = N),
                             p = c(1/10, 1/5, 1 - 0.1 - 0.2),
                             theta = means,
                             sds = sds)
    MB(dat=y(truth), batches=batch(truth),
       hp=hpList(k=3)[["MB"]])

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