Err {sglOptim} | R Documentation

## Generic function for computing error rates

### Description

Compute and returns an error rate for each model contained in `x`. See details for generic use cases.

### Usage

    Err(object, data, response, ...)

### Arguments

`object` | an object
`data` | a data object
`response` | a response object
`...` | additional parameters (optional)

### Details

The following generic use case should be supported (see for example msgl package for an implementation):

1. With `fit` a sgl fit object with models estimated using `x` data, the code

   `Err(fit, x)`

   should return a vector with the training errors of the models.

2. With `x.new` a new data set with known responses `response.new`, the code

   `Err(fit, x.new, response.new)`

   should return a vector with the errors of the models when applied to the new data set.

3. With `fit.cv` a sgl cross validation object, the code

   `Err(fit.cv)`

   should return a vector with estimates of the expected generalization errors of the models (i.e. the cross validation errors).

4. If subsampling is supported then, with `fit.sub` a sgl subsampling object, the code

   `Err(fit.sub)`

   should return a matrix with the test errors (each column corresponding to a model, i.e. rows corresponds to tests).

### Value

a vector of length `nmod(object)` or a matrix with `nmod(object)` columns containing error rates for the models

### Author(s)

Martin Vincent

### See Also

compute_error

[Package sglOptim version 1.3.8 Index]