Description Usage Arguments Details Value Author(s) See Also Examples
This function computes the posterior model probabilities using the MCMC output of
"bcct"
and "bict"
objects.
1 |
object |
An object of class |
n.burnin |
An optional argument giving the number of iterations to use as burn-in. The default value is 0. |
scale |
An optional argument for controlling how the posterior model probabilities are returned
as output. The function will return details on the models with the posterior model probability
larger than |
best |
An optional argument for controlling how the posterior model probabilities are returned
as output. The function will return details on the |
thin |
An optional argument giving the amount of thinning to use, i.e. the computations are
based on every |
It will output
only the probabilities of the "best" models, as defined by the user specifying either the best
or
scale
arguments.
The use of thinning is recommended when the number of MCMC iterations and/or the number of log-linear parameters in the maximal model are/is large, which may cause problems with comuter memory storage.
The function will return an object of class "modprobs"
which is a list containing the following
components.
table |
An object of class |
totmodsvisit |
A numeric scalar giving the total number of models visited after the burn-in iterations. |
Antony M. Overstall A.M.Overstall@soton.ac.uk.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | set.seed(1)
## Set seed for reproducibility
data(AOH)
## Load AOH data
test1<-bcct(formula=y~(alc+hyp+obe)^3,data=AOH,n.sample=100,prior="UIP")
## Starting from maximal model of saturated model do 100 iterations of MCMC
## algorithm.
mod_probs(object=test1,n.burnin=10,best=6)
## Using a burn-in of 10 iterations find the posterior model probabilities
## of the 6 models with the highest posterior model probability. Will get:
#Posterior model probabilities:
# prob model_formula
#1 0.50000 ~alc + hyp + obe
#2 0.32222 ~alc + hyp + obe + hyp:obe
#3 0.12222 ~alc + hyp + obe + alc:hyp + hyp:obe
#4 0.05556 ~alc + hyp + obe + alc:hyp
#
#Total number of models visited = 4
## Note that since the chain only visited 4 models we only get probabilities
## for 4 models not 6.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.