Skip to contents

Initial values of p are chosen uniformly at random in the range 0.001 to 0.999 inclusive.

Usage

.createBinomialInit(
  gammaA = c(shape = 1, scale = 10),
  gammaB = c(shape = 1, scale = 10),
  seed = NULL,
  quantiles = NULL,
  rng = c("base::Mersenne-Twister", "base::Wichmann-Hill", "base::Marsaglia-Multicarry",
    "base::Super-Duper"),
  n = 1
)

Arguments

gammaA

a vector with elements named shape and scale that define the hyper prior for a in the Beta prior for p.

gammaB

a vector with elements named shape and scale that define the hyper prior for b in the Beta prior for p.

seed

a scalar containing the seed to be used for the init. NULL, the default, indicates that a random seed should be used. It is not clear from the runjags or JAGS manuals what the range of permissible seed values is, but positive integers appear to be acceptable.

quantiles

Default NULL. If NULL, starting values of a and b are chosen at random. Otherwise, starting values are defined by the values supplied in quantiles. See Usage Notes below.

rng

the random number generator to be used for each init

n

the length of the initialisation vector for p

Value

The init: a list with elements named p, a, b, RNG.name and RNG.seed.

Usage Notes

The quantiles parameter provides a flexible way of defining starting values for the hyperparameters a and b. If NULL, the default, starting values are random values from either gammaA (for a) or gammaB (for b). Otherwise, quantiles should be a numeric vector of length 2 with values (named a and b) that are both either NA or in the range (0, 1). If NA, the corresponding staring value is chosen at random, as above. Otherwise, if the value is x, the starting value of the hyperparameter is the xth quantile of the corresponding Gamma distribution.

For example, if quantiles=c("a"=NA, "b"=50), then the starting value for a is a random value drawn from the distribution defined by gammaA and the starting value of b is the 50th centile of the distribution defined by gammaB.