Cross-validation Method for a discrim Object

DESCRIPTION:

Compute leave-one-out cross-validation of a discrim object estimating a discriminant function.

USAGE:

crossvalidate.discrim(object, doubt=0, digits=.Options$digits, recompute=F,
                      trace=T, subset)

REQUIRED ARGUMENTS:

object
the discrim object constructed by the discrim function containing the estimated discriminant function.

OPTIONAL ARGUMENTS:

doubt
a numeric variable, 0 <= doubt < (g-1)/g, where g is the number of groups, defining the minimum difference the maximum posterior probability of group membership must exceed all others before assigning the observation to that group. If there does not exist a posterior probability of group membership for an observation that exceeds doubt + 1/g, the observation is assigned to an "unknown" group.
digits
the number of significant digits to retain in the posterior probability. Rounding the posterior probabilities is done mostly for printing purposes.
recompute
a logical flag that must be T for covariance models where cross-validation can only be computed by refitting the discriminant function. This "brute force" method is potentially time consuming so the default for recompute is F, where an error is issued to warn the user of this condition.
trace
a logical flag for printing trace information when cross-validation must be carried out by refitting the discriminant function for each observation omitted from the dataset. A classification table is printed for every 10 iterations.
subset
an integer or logical vector specifying which observations to cross-validate. This variable is only used if the "brute force" approach to cross-validation is used.

VALUE:

an n x (g+1) data.frame, where n is the number of observations and g is the number of groups, containing a group factor column followed by the posterior probability of group membership for each observation in the training data used to fit the discriminant function.

DETAILS:

Performs cross-validation of the discriminant function contained in object. Formulas exist for evaluating the posterior probability of group membership for this leave-one-out method of error rate evaluation without recomputing the discriminant function for the Classical homoscedastic and heteroscedastic models (McLachlan, 1992, p.341-344) and (Ripley, 1996, p.100) and can be evaluated in a timely manner. The S code that evaluates these functions is based on Venables and Ripley's (1997) lda and qda functions with CV = T. The spherical and group spherical covariance structure models can be computed with out refitting the discriminant function also. Discriminant functions using the remaining covariance structures described in the help documentation for the discrim function must recompute the function in order to evaluate the leave-one-out error rate and can take considerable amount of time.

REFERENCES:



McLachlan, G. J. (1992). Discriminant Analysis and Statistical Pattern Recognition, John Wiley & Sons.

Ripley, B.D. (1996). Pattern Recognition and Neural Networks, Cambridge University Press.

Venables, W.N. and Ripley, B.D. (1997). Modern Applied Statistics with S-PLUS, Second Ed., Springer.

SEE ALSO:

, , , , .

EXAMPLES:

# The Iris data
iris.quad <- discrim(Species ~ Sepal.L. + Sepal.W. + Petal.L. + Petal.W.,
     data=iris.mm, family=Classical("heter"))
cv <- crossvalidate(iris.quad)
cv[sort(sample(seq(150),15)),]
table(Iris.mm$Sp,cv$group)