bf.c.o: Compute Bayes Factors for Conditional vs. Ordinary Dirichlet...

Description Usage Arguments Details Value References Examples

View source: R/modelfit.R

Description

This function carries out the final step in computing Bayes factors for comparing conditional and ordinary Dirichlet mixing models, for a sequence of Dirichlet precision parameters M.

Usage

1
bf.c.o(df=-99, from=.4, incr=.1, to, cc, mat.list)

Arguments

df

degrees of freedom for the t distribution in the model; df=-99 corresponds to a normal distribution.

cc

is the vector of nine constants computed by bf1 and bf2.

from

is the starting value for the sequence of values of the precision parameter M at which to compute the Bayes factor.

to

is the ending value for the sequence of values of M.

incr

is the amount by which to increment the values of M.

mat.list

list of nine matrices of MCMC output produced by bf1 for the final computation of the Bayes factors.

Details

This function carries out the fourth and final step in the computation of Bayes factors for the conditional vs. ordinary Dirichlet mixing models. It implements a multiple-chain version of Equation (2.7) of Burr (2012); the details of the multiple-chain algorithm are given in Doss (2012). Previous steps are two calls to bf1 and a call to bf2, as illustrated in the Examples section and in Burr (2012).

Value

A list with two named components, Mnew and y. The vector Mnew is the sequence of (finite) values of M. The vector y is the estimates of the Bayes factors corresponding to Mnew.

References

Burr, Deborah (2012). “bspmma: An R package for Bayesian semiparametric models for meta-analysis.” Journal of Statistical Software 50(4), 1–23. http://www.jstatsoft.org/v50/i04/.

Doss, Hani (2012). “Hyperparameter and model selection for nonparametric Bayes problems via Radon-Nikodym derivatives.” Statistica Sinica22, 1–26.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
##  CPU times are from runs of the R command system.time() on an
##  Intel $2.8$ GHz Q$9550$ running Linux.
## Preliminary steps

data(breast.17) # the breast cancer dataset
breast.data <- as.matrix(breast.17) # put data in matrix object
chain1.list <- bf1(breast.data) # 40.5 secs
cc <- bf2(chain1.list) # 1.6 secs
## Next get a second set of 9 chains, with a different seed
chain2.list <- bf1(breast.data,seed=2) # 40.4 secs

## OR load the chains and constants saved earlier
load("breast-rdat-2lists-1000")
load("breast-rdat-2lists-1000")

## Compute and plot the Bayes factors
breast.bfco <- bf.c.o(to=20, cc=cc, mat.list=chain2.list) # 107 secs
draw.bf(breast.bfco)

## End(Not run)

bspmma documentation built on Jan. 14, 2019, 1:04 a.m.