mclustModel: Best model based on BIC

Description Usage Arguments Value See Also Examples

View source: R/mclust.R

Description

Determines the best model from clustering via mclustBIC for a given set of model parameterizations and numbers of components.

Usage

1
mclustModel(data, BICvalues, G, modelNames, ...)

Arguments

data

The matrix or vector of observations used to generate ‘object’.

BICvalues

An 'mclustBIC' object, which is the result of applying mclustBIC to data.

G

A vector of integers giving the numbers of mixture components (clusters) from which the best model according to BIC will be selected (as.character(G) must be a subset of the row names of BICvalues). The default is to select the best model for all numbers of mixture components used to obtain BICvalues.

modelNames

A vector of integers giving the model parameterizations from which the best model according to BIC will be selected (as.character(model) must be a subset of the column names of BICvalues). The default is to select the best model for parameterizations used to obtain BICvalues.

...

Not used. For generic/method consistency.

Value

A list giving the optimal (according to BIC) parameters, conditional probabilities z, and log-likelihood, together with the associated classification and its uncertainty.

The details of the output components are as follows:

modelName

A character string indicating the model. The help file for mclustModelNames describes the available models.

n

The number of observations in the data.

d

The dimension of the data.

G

The number of components in the Gaussian mixture model corresponding to the optimal BIC.

bic

The optimal BIC value.

loglik

The log-likelihood corresponding to the optimal BIC.

parameters

A list with the following components:

pro

A vector whose kth component is the mixing proportion for the kth component of the mixture model. If missing, equal proportions are assumed.

mean

The mean for each component. If there is more than one component, this is a matrix whose kth column is the mean of the kth component of the mixture model.

variance

A list of variance parameters for the model. The components of this list depend on the model specification. See the help file for mclustVariance for details.

Vinv

The estimate of the reciprocal hypervolume of the data region used in the computation when the input indicates the addition of a noise component to the model.

z

A matrix whose [i,k]th entry is the probability that observation i in the test data belongs to the kth class.

See Also

mclustBIC

Examples

1
2
3
irisBIC <- mclustBIC(iris[,-5])
mclustModel(iris[,-5], irisBIC)
mclustModel(iris[,-5], irisBIC, G = 1:6, modelNames = c("VII", "VVI", "VVV"))

Example output

Package 'mclust' version 5.3
Type 'citation("mclust")' for citing this R package in publications.
$modelName
[1] "VEV"

$n
[1] 150

$d
[1] 4

$G
[1] 2

$bic
[1] -561.7285

$loglik
[1] -215.726

$parameters
$parameters$pro
[1] 0.333332 0.666668

$parameters$mean
                  [,1]     [,2]
Sepal.Length 5.0060021 6.261996
Sepal.Width  3.4280046 2.871999
Petal.Length 1.4620006 4.905993
Petal.Width  0.2459998 1.675997

$parameters$variance
$parameters$variance$modelName
[1] "VEV"

$parameters$variance$d
[1] 4

$parameters$variance$G
[1] 2

$parameters$variance$sigma
, , 1

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length   0.15065097  0.13080108  0.020844624 0.013091029
Sepal.Width    0.13080108  0.17604544  0.016032479 0.012214539
Petal.Length   0.02084462  0.01603248  0.028082603 0.006015675
Petal.Width    0.01309103  0.01221454  0.006015675 0.010423651

, , 2

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length    0.4000437  0.10865439    0.3994013  0.14368238
Sepal.Width     0.1086544  0.10928074    0.1238902  0.07284378
Petal.Length    0.3994013  0.12389025    0.6109012  0.25738947
Petal.Width     0.1436824  0.07284378    0.2573895  0.16808166


$parameters$variance$scale
[1] 0.03772382 0.13307644

$parameters$variance$shape
[1] 7.9106903 0.9228736 0.6299552 0.2174371

$parameters$variance$orientation
, , 1

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length  -0.66908521   0.5978667   -0.4399764 -0.03607235
Sepal.Width   -0.73414150  -0.6206715    0.2746283 -0.01955806
Petal.Length  -0.09654303   0.4900796    0.8324347 -0.23990386
Petal.Width   -0.06356640   0.1309367    0.1950705  0.96992907

, , 2

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length    0.5565151  0.75863415 -0.006116625  -0.3387149
Sepal.Width     0.1865006  0.02937334 -0.901899603   0.3884995
Petal.Length    0.7428956 -0.33350447  0.344100714   0.4674137
Petal.Width     0.3218922 -0.55891520 -0.261025652  -0.7182373



$parameters$Vinv
NULL


