# Plot a distribution of model size

### Description

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

### Usage

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

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

`xlab` |
Label for the horizontal axis. |

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

### Value

Invisibly returns the vector of MCMC draws of model sizes.

### Author(s)

Steven L. Scott

### See Also

`lm.spike`

`plot.lm.spike`

### Examples

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)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.