Compute the predictive squared error loss on *new* testing points
Source:R/source_subsel.R
pp_loss_out.RdUse 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.
Arguments
- post_y_pred
S x nmatrix of posterior predictive draws at the givenXXcovariate values- XX
n x pmatrix of covariates at which to evaluate- indicators
L x pmatrix of inclusion indicators (booleans) where each row denotes a candidate subset- post_y_hat
S x nmatrix of posterior fitted values at the givenXXcovariate values
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.