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