pmpmodel {BMS} | R Documentation |
Posterior Model Probability for any Model
Description
Returns the posterior model probability for any model based on bma results
Usage
pmpmodel(bmao, model = numeric(0), exact = TRUE)
Arguments
bmao |
A bma object as created by |
model |
A model index - either variable names, or a logical with model
binaries, or the model hexcode (cf. |
exact |
If |
Details
If the model as provided in model
is the null or the full model, or
is contained in bmao
's topmod object (cf. argument nmodel
in
bms
),
then the result is the same as in
pmp.bma
.
If not and exact=TRUE
, then pmpmodel
estimates the model based on comparing its marginal likelihood (times model
prior) to the likelihoods in the topmod
object and multiplying by
their sum of PMP according to MCMC frequencies,
Value
A scalar with (an estimate of) the posterior model probability for
model
See Also
pmp.bma
for similar
functions
Check http://bms.zeugner.eu for additional help.
Examples
## sample BMA for growth dataset, enumeration sampler
data(datafls)
mm=bms(datafls[,1:10],nmodel=5)
#show the best 5 models:
pmp.bma(mm)
#first column: posterior model prob based on model likelihoods,
#second column: posterior model prob based MCMC frequencies,
### Different ways to get the same result: #########
#PMP of 2nd-best model (hex-code representation)
pmpmodel(mm,"00c")
#PMP of 2nd-best model (binary representation)
incls=as.logical(beta.draws.bma(mm)[,2])
pmpmodel(mm,incls)
#PMP of 2nd-best model (via variable names)
#names of regressors in model "00c":
names(datafls[,2:10])[incls]
pmpmodel(mm,c("SubSahara", "LatAmerica"))
#PMP of 2nd-best model (via positions)
pmpmodel(mm,c(6,7))
####PMP of another model #########
pmpmodel(mm,1:5)