Learn R Programming

mclust (version 2.1-14)

summary.mclustDAtest: Classification and posterior probability from mclustDAtest.

Description

Classifications from mclustDAtest and the corresponding posterior probabilities.

Usage

summary.mclustDAtest(object, pro, ...)

Arguments

object
The output of mclustDAtest.
pro
Prior probabilities for each class in the training data.
...
Not used. For generic/method consistency.

Value

  • A list with the following two components:
  • classficationThe classification from mclustDAtest
  • zMatrix of posterior probabilities in which the [i,j]th entry is the probability of observation i belonging to class j.

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

mclustDAtest

Examples

Run this code
set.seed(0)
n <- 100 ## create artificial data

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))
par(pty = "s")
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 <- seq(1, 2*n, 2)
test <- mclustDAtest(x[even, ], train) ## compute model densities
testSummary <- summary(test) ## classify training set

names(testSummary)
testSummary$class
testSummary$z

Run the code above in your browser using DataLab