Learn R Programming

BayesVarSel (version 2.4.5)

plot.Bvs: A function for plotting summaries of an object of class Bvs

Description

Four different plots to summarize graphically the results in an object of class Bvs.

Usage

# S3 method for Bvs
plot(x, option = "dimension", ...)

Value

If option="joint", "conditional" or "not" plot also returns an object of class matrix with the numeric values of the printed probabilities.

Arguments

x

An object of class Bvs

option

One of "dimension", "joint", "conditional", "not" or "trace"

...

Additional graphical parameters to be passed

Author

Gonzalo Garcia-Donato and Anabel Forte

Maintainer: <anabel.forte@uv.es>

Details

If option="dimension" this function returns a barplot of the posterior distribution of the dimension of the true model. If option="joint" an image plot of the joint inclusion probabilities is returned. If option="conditional" an image plot of the conditional inclusion probabilities. These should be read as the probabilty that the variable in the column is part of the true model if the corresponding variables on the row is. If option="not" the image plot that is returned is that of the the probabilty that the variable in the column is part of the true model if the corresponding variables on the row is not. Finally, if option="trace", only available if x$method == "Gibbs", returns a plot of the trace of the inclusion probabilities to check for convergence.

See Also

See Bvs, GibbsBvs for creating objects of the class Bvs.

Examples

Run this code


#Analysis of Crime Data
#load data
data(UScrime)

#Default arguments are Robust prior for the regression parameters
#and constant prior over the model space
#Here we keep the 1000 most probable models a posteriori:
crime.Bvs<- Bvs(formula= y ~ ., data=UScrime, n.keep=1000)

#A look at the results:
crime.Bvs

summary(crime.Bvs)

#A plot with the posterior probabilities of the dimension of the
#true model:
plot(crime.Bvs, option="dimension")

#An image plot of the joint inclusion probabilities:
plot(crime.Bvs, option="joint")

#Two image plots of the conditional inclusion probabilities:
plot(crime.Bvs, option="conditional")
plot(crime.Bvs, option="not")


Run the code above in your browser using DataLab