plot.lm.spike {BoomSpikeSlab} | R Documentation |
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("inclusion", "coefficients", "scaled.coefficients",
"residuals", "fit", "size", "help"),
burn = SuggestBurnLogLikelihood(x$log.likelihood),
...)
Arguments
x |
An object of class |
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. |
Details
The actual plotting will be handled by
PlotMarginalInclusionProbabilities
,
PlotLmSpikeCoefficients
,
PlotLmSpikeResiduals
, or PlotModelSize
.
See the appropriate function for more options.
Author(s)
Steven L. Scott
See Also
PlotMarginalInclusionProbabilities
PlotLmSpikeCoefficients
PlotLmSpikeResiduals
PlotModelSize
lm.spike
SpikeSlabPrior
summary.lm.spike
predict.lm.spike
Examples
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")