Plot marginal inclusion probabilities.

Produces a histogram of number of nonzero coefficients in a spike-and-slab regression.

1 | ```
PlotModelSize(beta, burn = 0, xlab= "Number of nonzero coefficients", ...)
``` |

`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 to be discarded as burn-in. |

`xlab` |
Label for the horizontal axis. |

`...` |
Additional arguments to be passed to |

Invisibly returns the vector of MCMC draws of model sizes.

Steven L. Scott

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
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)
# To get the plot of model size directly.
PlotModelSize(model$beta, burn = 10)
# Another way to get the same plot.
plot(model, "size", burn = 10)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.