Description Usage Arguments Details Value References Examples
View source: R/bayes.constants.R
Generate nine matrices of MCMC output under the ordinary Dirichlet model, for nine fixed values of the precision parameter M. This MCMC output is needed for computing Bayes factors.
1 
data 
is a twocolumn matrix with a row for each study in the metaanalysis. The first column is the log of estimate of relative risk, often a log(odds ratio). The second column is the true or estimated standard error of the log(odds ratio). 
seed 
is the value of the seed for starting the random number
generator, which will be used before each of the nine calls to the
function 
ncycles 
is the number of cycles of the Markov chain. 
d 
is a vector of length four with the values of the hyperparameters, in order, the location and scale of the Gamma inverse prior, mean and variance multiplier for the normal prior on mu. 
K 
is the number of summands to include when one uses Sethuraman's (1994) representation for getting the parameter eta = mean(F). If you do not intend to use this parameter, then take K small, say K=10. 
burnin 
is the number of Markov chain cycles to drop. 
Doss (2012) describes a method for estimating Bayes
factors for many M values in a Dirichlet mixing model;
the method requires judicious selection of multiple hyperparameter
points at which to estimate the posterior distribution by MCMC under
the ordinary Dirichlet model. The function bf1
is used for
estimating Bayes factors for conditional vs.\ ordinary Dirichlet
models, and for comparing values of M in the conditional
model or in the ordinary model, for a range of the precision parameter
M which cover the range of values of interest in most
practical problems. The function bf1
generates the MCMC
output for a hardwired selection of hyperparameters which work
well to give lowvariance estimates of Bayes factors of interest
in practice. Chains are generated for nine values of the Dirichlet
precision parameter M:
.25, .5, 1, 2, 4, 8, 16, 32,
and 64.
The rest of the Dirichlet model is specified by the parameters of the
normal/inverse Gamma prior, which by default are
d = (.1,.1,0,1000).
List with nine matrix components. Each matrix has
nr rows and nc columns, where
nr= ncycles
 burnin
,
nc= (number of studies) +4 for the row label,
the individual study parameter values, and the three overall
parameters, mu, tau, and eta.
Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via RadonNikodym derivatives.” Statistica Sinica, 22, 1–26.
Sethuraman, J. (1994). “A constructive definition of Dirichlet priors.” Statistica Sinica 4, 639–650.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  ## Not run:
## Set up the data.
data(breast.17) # the breast cancer dataset
breast.data < as.matrix(breast.17) # put data in matrix object
## Default values ncycles=2000, burnin=1000, seed=1
## CPU time is given from a run of the R command system.time() on an
## Intel $2.8$ GHz Q$9550$ running Linux
chain1.list < bf1(breast.data) # 40.5 secs
## Next get a second set of 9 chains, with a different seed
chain2.list < bf2(breast.data, seed=2) # 40.4 secs
## Perhaps save for another time.
save(chain1.list,chain2.list,file="breastrdat2lists1000",compress=TRUE)
## later session
load("breastrdat2lists1000")
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.