Skip to contents

These functions are passed to cv(model, ...) via the argument iter in case of an iteratively fitted model (see ifm).

By default, iter=crit_min().

  • crit_min() selects the iteration with minimal test error.

  • crit_last() selects the last iteration.

  • crit_first() selects the first iteration.

  • crit_iter(iter) selects iterth iteration.

  • crit_se(factor) selects the iteration with minimal test error among those where the test error does not exceed the minimal test error by more than factor standard errors.

  • crit_overfit(ratio) selects the iteration with minimal test error among those where the ratio of training and test error does not fall below ratio.

  • crit_list(...) combines several criteria, as in crit_list(crit_min(), crit_se()). Writing c(...) with ... being a number of criteria is equivalent with crit_list(...).

Usage

crit_min(label_suffix = "min")

crit_last(label_suffix = "last")

crit_first(label_suffix = "first")

crit_iter(iter, label_suffix = paste0("iter", iter))

crit_se(factor = 1, label_suffix = paste0(factor, "se"), warn = TRUE)

crit_overfit(ratio = 0.9, label_suffix = paste0("overfit", ratio), warn = TRUE)

crit_list(...)

Arguments

label_suffix

Suffix used to create label.

iter

Number of iteration

factor

Factor applied to standard error.

warn

Logical: Whether to warn in case of an invalid input.

ratio

Ratio of training and test error.

...

Enumeration of criteria.

Value

These functions return an object inheriting of class “def_crit”.

Examples

crit_min()
#> Preference criterion for an iteratively fitted model:
#>   criterion:     crit_min()
#>   label suffix:  “min”
#>   Selects the iteration with minimal test error.
crit_last()
#> Preference criterion for an iteratively fitted model:
#>   criterion:     crit_last()
#>   label suffix:  “last”
#>   Selects the last iteration.
crit_iter(20)
#> Preference criterion for an iteratively fitted model:
#>   criterion:     crit_iter(20)
#>   label suffix:  “iter20”
#>   Selects iteration number min{20, # of iterations}.
crit_iter(c(10, 20)) 
#> 2 preference criteria for an iteratively fitted model:
#> 
#>   criterion:     crit_iter(10)
#>   label suffix:  “iter10”
#>   Selects iteration number min{10, # of iterations}.
#> 
#>   criterion:     crit_iter(20)
#>   label suffix:  “iter20”
#>   Selects iteration number min{20, # of iterations}.
crit_se(2)
#> Preference criterion for an iteratively fitted model:
#>   criterion:     crit_se(2)
#>   label suffix:  “2se”
#>   Selects the first iteration where test error does not exceed
#>     the minimal test error by more than 2 standard errors.
crit_overfit()
#> Preference criterion for an iteratively fitted model:
#>   criterion:     crit_overfit(0.9)
#>   label suffix:  “overfit0.9”
#>   Selects the iteration with minimal test error among those where
#>   the ratio of training and test error does not fall below 0.9.
crit_overfit(c(1, .9, .8))
#> 3 preference criteria for an iteratively fitted model:
#> 
#>   criterion:     crit_overfit(1)
#>   label suffix:  “overfit1”
#>   Selects the iteration with minimal test error among those where
#>   the ratio of training and test error does not fall below 1.
#> 
#>   criterion:     crit_overfit(0.9)
#>   label suffix:  “overfit0.9”
#>   Selects the iteration with minimal test error among those where
#>   the ratio of training and test error does not fall below 0.9.
#> 
#>   criterion:     crit_overfit(0.8)
#>   label suffix:  “overfit0.8”
#>   Selects the iteration with minimal test error among those where
#>   the ratio of training and test error does not fall below 0.8.

# combine criteria with either crit_list() or c():
crit_list(crit_first(), crit_last())
#> 2 preference criteria for an iteratively fitted model:
#> 
#>   criterion:     crit_first()
#>   label suffix:  “first”
#>   Selects the first iteration.
#> 
#>   criterion:     crit_last()
#>   label suffix:  “last”
#>   Selects the last iteration.
c(crit_first(), crit_last())    # the same
#> 2 preference criteria for an iteratively fitted model:
#> 
#>   criterion:     crit_first()
#>   label suffix:  “first”
#>   Selects the first iteration.
#> 
#>   criterion:     crit_last()
#>   label suffix:  “last”
#>   Selects the last iteration.