$z
                [,1]         [,2]
  [1,]  1.000000e+00 2.513157e-11
  [2,]  9.999999e-01 5.556411e-08
  [3,]  1.000000e+00 3.635438e-09
  [4,]  9.999999e-01 8.611811e-08
  [5,]  1.000000e+00 8.504494e-12
  [6,]  1.000000e+00 1.400364e-12
  [7,]  1.000000e+00 2.971650e-09
  [8,]  1.000000e+00 4.052951e-10
  [9,]  9.999993e-01 6.585295e-07
 [10,]  9.999999e-01 7.275844e-08
 [11,]  1.000000e+00 1.189551e-12
 [12,]  1.000000e+00 3.285857e-09
 [13,]  9.999999e-01 1.034956e-07
 [14,]  9.999998e-01 1.791880e-07
 [15,]  1.000000e+00 2.623115e-16
 [16,]  1.000000e+00 1.664927e-18
 [17,]  1.000000e+00 2.856982e-14
 [18,]  1.000000e+00 3.517450e-11
 [19,]  1.000000e+00 2.111071e-12
 [20,]  1.000000e+00 9.844806e-13
 [21,]  1.000000e+00 6.254257e-09
 [22,]  1.000000e+00 1.579143e-11
 [23,]  1.000000e+00 1.159088e-10
 [24,]  9.999995e-01 4.953746e-07
 [25,]  9.999989e-01 1.061678e-06
 [26,]  9.999994e-01 5.953849e-07
 [27,]  1.000000e+00 6.015441e-09
 [28,]  1.000000e+00 5.309697e-11
 [29,]  1.000000e+00 1.021487e-10
 [30,]  9.999999e-01 6.263544e-08
 [31,]  9.999998e-01 1.604430e-07
 [32,]  1.000000e+00 6.134170e-10
 [33,]  1.000000e+00 5.533936e-15
 [34,]  1.000000e+00 3.164980e-17
 [35,]  1.000000e+00 3.683124e-08
 [36,]  1.000000e+00 1.058309e-09
 [37,]  1.000000e+00 9.055077e-12
 [38,]  1.000000e+00 2.144895e-11
 [39,]  9.999999e-01 1.445697e-07
 [40,]  1.000000e+00 3.176616e-10
 [41,]  1.000000e+00 3.224099e-11
 [42,]  9.997974e-01 2.025599e-04
 [43,]  1.000000e+00 2.424785e-08
 [44,]  9.999997e-01 3.077476e-07
 [45,]  1.000000e+00 2.213430e-09
 [46,]  9.999999e-01 9.248426e-08
 [47,]  1.000000e+00 2.393892e-12
 [48,]  1.000000e+00 1.123846e-08
 [49,]  1.000000e+00 1.458938e-12
 [50,]  1.000000e+00 6.608479e-10
 [51,]  5.013980e-97 1.000000e+00
 [52,]  1.064140e-88 1.000000e+00
 [53,] 2.002770e-110 1.000000e+00
 [54,]  2.021080e-68 1.000000e+00
 [55,]  5.251133e-98 1.000000e+00
 [56,]  5.873868e-85 1.000000e+00
 [57,] 4.044792e-100 1.000000e+00
 [58,]  3.693071e-36 1.000000e+00
 [59,]  1.711080e-91 1.000000e+00
 [60,]  2.496554e-65 1.000000e+00
 [61,]  1.718720e-44 1.000000e+00
 [62,]  1.255525e-77 1.000000e+00
 [63,]  1.580958e-64 1.000000e+00
 [64,]  6.715566e-97 1.000000e+00
 [65,]  3.284335e-50 1.000000e+00
 [66,]  2.488900e-83 1.000000e+00
 [67,]  5.063960e-90 1.000000e+00
 [68,]  2.135003e-62 1.000000e+00
 [69,]  9.314071e-99 1.000000e+00
 [70,]  5.368295e-58 1.000000e+00
 [71,] 1.593204e-114 1.000000e+00
 [72,]  1.544294e-65 1.000000e+00
 [73,] 1.093600e-114 1.000000e+00
 [74,]  1.254395e-92 1.000000e+00
 [75,]  2.218343e-77 1.000000e+00
 [76,]  4.064993e-84 1.000000e+00
 [77,] 5.126120e-106 1.000000e+00
 [78,] 8.081674e-123 1.000000e+00
 [79,]  5.062634e-91 1.000000e+00
 [80,]  8.744350e-42 1.000000e+00
 [81,]  5.435104e-55 1.000000e+00
 [82,]  2.182435e-49 1.000000e+00
 [83,]  3.129452e-59 1.000000e+00
 [84,] 3.734366e-125 1.000000e+00
 [85,]  2.775916e-90 1.000000e+00
 [86,]  2.764258e-90 1.000000e+00
 [87,] 7.510216e-100 1.000000e+00
 [88,]  5.994859e-88 1.000000e+00
 [89,]  8.912424e-67 1.000000e+00
 [90,]  7.231915e-67 1.000000e+00
 [91,]  3.262293e-79 1.000000e+00
 [92,]  2.747464e-91 1.000000e+00
 [93,]  8.120655e-64 1.000000e+00
 [94,]  8.983566e-37 1.000000e+00
 [95,]  4.355435e-73 1.000000e+00
 [96,]  7.803994e-68 1.000000e+00
 [97,]  1.572729e-71 1.000000e+00
 [98,]  1.267403e-76 1.000000e+00
 [99,]  1.592687e-30 1.000000e+00
