performances: Predictive performance results

View source: R/methods.R

performancesR Documentation

Predictive performance results

Description

Retrieves the predictive performance summaries after running varsel() or cv_varsel(). These summaries are computed by summary.vsel(), so the main method of performances() is performances.vselsummary() (objects of class vselsummary are returned by summary.vsel()). As a shortcut method, performances.vsel() is provided as well (objects of class vsel are returned by varsel() and cv_varsel()). For a graphical representation, see plot.vsel().

Usage

performances(object, ...)

## S3 method for class 'vselsummary'
performances(object, ...)

## S3 method for class 'vsel'
performances(object, ...)

Arguments

object

The object from which to retrieve the predictive performance results. Possible classes may be inferred from the names of the corresponding methods (see also the description).

...

For performances.vsel(): arguments passed to summary.vsel(). For performances.vselsummary(): currently ignored.

Value

An object of class performances which is a list with the following elements:

  • submodels: The predictive performance results for the submodels, as a data.frame.

  • reference_model: The predictive performance results for the reference model, as a named vector.

Examples


# Data:
dat_gauss <- data.frame(y = df_gaussian$y, df_gaussian$x)

# The `stanreg` fit which will be used as the reference model (with small
# values for `chains` and `iter`, but only for technical reasons in this
# example; this is not recommended in general):
fit <- rstanarm::stan_glm(
  y ~ X1 + X2 + X3 + X4 + X5, family = gaussian(), data = dat_gauss,
  QR = TRUE, chains = 2, iter = 500, refresh = 0, seed = 9876
)

# Run varsel() (here without cross-validation, with L1 search, and with small
# values for `nterms_max` and `nclusters_pred`, but only for the sake of
# speed in this example; this is not recommended in general):
vs <- varsel(fit, method = "L1", nterms_max = 3, nclusters_pred = 10,
             seed = 5555)
print(performances(vs))


projpred documentation built on May 29, 2024, 5:31 a.m.