plot.coefficients: Plot Coefficients.

plot.coefficientsR Documentation

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,
     ...)

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.

Value

Returns the value from the final call to boxplot.

Author(s)

Steven L. Scott

See Also

lm.spike SpikeSlabPrior summary.lm.spike predict.lm.spike

Examples

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)

BoomSpikeSlab documentation built on May 29, 2024, 5:07 a.m.