[100,]  1.810258e-68 1.000000e+00
[101,] 2.738286e-219 1.000000e+00
[102,] 3.179616e-138 1.000000e+00
[103,] 6.128882e-193 1.000000e+00
[104,] 2.393780e-159 1.000000e+00
[105,] 1.229250e-190 1.000000e+00
[106,] 1.049686e-242 1.000000e+00
[107,] 4.074788e-103 1.000000e+00
[108,] 1.165357e-208 1.000000e+00
[109,] 1.375133e-177 1.000000e+00
[110,] 1.922156e-221 1.000000e+00
[111,] 5.753548e-139 1.000000e+00
[112,] 1.661381e-149 1.000000e+00
[113,] 2.522208e-168 1.000000e+00
[114,] 3.502854e-140 1.000000e+00
[115,] 3.351619e-168 1.000000e+00
[116,] 6.720935e-167 1.000000e+00
[117,] 5.175423e-153 1.000000e+00
[118,] 1.008243e-242 1.000000e+00
[119,] 7.666929e-282 1.000000e+00
[120,] 2.119341e-121 1.000000e+00
[121,] 5.006692e-189 1.000000e+00
[122,] 2.454989e-133 1.000000e+00
[123,] 9.319211e-250 1.000000e+00
[124,] 3.324569e-124 1.000000e+00
[125,] 4.943694e-176 1.000000e+00
[126,] 1.245396e-183 1.000000e+00
[127,] 3.204137e-118 1.000000e+00
[128,] 6.332258e-121 1.000000e+00
[129,] 2.764661e-175 1.000000e+00
[130,] 4.206098e-167 1.000000e+00
[131,] 2.582071e-201 1.000000e+00
[132,] 4.979503e-213 1.000000e+00
[133,] 5.636644e-181 1.000000e+00
[134,] 1.534474e-121 1.000000e+00
[135,] 6.800929e-148 1.000000e+00
[136,] 1.586579e-219 1.000000e+00
[137,] 4.923523e-188 1.000000e+00
[138,] 1.132452e-151 1.000000e+00
[139,] 3.529325e-116 1.000000e+00
[140,] 7.067660e-162 1.000000e+00
[141,] 1.221577e-190 1.000000e+00
[142,] 5.086004e-158 1.000000e+00
[143,] 3.179616e-138 1.000000e+00
[144,] 9.761390e-201 1.000000e+00
[145,] 5.526102e-201 1.000000e+00
[146,] 7.089295e-164 1.000000e+00
[147,] 7.438380e-136 1.000000e+00
[148,] 3.252696e-146 1.000000e+00
[149,] 1.122191e-170 1.000000e+00
[150,] 8.593596e-131 1.000000e+00

attr(,"class")
[1] "mclustModel"
$modelName
[1] "VVV"

$n
[1] 150

$d
[1] 4

$G
[1] 2

$bic
[1] -574.0178

$loglik
[1] -214.3547

$parameters
$parameters$pro
[1] 0.3333291 0.6666709

$parameters$mean
                  [,1]     [,2]
Sepal.Length 5.0060064 6.261989
Sepal.Width  3.4280142 2.871996
Petal.Length 1.4620020 4.905977
Petal.Width  0.2459993 1.675991

$parameters$variance
$parameters$variance$modelName
[1] "VVV"

$parameters$variance$d
[1] 4

$parameters$variance$G
[1] 2

$parameters$variance$sigma
, , 1

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length   0.12176231 0.097226065  0.016027173 0.010124468
Sepal.Width    0.09722607 0.140801829  0.011461855 0.009112876
Petal.Length   0.01602717 0.011461855  0.029556040 0.005948184
Petal.Width    0.01012447 0.009112876  0.005948184 0.010884100

