BPS_weights_MvT: Compute the BPS weights by convex optimization

View source: R/RcppExports.R

BPS_weights_MvTR Documentation

Compute the BPS weights by convex optimization

Description

Compute the BPS weights by convex optimization

Usage

BPS_weights_MvT(data, priors, coords, hyperpar, K)

Arguments

data

list two elements: first named Y, second named X

priors

list priors: named \mu_B,V_r,\Psi,\nu

coords

matrix sample coordinates for X and Y

hyperpar

list two elemets: first named \alpha, second named \phi

K

integer number of folds

Value

matrix posterior predictive density evaluations (each columns represent a different model)

Examples


## Generate subsets of data
n <- 100
p <- 3
q <- 2
X <- matrix(rnorm(n*p), nrow = n, ncol = p)
Y <- matrix(rnorm(n*q), nrow = n, ncol = q)
crd <- matrix(runif(n*2), nrow = n, ncol = 2)

## Select competitive set of values for hyperparameters
alfa_seq <- c(0.7, 0.8, 0.9)
phi_seq <- c(3, 4, 5)

## Perform Bayesian Predictive Stacking within subsets
bps <- spBPS::BPS_weights_MvT(data = list(Y = Y, X = X),
                              priors = list(mu_B = matrix(0, nrow = p, ncol = q),
                                            V_r = diag(10, p),
                                            Psi = diag(1, q),
                                            nu = 3), coords = crd,
                                            hyperpar = list(alpha = alfa_seq,
                                                            phi = phi_seq),
                                            K = 5)



spBPS documentation built on Oct. 25, 2024, 5:07 p.m.