Function to compute the Bayes factors from MCMC samples.
1 2 
runs 
A list with outputs from the function

bfsize1 
A scalar or vector of the same length as

method 
Which method to use to calculate the Bayes factors: Reverse logistic or MengWong. 
reference 
Which model goes in the denominator. 
transf 
Whether to use the transformed sample mu for the computations. Otherwise it uses z. 
binwo 
For the binomial family, if use workaround when the untransformed sample is used. 
Computes the Bayes factors using method
with respect to
reference
.
A list with components
logbf
A vector containing logarithm of the Bayes factors.
logLik1
logLik2
Matrices with the values of
the loglikelihood computed from the samples for each model at the
first and second stages.
isweights
A vector with the importance sampling
weights for computing the Bayes factors at new points that will be
used at the second stage. Used internally in
bf2new
and bf2optim
.
controlvar
A matrix with the control variates
computed at the samples that will be used in the second stage.
sample2
The MCMC sample for mu or z that will be
used in the second stage. Used internally in
bf2new
and bf2optim
.
N1
, N2
Vectors containing the sample sizes
used in the first and second stages.
distmat
Matrix of distances between locations.
betm0
, betQ0
, ssqdf
, ssqsc
,
tsqdf
, tsqsc
, dispersion
, response
,
weights
, modelmatrix
, locations
,
family
, corrfcn
, transf
Model parameters used
internally in.
bf2new
and bf2optim
.
pnts
A list containing the skeleton points. Used
internally in bf2new
and bf2optim
.
Geyer, C. J. (1994). Estimating normalizing constants and reweighting mixtures. Technical report, University of Minnesota.
Meng, X. L., & Wong, W. H. (1996). Simulating ratios of normalizing constants via a simple identity: A theoretical exploration. Statistica Sinica, 6, 831860.
Roy, V., Evangelou, E., and Zhu, Z. (2015). Efficient estimation and prediction for the Bayesian spatial generalized linear mixed model with flexible link functions. Biometrics. http://dx.doi.org/10.1111/biom.12371
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  ## Not run:
data(rhizoctonia)
### Define the model
corrf < "spherical"
kappa < 0
ssqdf < 1
ssqsc < 1
betm0 < 0
betQ0 < .01
linkp < "probit"
### Skeleton points
philist < c(100, 140, 180)
omglist < c(.5, 1)
parlist < expand.grid(phi=philist, linkp=linkp, omg=omglist, kappa = kappa)
### MCMC sizes
Nout < 100
Nthin < 1
Nbi < 0
### Take MCMC samples
runs < list()
for (i in 1:NROW(parlist)) {
runs[[i]] < mcsglmm(Infected ~ 1, 'binomial', rhizoctonia, weights = Total,
atsample = ~ Xcoord + Ycoord,
Nout = Nout, Nthin = Nthin, Nbi = Nbi,
betm0 = betm0, betQ0 = betQ0,
ssqdf = ssqdf, ssqsc = ssqsc,
phistart = parlist$phi[i], omgstart = parlist$omg[i],
linkp = parlist$linkp[i], kappa = parlist$kappa[i],
corrfcn = corrf, phisc = 0, omgsc = 0)
}
bf < bf1skel(runs)
bf$logbf
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.