Fit nearest shrunken centroids model.

Description

Wrapped version of the pamr package implementation. Note that this function uses internal cross-validation for determining the value of the shrinkage threshold.

Usage

1
2
fit_pamr(x, y, error_fun, cv, nfold, threshold = NULL, ...,
  thres_fun = function(thr, err) median(thr[err == min(err)]), slim = FALSE)

Arguments

x

Dataset, numerical matrix with observations as rows.

y

Class labels, factor.

error_fun

Error function for tuning.

cv

Cross-validation scheme for shrinkage tuning. It should be supplied on one of the following forms:

  • Resampling scheme produced with resample or resample_holdout.

  • List with elements named nrepeat and nfold

  • NA, NULL or FALSE to suppress shrinkage tuning.

nfold

Sent to pamr.cv. Only used if cv is missing.

threshold

Shrinkage thresholds to try (referred to as 'lambda' in the literature). Chosen and tuned automatically by default, but must be given by the user if not tuned (see the cv argument) if you wish to use it with evaluate.

...

Sent to pamr.train.

thres_fun

Threshold selection function. Note that it is not uncommon that several thresholds will result in the same tuning error.

slim

Set to TRUE if you want to return the fitted classifier but discard pamr's cv.objects, which can be large. memory efficient. This means that the element cv$cv.objects containing the cross-validated fits will be dropped from the returned classifier.

Value

Fitted pamr classifier.

Author(s)

Christofer B├Ącklin

See Also

emil, predict_pamr, importance_pamr, modeling_procedure

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.