R/estimates.r
regdiscrim_estimates.Rd
Computes the maximum likelihood estimators (MLEs) for each class under the assumption of multivariate normality for each class. Also, computes ancillary information necessary for classifier summary, such as sample size, the number of features, etc.
regdiscrim_estimates(x, y, cov = TRUE, prior = NULL)
x | Matrix or data frame containing the training data. The rows are the sample observations, and the columns are the features. Only complete data are retained. |
---|---|
y | vector of class labels for each training observation |
cov | logical. Should the sample covariance matrices be computed? (Default: yes) |
prior | vector with prior probabilities for each class. If NULL (default), then the sample proportions are used. See details. |
named list with estimators for each class and necessary ancillary information
This function computes the common estimates and ancillary information used in
all of the regularized discriminant classifiers in the sparsediscrim
package.
The matrix of training observations are given in x
. The rows of x
contain the sample observations, and the columns contain the features for each
training observation.
The vector of class labels given in y
are coerced to a factor
.
The length of y
should match the number of rows in x
.
An error is thrown if a given class has less than 2 observations because the variance for each feature within a class cannot be estimated with less than 2 observations.
The vector, prior
, contains the a priori class membership for
each class. If prior
is NULL (default), the class membership
probabilities are estimated as the sample proportion of observations belonging
to each class. Otherwise, prior
should be a vector with the same length
as the number of classes in y
. The prior
probabilities should be
nonnegative and sum to one.