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, ...)

Arguments

object

The object returned by varsel or cv_varsel.

nv_max

Maximum submodel size for which the statistics are calculated.

stats

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.

deltas

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.

alpha

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.

baseline

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.

type

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.

Examples

### 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
varsel_plot(vs)
#> 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