Learn R Programming

BoomSpikeSlab (version 1.2.6)

plot.coefficients: Plot Coefficients.

Description

Produces boxplots showing the marginal distribution of the coefficients.

Usage

PlotLmSpikeCoefficients(
     beta,
     burn = 0,
     inclusion.threshold = 0,
     scale.factors = NULL,
     number.of.variables = NULL,
     ...)

Value

Returns the value from the final call to boxplot.

Arguments

beta

A matrix of model coefficients. Each row represents an MCMC draw. Each column represents a coefficient for a variable.

burn

The number of MCMC iterations in the ojbect to be discarded as burn-in.

inclusion.threshold

Only plot coefficients with posterior inclusion probabilities exceeding this value.

scale.factors

If non-null then a vector of scale factors with which to scale the columns of beta. A NULL value is ignored.

number.of.variables

If non-NULL this specifies the maximum number of coefficients to plot. A NULL value is ignored.

...

Additional arguments to be passed to boxplot.

Author

Steven L. Scott

See Also

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 = 1){
  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, "coef", inclusion.threshold = .01)

Run the code above in your browser using DataLab