View source: R/stacking_weights.R
get_stacking_weights | R Documentation |
Obtains optimal stacking weights given leave-one-out predictive densities for each candidate model.
get_stacking_weights(log_loopd, solver = "ECOS")
log_loopd |
an |
solver |
specifies the solver to use for obtaining optimal weights.
Default is |
A list of length 2.
weights
optimal stacking weights as a numeric vector of
length M
status
solver status, returns "optimal"
if solver
succeeded.
Soumyakanti Pan span18@ucla.edu,
Sudipto Banerjee sudipto@ucla.edu
Yao Y, Vehtari A, Simpson D, Gelman A (2018). "Using Stacking to Average Bayesian Predictive Distributions (with Discussion)." Bayesian Analysis, 13(3), 917-1007. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/17-BA1091")}.
CVXR::psolve()
, spLMstack()
, spGLMstack()
set.seed(1234)
data(simGaussian)
dat <- simGaussian[1:100, ]
mod1 <- spLMstack(y ~ x1, data = dat,
coords = as.matrix(dat[, c("s1", "s2")]),
cor.fn = "matern",
params.list = list(phi = c(1.5, 3),
nu = c(0.5, 1),
noise_sp_ratio = c(1)),
n.samples = 1000, loopd.method = "exact",
parallel = FALSE, solver = "ECOS", verbose = TRUE)
loopd_mat <- do.call('cbind', mod1$loopd)
w_hat <- get_stacking_weights(loopd_mat)
print(round(w_hat$weights, 4))
print(w_hat$status)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.