【发布时间】:2018-07-24 08:16:50
【问题描述】:
BoomSpikeSlab 模型的默认 plot 函数是每个预测变量包含概率的条形图,并根据其为正的概率着色:
set.seed(0)
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, inclusion.threshold=.01)
如何提取此图背后的数据,即具有每个预测变量的包含概率和为正概率的数据框?
【问题讨论】:
标签: r statistics