gibbs_pooled: Evaluate both single-batch and multi-batch models with the...

Description Usage Arguments Value Examples

View source: R/diagnostics.R

Description

Evaluate both single-batch and multi-batch models with the specified range for the number of components, returning the top models sorted by marginal likelihood

Usage

1
2
gibbs_pooled(hp.list, mp, dat, batches, k_range = c(1, 4),
  max_burnin = 32000, top = 3)

Arguments

hp.list

a list of hyperparameters. See example.

mp

a McmcParams object

dat

numeric vector of CNP summary statistics (e.g., median log R ratios)

batches

an integer vector of the same length as the data providing an index for the batch

k_range

a length-two integer vector providing the minimum and maximum number of components

max_burnin

a length-one integer vector indicating the maximum number of burnin iterations

top

the number of models to return after ordering by the marginal likelihood

Value

a list of models

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
 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)
 hp <- HyperparametersMultiBatch(k=3,
                            mu=-0.75,
                            tau2.0=0.4,
                            eta.0=32,
                            m2.0=0.5)
 hp.sb <- Hyperparameters(tau2.0=0.4,
                          mu.0=-0.75,
                          eta.0=32,
                          m2.0=0.5)
 hp.list <- list(single_batch=hp.sb,
                 multi_batch=hp)
 mp <- McmcParams(iter = 1000,
                  burnin = 1000,
                  nStarts = 4,
                  thin=10)
## Not run: 
   models <- gibbs_pooled(hp.list=hp.list, dat=y(truth),
                          batches=batch(truth),
                          mp=mp,
                          top=3)

## End(Not run)

CNPBayes documentation built on May 2, 2018, 3:57 a.m.