Learn R Programming

mclust (version 3.5)

mclustDAtrain: MclustDA Training

Description

Training phase for MclustDA discriminant analysis.

Usage

mclustDAtrain(data, labels, G=NULL, modelNames=NULL, prior=NULL, 
              control=emControl(), initialization=NULL, warn=FALSE, 
              verbose=TRUE, ...)

Arguments

data
A numeric vector, matrix, or data frame of observations. Categorical variables are not allowed. If a matrix or data frame, rows correspond to observations and columns correspond to variables.
labels
A numeric or character vector assigning a class label to each observation.
G
An integer vector specifying the numbers of mixture components (clusters) for which the BIC is to be calculated. The default is G=1:9.
modelNames
A vector of character strings indicating the models to be fitted in the EM phase of clustering. The help file for mclustModelNames describes the available models. The default is c("E", "V") for univariate data and
prior
The default assumes no prior, but this argument allows specification of a conjugate prior on the means and variances through the function priorControl.
control
A list of control parameters for EM. The defaults are set by the call emControl().
initialization
A list containing zero or more of the following components:
  • hcPairs
{ A matrix of merge pairs for hierarchical clustering such as produced by function hc. The default is to compute a hierarchical clustering tree

Value

  • A list in which each element gives the parameters and other summary information for the model best fitting each class according to BIC. Attributes are the input parameters other than data, labels and verbose.

item

  • warn
  • verbose
  • ...

code

do.call

References

C. Fraley and A. E. Raftery (2002). Model-based clustering, discriminant analysis, and density estimation. Journal of the American Statistical Association 97:611-631.

C. Fraley and A. E. Raftery (2006). MCLUST Version 3 for R: Normal Mixture Modeling and Model-Based Clustering, Technical Report no. 504, Department of Statistics, University of Washington.

Details

Except for labels and verbose, the arguments are the same as those for mclustBIC.

See Also

summary.mclustDAtrain, mclustDAtest, mclustBIC

Examples

Run this code
odd <- seq(1, nrow(cross), by = 2)
train <- mclustDAtrain(cross[odd,-1], labels = cross[odd,1]) ## training step
summary(train)

even <- odd + 1
test <- mclustDAtest(cross[even,-1], train) ## compute model densities
clEven <- summary(test)$class ## classify training set
classError(clEven,cross[even,1])

Run the code above in your browser using DataLab