plotModelsize {BMS}R Documentation

Plot Model Size Distribution

Description

Plots posterior and prior model size distribution

Usage

plotModelsize(bmao, exact = FALSE, ksubset = NULL, include.legend = TRUE, do.grid = TRUE, ...)

Arguments

bmao

a 'bma' object (cf. bms)

exact

if TRUE, then the posterior model distribution is based on the best models of bmao and their marginal likelihoods;
if FALSE (default) then the distribution is based on all encountered models and their MCMC frequencies (cf. 'Details' in coef.bma)

ksubset

integer vector detailing for which model sizes the plot should be done

include.legend

if TRUE, a small legend is included via the low-level command legend

do.grid

if TRUE, a grid is added to the plot (with a simple grid()).

...

parameters passed on to matplot with sensible defaults

Value

As a default, plotModelsize plots the posterior model size distribution as a blue line, and the prior model distribution as a dashed red line.
In addition, it returns a list with the following elements:

mean

The posterior expected value of model size

var

The variance of the posterior model size distribution

dens

A vector detailing the posterior model size distribution from model size 0 (the first element) to K (the last element)

Author(s)

Martin Feldkircher and Stefan Zeugner

See Also

See also bms, image.bma, density.bma, plotConv

Check http://bms.zeugner.eu for additional help.

Examples

data(datafls)
mm=bms(datafls,burn=1500, iter=5000, nmodel=200,mprior="fixed",mprior.size=6)

#plot Nb.1 based on aggregate results
postdist= plotModelsize(mm)

#plot based only on 30 best models
plotModelsize(mm[1:30],exact=TRUE,include.legend=FALSE)

#plot based on all best models, but showing distribution only for model sizes 1 to 20
plotModelsize(mm,exact=TRUE,ksubset=1:20)

# create a plot similar to plot Nb. 1
plot(postdist$dens,type="l") 
lines(mm$mprior.info$mp.Kdist)



[Package BMS version 0.3.1 Index]