BoomSpikeSlab (version 1.2.6)

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 lm.spike
plot(x,
     y = c("inclusion", "coefficients", "scaled.coefficients",
              "residuals", "fit", "size", "help"),
     burn = SuggestBurnLogLikelihood(x$log.likelihood),
     ...)

Arguments

x

An object of class lm.spike.

y

The type of plot desired.

burn

The number of MCMC iterations to discard as burn-in.

...

Additional arguments passed to the specific functions that do the plotting.

Author

Steven L. Scott

Details

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

See Also

PlotMarginalInclusionProbabilities PlotLmSpikeCoefficients PlotLmSpikeResiduals 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