looprun evaluates simple stopping criteria for the S3VS procedure and returns an indicator of whether one more iteration should be executed.

looprun(varsselected, varsleft, max_nocollect, m, nskip)

Arguments

varsselected

Character vector with names of predictors selected so far. Only its length is used; NULL is treated as length 0.

varsleft

Character vector with names of candidate predictors that remain available for selection in future iterations. Only its length is used; NULL is treated as length 0.

max_nocollect

Integer count of iterations up to now in which no new predictors were selected.

m

Maximum allowed number of selected predictors (target cap for length(varsselected)).

nskip

Maximum allowed number of "no-collection" iterations before stopping.

Details

An additional S3VS iteration is recommended iff all three conditions hold: $$|\texttt{varsselected}| < m,$$ $$|\texttt{varsleft}| > 0,$$ $$\texttt{max\_nocollect} < \texttt{nskip}.$$

Value

1 if another iteration should run, 0 otherwise.

Author

Nilotpal Sanyal <nsanyal@utep.edu>, Padmore N. Prempeh <pprempeh@albany.edu>

Examples

looprun(varsselected = c("x1","x2","x3"),
        varsleft     = paste0("x", 4:23),
        max_nocollect = 0,
        m = 10,
        nskip = 2)
#> [1] 1