Usage
knncat (train, test, k = c(1, 3, 5, 7, 9), xvals = 10, xval.ceil = -1, knots = 10, prior.ind = 4, prior, permute = 10, permute.tail = 1, improvement = .01, ridge = .003, once.out.always.out = FALSE, classcol = 1, verbose = 0)
Arguments
train
data frame of training data, with the correct classification
in the classcol column
test
data frame of test data (can be omitted). This should have
the correct classification in the classcol column, too.
k
vector of choices for number of nn's. Default c(1, 3, 5, 7, 9).
xvals
number of cross-validations to use to find the best model
size and number of nn's. Default 10.
xval.ceil
Maximum number of variables to add. -1 = Use the smallest
number from any xval; 0 = use the smallest number from the
first xval; >= 0, use that.
knots
vector of number of knots for numeric variables. Reused if
necessary. Default: 10 for each.
prior.ind
Integer telling how to compute priors. 1 = estimated from
training set; 2 = all equal; 3 = supplied in "prior"; 4 = ignored. Default: 4.
prior
Numeric vector, one entry per unique element in the training
set's classcol column, giving prior probabilities. Ignored unless
prior.ind = 3; then they're normalized to sum to 1 and each
entry must be strictly > 0.
permute
Number of permutations for variable selection. Default: 10.
permute.tail
A variable fails the permutation test if permute.tail or
more permutations do better than the original. Default: 1.
improvement
Minimum improvement for variable selection. Ignored unless
present and permute missing, or permute = 0; then default = .01.
ridge
Amount by which to "ridge" the W matrix for numerical
stability. Default: .003.
once.out.always.out
if TRUE, a variable that fails a permutation test
or doesn't improve by enough is excluded from further consideration during
that cross-validation run. Default FALSE.
classcol
Column with classification in it. Default: 1.
verbose
Controls level of diagnostic output. Higher numbers produce
more output, sometimes 'way too much. 0 produces no output; 1 gives progress
report for xvals. Default: 1.