Skip to contents

Use posterior predictive draws at new XX points, compute the predictive squared error loss. The values are computed relative to the largest subset provided, which is typically the full set of covariates (and also the minimizer of the expected predictive loss). These quantities are computed for a collection of linear models that are fit to the Bayesian model output, where each linear model features a different subset of predictors.

Usage

pp_loss_out(post_y_pred, XX, indicators, post_y_hat = NULL)

Arguments

post_y_pred

S x n matrix of posterior predictive draws at the given XX covariate values

XX

n x p matrix of covariates at which to evaluate

indicators

L x p matrix of inclusion indicators (booleans) where each row denotes a candidate subset

post_y_hat

S x n matrix of posterior fitted values at the given XX covariate values

Value

pred_loss: the predictive loss for each subset.

Details

The quantity post_y_hat is the conditional expectation of the response for each covariate value (columns) and using the parameters sampled from the posterior (rows). For Bayesian linear regression, this term is X %*% beta. If unspecified, the algorithm will instead use post_y_pred, which is still correct but has lower Monte Carlo efficiency.