, , 2

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length    0.4349728  0.12094153    0.4488652  0.16550225
Sepal.Width     0.1209415  0.10961736    0.1413800  0.07923241
Petal.Length    0.4488652  0.14137999    0.6748417  0.28587351
Petal.Width     0.1655023  0.07923241    0.2858735  0.17863484


$parameters$variance$cholsigma
, , 1

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length   -0.3489446  -0.2786290 -0.045930428 -0.02901454
Sepal.Width     0.0000000   0.2513319 -0.005314456  0.00409253
Petal.Length    0.0000000   0.0000000 -0.165584396 -0.02800556
Petal.Width     0.0000000   0.0000000  0.000000000  0.09613114

, , 2

             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length    0.6595247   0.1833768   0.68058896   0.2509417
Sepal.Width     0.0000000   0.2756634   0.06013043   0.1204931
Petal.Length    0.0000000   0.0000000  -0.45609730  -0.2364409
Petal.Width     0.0000000   0.0000000   0.00000000  -0.2126975



$parameters$Vinv
NULL


$z
                [,1]         [,2]
  [1,]  1.000000e+00 2.179880e-11
  [2,]  9.999999e-01 7.812105e-08
  [3,]  1.000000e+00 4.901701e-09
  [4,]  9.999999e-01 1.329199e-07
  [5,]  1.000000e+00 6.909560e-12
  [6,]  1.000000e+00 8.337492e-13
  [7,]  1.000000e+00 3.054465e-09
  [8,]  1.000000e+00 3.980489e-10
  [9,]  9.999985e-01 1.512745e-06
 [10,]  9.999999e-01 9.028398e-08
 [11,]  1.000000e+00 8.462265e-13
 [12,]  1.000000e+00 3.143041e-09
 [13,]  9.999998e-01 1.533234e-07
 [14,]  9.999996e-01 3.856392e-07
 [15,]  1.000000e+00 1.071638e-16
 [16,]  1.000000e+00 7.735026e-19
 [17,]  1.000000e+00 1.400767e-14
 [18,]  1.000000e+00 2.966301e-11
 [19,]  1.000000e+00 1.468295e-12
 [20,]  1.000000e+00 6.429208e-13
 [21,]  1.000000e+00 5.071823e-09
 [22,]  1.000000e+00 1.039710e-11
 [23,]  1.000000e+00 8.130697e-11
 [24,]  9.999996e-01 3.782588e-07
 [25,]  9.999993e-01 6.606657e-07
 [26,]  9.999992e-01 7.672147e-07
 [27,]  1.000000e+00 5.214411e-09
 [28,]  1.000000e+00 4.525074e-11
 [29,]  1.000000e+00 8.997287e-11
 [30,]  9.999999e-01 7.741890e-08
 [31,]  9.999998e-01 2.151967e-07
 [32,]  1.000000e+00 4.496725e-10
 [33,]  1.000000e+00 2.358878e-15
 [34,]  1.000000e+00 1.540110e-17
 [35,]  1.000000e+00 4.874227e-08
 [36,]  1.000000e+00 1.041320e-09
 [37,]  1.000000e+00 5.611407e-12
 [38,]  1.000000e+00 1.650408e-11
 [39,]  9.999997e-01 2.967299e-07
 [40,]  1.000000e+00 3.015333e-10
 [41,]  1.000000e+00 2.652541e-11
 [42,]  9.993722e-01 6.278349e-04
 [43,]  1.000000e+00 3.744685e-08
 [44,]  9.999998e-01 1.536186e-07
 [45,]  1.000000e+00 1.009273e-09
 [46,]  9.999999e-01 1.346876e-07
 [47,]  1.000000e+00 1.491410e-12
 [48,]  1.000000e+00 1.593767e-08
 [49,]  1.000000e+00 1.055506e-12
 [50,]  1.000000e+00 7.010840e-10
 [51,]  1.028176e-91 1.000000e+00
 [52,]  4.118476e-83 1.000000e+00
 [53,] 4.254776e-104 1.000000e+00
 [54,]  5.533845e-64 1.000000e+00
 [55,]  3.727452e-92 1.000000e+00
 [56,]  5.295749e-79 1.000000e+00
 [57,]  1.821146e-93 1.000000e+00
 [58,]  9.420775e-34 1.000000e+00
 [59,]  3.558097e-86 1.000000e+00
 [60,]  1.460882e-60 1.000000e+00
 [61,]  8.911089e-42 1.000000e+00
 [62,]  2.262065e-72 1.000000e+00
 [63,]  7.500901e-61 1.000000e+00
 [64,]  1.711658e-90 1.000000e+00
 [65,]  9.052747e-47 1.000000e+00
 [66,]  1.382347e-78 1.000000e+00
 [67,]  2.067649e-83 1.000000e+00
 [68,]  2.407029e-58 1.000000e+00
 [69,]  8.428331e-93 1.000000e+00
 [70,]  2.777246e-54 1.000000e+00
 [71,] 2.860947e-106 1.000000e+00
 [72,]  1.594948e-61 1.000000e+00
 [73,] 1.521390e-107 1.000000e+00
 [74,]  1.474608e-86 1.000000e+00
 [75,]  8.345240e-73 1.000000e+00
 [76,]  2.992660e-79 1.000000e+00
 [77,] 5.093916e-100 1.000000e+00
 [78,] 2.339513e-115 1.000000e+00
 [79,]  5.839001e-85 1.000000e+00
 [80,]  2.920436e-39 1.000000e+00
 [81,]  1.690050e-51 1.000000e+00
 [82,]  2.604580e-46 1.000000e+00
 [83,]  1.837800e-55 1.000000e+00
 [84,] 1.328950e-116 1.000000e+00
 [85,]  2.228854e-83 1.000000e+00
 [86,]  7.605486e-84 1.000000e+00
 [87,]  5.785303e-94 1.000000e+00
 [88,]  7.563454e-83 1.000000e+00
 [89,]  5.492298e-62 1.000000e+00
 [90,]  2.101518e-62 1.000000e+00
 [91,]  1.260009e-73 1.000000e+00
 [92,]  3.129396e-85 1.000000e+00
 [93,]  8.807540e-60 1.000000e+00
 [94,]  1.915923e-34 1.000000e+00
 [95,]  4.525660e-68 1.000000e+00
 [96,]  4.922599e-63 1.000000e+00
 [97,]  1.435974e-66 1.000000e+00
 [98,]  7.246757e-72 1.000000e+00
 [99,]  1.570406e-28 1.000000e+00
