This fixes a bug for the augmented-data projection in combination with subsampled PSIS-LOO CV: When subsetting the rows of an augmented-rows matrix (class augmat) or the elements of an augmented-length vector (class augvec), attribute nobs_orig was not adapted, so by this PR, it is adapted correctly.
Reprex:
data(inhaler, package = "brms")
inhaler$rating <- paste0("rtg", inhaler$rating)
inhaler$rating <- as.factor(inhaler$rating)
library(rstanarm)
rfit <- stan_polr(rating ~ period + carry + treat,
data = inhaler,
prior = R2(location = 0.5, what = "median"),
chains = 1,
iter = 500,
seed = 1140350788,
refresh = 0)
### If the desired version is not installed:
devtools::load_all(".")
###
### If the desired version is installed:
# library(projpred)
###
cvvs <- cv_varsel(rfit,
validate_search = FALSE,
nloo = 141,
nclusters = 3,
nclusters_pred = 5,
nterms_max = 2,
seed = 46782345)
Previously (i.e., before this PR), this reprex failed (with Error in augmat2arr(mu) : is_wholenumber(n_discr) is not TRUE). With this PR, this reprex runs through.
Nevertheless, subsampled PSIS-LOO CV is still an experimental feature, see #94.
This fixes a bug for the augmented-data projection in combination with subsampled PSIS-LOO CV: When subsetting the rows of an augmented-rows matrix (class
augmat
) or the elements of an augmented-length vector (classaugvec
), attributenobs_orig
was not adapted, so by this PR, it is adapted correctly.Reprex:
Previously (i.e., before this PR), this reprex failed (with
Error in augmat2arr(mu) : is_wholenumber(n_discr) is not TRUE
). With this PR, this reprex runs through.Nevertheless, subsampled PSIS-LOO CV is still an experimental feature, see #94.