Learn R Programming

mclust (version 2.1-14)

mclustDAtrain: MclustDA Training

Description

Training phase for MclustDA discriminant analysis.

Usage

mclustDAtrain(data, labels, G, emModelNames, eps, tol, itmax, 
              equalPro, warnSingular, verbose)

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 Gaussian mixture components (clusters) for which the BIC is to be calculated (the same specification is used for all classes). Default: 1:9.
emModelNames
A vector of character strings indicating the models to be fitted in the EM phase of clustering. Possible models: "E" for spherical, equal variance (one-dimensional) "V" for spherical, variable variance (one-dimensional) "EII": spherical, equal volum
eps
A scalar tolerance for deciding when to terminate computations due to computational singularity in covariances. Smaller values of eps allow computations to proceed nearer to singularity. The default is .Mclust$eps.
tol
A scalar tolerance for relative convergence of the loglikelihood. The default is .Mclust$tol.
itmax
An integer limit on the number of EM iterations. The default is .Mclust$itmax.
equalPro
Logical variable indicating whether or not the mixing proportions are equal in the model. The default is .Mclust$equalPro.
warnSingular
A logical value indicating whether or not a warning should be issued whenever a singularity is encountered. The default is warnSingular=FALSE.
verbose
A logical value indicating whether or not to print the models and numbers of components for each class. Default:verbose=TRUE.

Value

  • A list in which each element gives the optimal parameters for the model best fitting each class according to BIC.

References

C. Fraley and A. E. Raftery (2002a). Model-based clustering, discriminant analysis, and density estimation. Journal of the American Statistical Association 97:611-631. See http://www.stat.washington.edu/mclust. C. Fraley and A. E. Raftery (2002b). MCLUST:Software for model-based clustering, density estimation and discriminant analysis. Technical Report, Department of Statistics, University of Washington. See http://www.stat.washington.edu/mclust.

See Also

summary.mclustDAtrain, mclustDAtest, EMclust, hc, mclustOptions

Examples

Run this code
n <- 250 ## create artificial data
set.seed(0)
par(pty = "s")
x <- rbind(matrix(rnorm(n*2), n, 2) %*% diag(c(1,9)),
           matrix(rnorm(n*2), n, 2) %*% diag(c(1,9))[,2:1])
xclass <- c(rep(1,n),rep(2,n))
mclust2Dplot(x, classification = xclass, type="classification", ask=FALSE)

odd <- seq(1, 2*n, 2)
train <- mclustDAtrain(x[odd, ], labels = xclass[odd]) ## training step
summary(train)

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

Run the code above in your browser using DataLab