Compute the predictive squared error loss on *new* testing points
Source:R/source_subsel.R
pp_loss_out.Rd
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.
Arguments
- post_y_pred
S x n
matrix of posterior predictive draws at the givenXX
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 givenXX
covariate 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.