Learn R Programming

projpred (version 2.8.0)

cv_proportions: Ranking proportions from fold-wise predictor rankings

Description

Calculates the ranking proportions from the fold-wise predictor rankings in a cross-validation (CV) with fold-wise searches. For a given predictor \(x\) and a given submodel size \(j\), the ranking proportion is the proportion of CV folds which have predictor \(x\) at position \(j\) of their predictor ranking. While these ranking proportions are helpful for investigating variability in the predictor ranking, they can also be cumulated across submodel sizes. The cumulated ranking proportions are more helpful when it comes to model selection.

Usage

cv_proportions(object, ...)

# S3 method for ranking cv_proportions(object, cumulate = FALSE, ...)

# S3 method for vsel cv_proportions(object, ...)

Value

A numeric matrix containing the ranking proportions. This matrix has nterms_max rows and nterms_max columns, with nterms_max as specified in the (possibly implicit) ranking() call. The rows correspond to the submodel sizes and the columns to the predictor terms (sorted according to the full-data predictor ranking). If cumulate is FALSE, then the returned matrix is of class cv_proportions. If cumulate is TRUE, then the returned matrix is of classes cv_proportions_cumul and cv_proportions (in this order).

Note that if cumulate is FALSE, then the values in the returned matrix only need to sum to 1 (column-wise and row-wise) if nterms_max (see above) is equal to the full model size. Likewise, if cumulate is TRUE, then the value 1 only needs to occur in each column of the returned matrix if nterms_max is equal to the full model size.

The cv_proportions() function is only applicable if the ranking object includes fold-wise predictor rankings (i.e., if it is based on a vsel

object created by cv_varsel() with validate_search = TRUE). If the ranking object contains only a full-data predictor ranking (i.e., if it is based on a vsel object created by varsel() or by cv_varsel(), but the latter with validate_search = FALSE), then an error is thrown because in that case, there are no fold-wise predictor rankings from which to calculate ranking proportions.

Arguments

object

For cv_proportions.ranking(): an object of class ranking (returned by ranking()). For cv_proportions.vsel(): an object of class vsel (returned by varsel() or cv_varsel()) that ranking() will be applied to internally before then calling cv_proportions.ranking().

...

For cv_proportions.vsel(): arguments passed to ranking.vsel() and cv_proportions.ranking(). For cv_proportions.ranking(): currently ignored.

cumulate

A single logical value indicating whether the ranking proportions should be cumulated across increasing submodel sizes (TRUE) or not (FALSE).

See Also

plot.cv_proportions()

Examples

Run this code
# For an example, see `?plot.cv_proportions`.

Run the code above in your browser using DataLab