varsel_stats can be used to obtain summary statistics related to variable selection. The same statistics can be plotted with varsel_plot.

varsel_plot(object, nv_max = NULL, stats = "elpd", deltas = F,
  alpha = 0.32, baseline = NULL, ...)

varsel_stats(object, nv_max = NULL, stats = "elpd", type = c("mean",
  "se"), deltas = F, alpha = 0.32, baseline = NULL, ...)



The object returned by varsel or cv_varsel.


Maximum submodel size for which the statistics are calculated.


One or several strings determining which statistics to calculate. Available statistics are:

  • elpd: (Expected) sum of log predictive densities

  • mlpd: Mean log predictive density, that is, elpd divided by the number of datapoints.

  • mse: Mean squared error (gaussian family only)

  • rmse: Root mean squared error (gaussian family only)

  • acc/pctcorr: Classification accuracy (binomial family only)

Default is elpd.


If TRUE, the submodel statistics are estimated relative to the baseline model (see argument baseline) instead of estimating the actual values of the statistics. Defaults to FALSE.


A number indicating the desired coverage of the credible intervals. For example alpha=0.32 corresponds to 68% probability mass within the intervals, that is, one standard error intervals.


Either 'ref' or 'best' indicating whether the baseline is the reference model or the best submodel found. Default is 'ref' when the reference model exists, and 'best' otherwise.


Currently ignored.


One or more items from 'mean', 'se', 'lower' and 'upper' indicating which of these to compute (mean, standard error, and lower and upper credible bounds). The credible bounds are determined so that 1-alpha percent of the mass falls between them.


### Usage with stanreg objects fit <- stan_glm(y~x, binomial())
#> Error in stan_glm(y ~ x, binomial()): could not find function "stan_glm"
vs <- cv_varsel(fit)
#> Error in get_refmodel(fit, ...): object 'fit' not found
#> Error in "vsel" %in% class(object): object 'vs' not found
# print out some stats varsel_stats(vs, stats=c('acc'), type = c('mean','se'))
#> Error in "vsel" %in% class(object): object 'vs' not found