[100,]  7.753184e-64 1.000000e+00
[101,] 1.715568e-203 1.000000e+00
[102,] 2.063060e-128 1.000000e+00
[103,] 4.144481e-181 1.000000e+00
[104,] 1.802411e-148 1.000000e+00
[105,] 9.595513e-178 1.000000e+00
[106,] 2.450822e-228 1.000000e+00
[107,]  3.858106e-95 1.000000e+00
[108,] 4.501252e-196 1.000000e+00
[109,] 2.115765e-166 1.000000e+00
[110,] 2.850188e-207 1.000000e+00
[111,] 7.896858e-130 1.000000e+00
[112,] 8.635389e-140 1.000000e+00
[113,] 1.065571e-157 1.000000e+00
[114,] 2.995905e-130 1.000000e+00
[115,] 6.014931e-156 1.000000e+00
[116,] 1.854991e-155 1.000000e+00
[117,] 6.112062e-143 1.000000e+00
[118,] 5.556947e-228 1.000000e+00
[119,] 4.071356e-265 1.000000e+00
[120,] 1.582240e-113 1.000000e+00
[121,] 6.551828e-177 1.000000e+00
[122,] 1.497602e-123 1.000000e+00
[123,] 3.260777e-235 1.000000e+00
[124,] 3.221069e-116 1.000000e+00
[125,] 2.126709e-164 1.000000e+00
[126,] 1.750897e-172 1.000000e+00
[127,] 1.827603e-110 1.000000e+00
[128,] 1.157185e-112 1.000000e+00
[129,] 1.541379e-163 1.000000e+00
[130,] 2.818264e-157 1.000000e+00
[131,] 1.280686e-189 1.000000e+00
[132,] 5.515657e-201 1.000000e+00
[133,] 8.508500e-169 1.000000e+00
[134,] 1.229473e-113 1.000000e+00
[135,] 1.419631e-137 1.000000e+00
[136,] 4.920730e-207 1.000000e+00
[137,] 1.319054e-174 1.000000e+00
[138,] 2.047383e-141 1.000000e+00
[139,] 3.924904e-108 1.000000e+00
[140,] 7.842742e-152 1.000000e+00
[141,] 4.784675e-178 1.000000e+00
[142,] 4.379279e-148 1.000000e+00
[143,] 2.063060e-128 1.000000e+00
[144,] 1.527616e-187 1.000000e+00
[145,] 1.865683e-187 1.000000e+00
[146,] 2.781141e-153 1.000000e+00
[147,] 4.075952e-127 1.000000e+00
[148,] 1.085394e-136 1.000000e+00
[149,] 2.104349e-158 1.000000e+00
[150,] 2.032227e-121 1.000000e+00

attr(,"class")
[1] "mclustModel"

mclust documentation built on July 2, 2018, 9:03 a.m.