Learn R Programming

BoomSpikeSlab (version 0.5.3)

plot.lm.spike: Plot the results of a spike and slab regression.

Description

The default plot is a barplot of the marginal inclusion probabilities for each variable, as obtained by PlotMarginalInclusionProbabilities. Other interesting plots can be obtained by supplying a string as the second argument.

Usage

## S3 method for class 'lm.spike':
plot(x, y = c("coefficients", "size", "help"), ...)

Arguments

x
An object of class lm.spike.
y
The type of plot desired.
...
Additional arguments passed to the specific functions that do the plotting.

Details

The actual plotting will be handled by PlotMarginalInclusionProbabilities or PlotModelSize. See the appropriate function for more options.

See Also

PlotMarginalInclusionProbabilities PlotModelSize lm.spike SpikeSlabPrior summary.lm.spike predict.lm.spike

Examples

Run this code
simulate.lm.spike <- function(n = 100, p = 10, ngood = 3, niter=1000, sigma = 8){
  x <- cbind(matrix(rnorm(n * (p-1)), nrow=n))
  beta <- c(rnorm(ngood), rep(0, p - ngood))
  y <- rnorm(n, beta[1] + x %*% beta[-1], sigma)
  draws <- lm.spike(y ~ x, niter=niter)
  return(invisible(draws))
}
model <- simulate.lm.spike(n = 1000, p = 50, sigma = .3)
plot(model, inclusion.threshold = .01)

plot(model, "size")

Run the code above in your browser using DataLab