Best model based on BIC
mclustModel.Rd
Determines the best model from clustering via mclustBIC
for a given set of model parameterizations and numbers of components.
Arguments
- data
The matrix or vector of observations used to generate `object'.
- BICvalues
An
'mclustBIC'
object, which is the result of applyingmclustBIC
todata
.- 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 ofBICvalues
). The default is to select the best model for all numbers of mixture components used to obtainBICvalues
.- 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 ofBICvalues
). The default is to select the best model for parameterizations used to obtainBICvalues
.- ...
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.
Examples
irisBIC <- mclustBIC(iris[,-5])
mclustModel(iris[,-5], irisBIC)
#> $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.3333319 0.6666681
#>
#> $parameters$mean
#> [,1] [,2]
#> Sepal.Length 5.0060022 6.261996
#> Sepal.Width 3.4280049 2.871999
#> Petal.Length 1.4620007 4.905992
#> 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.15065114 0.13080115 0.02084463 0.01309107
#> Sepal.Width 0.13080115 0.17604529 0.01603245 0.01221458
#> Petal.Length 0.02084463 0.01603245 0.02808260 0.00601568
#> Petal.Width 0.01309107 0.01221458 0.00601568 0.01042365
#>
#> , , 2
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 0.4000438 0.10865444 0.3994018 0.14368256
#> Sepal.Width 0.1086544 0.10928077 0.1238904 0.07284384
#> Petal.Length 0.3994018 0.12389040 0.6109024 0.25738990
#> Petal.Width 0.1436826 0.07284384 0.2573899 0.16808182
#>
#>
#> $parameters$variance$scale
#> [1] 0.0377238 0.1330765
#>
#> $parameters$variance$shape
#> [1] 7.9106959 0.9228733 0.6299550 0.2174371
#>
#> $parameters$variance$orientation
#> , , 1
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length -0.66908566 0.5978655 -0.4399773 -0.03607204
#> Sepal.Width -0.73414108 -0.6206713 0.2746297 -0.01955857
#> Petal.Length -0.09654297 0.4900812 0.8324338 -0.23990403
#> Petal.Width -0.06356659 0.1309366 0.1950707 0.96992903
#>
#> , , 2
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 0.5565148 0.75863444 -0.006116263 -0.3387148
#> Sepal.Width 0.1865004 0.02937396 -0.901899502 0.3884997
#> Petal.Length 0.7428959 -0.33350461 0.344100463 0.4674134
#> Petal.Width 0.3218923 -0.55891469 -0.261026344 -0.7182374
#>
#>
#>
#> $parameters$Vinv
#> NULL
#>
#>
#> $z
#> [,1] [,2]
#> [1,] 1.000000e+00 2.513256e-11
#> [2,] 9.999999e-01 5.556629e-08
#> [3,] 1.000000e+00 3.635567e-09
#> [4,] 9.999999e-01 8.612037e-08
#> [5,] 1.000000e+00 8.504814e-12
#> [6,] 1.000000e+00 1.400416e-12
#> [7,] 1.000000e+00 2.971743e-09
#> [8,] 1.000000e+00 4.053088e-10
#> [9,] 9.999993e-01 6.585467e-07
#> [10,] 9.999999e-01 7.276067e-08
#> [11,] 1.000000e+00 1.189599e-12
#> [12,] 1.000000e+00 3.285947e-09
#> [13,] 9.999999e-01 1.034990e-07
#> [14,] 9.999998e-01 1.791935e-07
#> [15,] 1.000000e+00 2.623274e-16
#> [16,] 1.000000e+00 1.665011e-18
#> [17,] 1.000000e+00 2.857132e-14
#> [18,] 1.000000e+00 3.517596e-11
#> [19,] 1.000000e+00 2.111154e-12
#> [20,] 1.000000e+00 9.845182e-13
#> [21,] 1.000000e+00 6.254470e-09
#> [22,] 1.000000e+00 1.579205e-11
#> [23,] 1.000000e+00 1.159139e-10
#> [24,] 9.999995e-01 4.953933e-07
#> [25,] 9.999989e-01 1.061700e-06
#> [26,] 9.999994e-01 5.954046e-07
#> [27,] 1.000000e+00 6.015651e-09
#> [28,] 1.000000e+00 5.309896e-11
#> [29,] 1.000000e+00 1.021530e-10
#> [30,] 9.999999e-01 6.263700e-08
#> [31,] 9.999998e-01 1.604474e-07
#> [32,] 1.000000e+00 6.134473e-10
#> [33,] 1.000000e+00 5.534184e-15
#> [34,] 1.000000e+00 3.165137e-17
#> [35,] 1.000000e+00 3.683247e-08
#> [36,] 1.000000e+00 1.058361e-09
#> [37,] 1.000000e+00 9.055560e-12
#> [38,] 1.000000e+00 2.144971e-11
#> [39,] 9.999999e-01 1.445739e-07
#> [40,] 1.000000e+00 3.176730e-10
#> [41,] 1.000000e+00 3.224240e-11
#> [42,] 9.997974e-01 2.025712e-04
#> [43,] 1.000000e+00 2.424854e-08
#> [44,] 9.999997e-01 3.077601e-07
#> [45,] 1.000000e+00 2.213493e-09
#> [46,] 9.999999e-01 9.248798e-08
#> [47,] 1.000000e+00 2.393976e-12
#> [48,] 1.000000e+00 1.123879e-08
#> [49,] 1.000000e+00 1.458995e-12
#> [50,] 1.000000e+00 6.608732e-10
#> [51,] 5.013996e-97 1.000000e+00
#> [52,] 1.064131e-88 1.000000e+00
#> [53,] 2.002769e-110 1.000000e+00
#> [54,] 2.021014e-68 1.000000e+00
#> [55,] 5.251038e-98 1.000000e+00
#> [56,] 5.873800e-85 1.000000e+00
#> [57,] 4.044755e-100 1.000000e+00
#> [58,] 3.692996e-36 1.000000e+00
#> [59,] 1.711073e-91 1.000000e+00
#> [60,] 2.496491e-65 1.000000e+00
#> [61,] 1.718670e-44 1.000000e+00
#> [62,] 1.255500e-77 1.000000e+00
#> [63,] 1.580921e-64 1.000000e+00
#> [64,] 6.715502e-97 1.000000e+00
#> [65,] 3.284253e-50 1.000000e+00
#> [66,] 2.488880e-83 1.000000e+00
#> [67,] 5.063871e-90 1.000000e+00
#> [68,] 2.134991e-62 1.000000e+00
#> [69,] 9.313637e-99 1.000000e+00
#> [70,] 5.368204e-58 1.000000e+00
#> [71,] 1.593168e-114 1.000000e+00
#> [72,] 1.544262e-65 1.000000e+00
#> [73,] 1.093577e-114 1.000000e+00
#> [74,] 1.254390e-92 1.000000e+00
#> [75,] 2.218319e-77 1.000000e+00
#> [76,] 4.064949e-84 1.000000e+00
#> [77,] 5.126083e-106 1.000000e+00
#> [78,] 8.081566e-123 1.000000e+00
#> [79,] 5.062549e-91 1.000000e+00
#> [80,] 8.744165e-42 1.000000e+00
#> [81,] 5.434987e-55 1.000000e+00
#> [82,] 2.182395e-49 1.000000e+00
#> [83,] 3.129395e-59 1.000000e+00
#> [84,] 3.734291e-125 1.000000e+00
#> [85,] 2.775862e-90 1.000000e+00
#> [86,] 2.764222e-90 1.000000e+00
#> [87,] 7.510173e-100 1.000000e+00
#> [88,] 5.994677e-88 1.000000e+00
#> [89,] 8.912310e-67 1.000000e+00
#> [90,] 7.231734e-67 1.000000e+00
#> [91,] 3.262253e-79 1.000000e+00
#> [92,] 2.747440e-91 1.000000e+00
#> [93,] 8.120502e-64 1.000000e+00
#> [94,] 8.983340e-37 1.000000e+00
#> [95,] 4.355364e-73 1.000000e+00
#> [96,] 7.803931e-68 1.000000e+00
#> [97,] 1.572709e-71 1.000000e+00
#> [98,] 1.267390e-76 1.000000e+00
#> [99,] 1.592626e-30 1.000000e+00
#> [100,] 1.810229e-68 1.000000e+00
#> [101,] 2.738152e-219 1.000000e+00
#> [102,] 3.179495e-138 1.000000e+00
#> [103,] 6.128766e-193 1.000000e+00
#> [104,] 2.393731e-159 1.000000e+00
#> [105,] 1.229207e-190 1.000000e+00
#> [106,] 1.049682e-242 1.000000e+00
#> [107,] 4.074631e-103 1.000000e+00
#> [108,] 1.165356e-208 1.000000e+00
#> [109,] 1.375100e-177 1.000000e+00
#> [110,] 1.922118e-221 1.000000e+00
#> [111,] 5.753408e-139 1.000000e+00
#> [112,] 1.661327e-149 1.000000e+00
#> [113,] 2.522136e-168 1.000000e+00
#> [114,] 3.502666e-140 1.000000e+00
#> [115,] 3.351376e-168 1.000000e+00
#> [116,] 6.720655e-167 1.000000e+00
#> [117,] 5.175344e-153 1.000000e+00
#> [118,] 1.008251e-242 1.000000e+00
#> [119,] 7.666712e-282 1.000000e+00
#> [120,] 2.119278e-121 1.000000e+00
#> [121,] 5.006541e-189 1.000000e+00
#> [122,] 2.454880e-133 1.000000e+00
#> [123,] 9.319185e-250 1.000000e+00
#> [124,] 3.324456e-124 1.000000e+00
#> [125,] 4.943602e-176 1.000000e+00
#> [126,] 1.245399e-183 1.000000e+00
#> [127,] 3.204034e-118 1.000000e+00
#> [128,] 6.332105e-121 1.000000e+00
#> [129,] 2.764556e-175 1.000000e+00
#> [130,] 4.206125e-167 1.000000e+00
#> [131,] 2.582052e-201 1.000000e+00
#> [132,] 4.979621e-213 1.000000e+00
#> [133,] 5.636391e-181 1.000000e+00
#> [134,] 1.534458e-121 1.000000e+00
#> [135,] 6.800824e-148 1.000000e+00
#> [136,] 1.586542e-219 1.000000e+00
#> [137,] 4.923324e-188 1.000000e+00
#> [138,] 1.132434e-151 1.000000e+00
#> [139,] 3.529233e-116 1.000000e+00
#> [140,] 7.067477e-162 1.000000e+00
#> [141,] 1.221522e-190 1.000000e+00
#> [142,] 5.085741e-158 1.000000e+00
#> [143,] 3.179495e-138 1.000000e+00
#> [144,] 9.761103e-201 1.000000e+00
#> [145,] 5.525864e-201 1.000000e+00
#> [146,] 7.088920e-164 1.000000e+00
#> [147,] 7.438019e-136 1.000000e+00
#> [148,] 3.252601e-146 1.000000e+00
#> [149,] 1.122150e-170 1.000000e+00
#> [150,] 8.593381e-131 1.000000e+00
#>
#> attr(,"class")
#> [1] "mclustModel"
mclustModel(iris[,-5], irisBIC, G = 1:6, modelNames = c("VII", "VVI", "VVV"))
#> $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.097226044 0.016027170 0.010124469
#> Sepal.Width 0.09722604 0.140801778 0.011461848 0.009112879
#> Petal.Length 0.01602717 0.011461848 0.029556040 0.005948185
#> Petal.Width 0.01012447 0.009112879 0.005948185 0.010884100
#>
#> , , 2
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 0.4349729 0.12094155 0.4488654 0.16550230
#> Sepal.Width 0.1209416 0.10961737 0.1413800 0.07923243
#> Petal.Length 0.4488654 0.14138003 0.6748420 0.28587362
#> Petal.Width 0.1655023 0.07923243 0.2858736 0.17863487
#>
#>
#> $parameters$variance$cholsigma
#> , , 1
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length -0.3489446 -0.2786289 -0.04593042 -0.029014550
#> Sepal.Width 0.0000000 0.2513319 -0.00531447 0.004092543
#> Petal.Length 0.0000000 0.0000000 -0.16558440 -0.028005560
#> Petal.Width 0.0000000 0.0000000 0.00000000 0.096131137
#>
#> , , 2
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> Sepal.Length 0.6595247 0.1833768 0.68058911 0.2509418
#> Sepal.Width 0.0000000 0.2756634 0.06013044 0.1204931
#> Petal.Length 0.0000000 0.0000000 -0.45609737 -0.2364409
#> Petal.Width 0.0000000 0.0000000 0.00000000 -0.2126975
#>
#>
#>
#> $parameters$Vinv
#> NULL
#>
#>
#> $z
#> [,1] [,2]
#> [1,] 1.000000e+00 2.179894e-11
#> [2,] 9.999999e-01 7.812157e-08
#> [3,] 1.000000e+00 4.901731e-09
#> [4,] 9.999999e-01 1.329205e-07
#> [5,] 1.000000e+00 6.909601e-12
#> [6,] 1.000000e+00 8.337540e-13
#> [7,] 1.000000e+00 3.054481e-09
#> [8,] 1.000000e+00 3.980511e-10
#> [9,] 9.999985e-01 1.512753e-06
#> [10,] 9.999999e-01 9.028445e-08
#> [11,] 1.000000e+00 8.462320e-13
#> [12,] 1.000000e+00 3.143054e-09
#> [13,] 9.999998e-01 1.533242e-07
#> [14,] 9.999996e-01 3.856414e-07
#> [15,] 1.000000e+00 1.071648e-16
#> [16,] 1.000000e+00 7.735086e-19
#> [17,] 1.000000e+00 1.400778e-14
#> [18,] 1.000000e+00 2.966321e-11
#> [19,] 1.000000e+00 1.468305e-12
#> [20,] 1.000000e+00 6.429245e-13
#> [21,] 1.000000e+00 5.071850e-09
#> [22,] 1.000000e+00 1.039716e-11
#> [23,] 1.000000e+00 8.130753e-11
#> [24,] 9.999996e-01 3.782611e-07
#> [25,] 9.999993e-01 6.606676e-07
#> [26,] 9.999992e-01 7.672190e-07
#> [27,] 1.000000e+00 5.214441e-09
#> [28,] 1.000000e+00 4.525101e-11
#> [29,] 1.000000e+00 8.997348e-11
#> [30,] 9.999999e-01 7.741922e-08
#> [31,] 9.999998e-01 2.151977e-07
#> [32,] 1.000000e+00 4.496760e-10
#> [33,] 1.000000e+00 2.358894e-15
#> [34,] 1.000000e+00 1.540121e-17
#> [35,] 1.000000e+00 4.874255e-08
#> [36,] 1.000000e+00 1.041329e-09
#> [37,] 1.000000e+00 5.611454e-12
#> [38,] 1.000000e+00 1.650417e-11
#> [39,] 9.999997e-01 2.967315e-07
#> [40,] 1.000000e+00 3.015350e-10
#> [41,] 1.000000e+00 2.652560e-11
#> [42,] 9.993722e-01 6.278412e-04
#> [43,] 1.000000e+00 3.744704e-08
#> [44,] 9.999998e-01 1.536195e-07
#> [45,] 1.000000e+00 1.009277e-09
#> [46,] 9.999999e-01 1.346885e-07
#> [47,] 1.000000e+00 1.491418e-12
#> [48,] 1.000000e+00 1.593775e-08
#> [49,] 1.000000e+00 1.055513e-12
#> [50,] 1.000000e+00 7.010884e-10
#> [51,] 1.028184e-91 1.000000e+00
#> [52,] 4.118505e-83 1.000000e+00
#> [53,] 4.254815e-104 1.000000e+00
#> [54,] 5.533854e-64 1.000000e+00
#> [55,] 3.727474e-92 1.000000e+00
#> [56,] 5.295789e-79 1.000000e+00
#> [57,] 1.821162e-93 1.000000e+00
#> [58,] 9.420780e-34 1.000000e+00
#> [59,] 3.558122e-86 1.000000e+00
#> [60,] 1.460888e-60 1.000000e+00
#> [61,] 8.911083e-42 1.000000e+00
#> [62,] 2.262077e-72 1.000000e+00
#> [63,] 7.500913e-61 1.000000e+00
#> [64,] 1.711672e-90 1.000000e+00
#> [65,] 9.052760e-47 1.000000e+00
#> [66,] 1.382354e-78 1.000000e+00
#> [67,] 2.067665e-83 1.000000e+00
#> [68,] 2.407041e-58 1.000000e+00
#> [69,] 8.428344e-93 1.000000e+00
#> [70,] 2.777254e-54 1.000000e+00
#> [71,] 2.860975e-106 1.000000e+00
#> [72,] 1.594952e-61 1.000000e+00
#> [73,] 1.521401e-107 1.000000e+00
#> [74,] 1.474621e-86 1.000000e+00
#> [75,] 8.345281e-73 1.000000e+00
#> [76,] 2.992676e-79 1.000000e+00
#> [77,] 5.093954e-100 1.000000e+00
#> [78,] 2.339534e-115 1.000000e+00
#> [79,] 5.839041e-85 1.000000e+00
#> [80,] 2.920437e-39 1.000000e+00
#> [81,] 1.690054e-51 1.000000e+00
#> [82,] 2.604584e-46 1.000000e+00
#> [83,] 1.837805e-55 1.000000e+00
#> [84,] 1.328964e-116 1.000000e+00
#> [85,] 2.228873e-83 1.000000e+00
#> [86,] 7.605550e-84 1.000000e+00
#> [87,] 5.785348e-94 1.000000e+00
#> [88,] 7.563474e-83 1.000000e+00
#> [89,] 5.492330e-62 1.000000e+00
#> [90,] 2.101525e-62 1.000000e+00
#> [91,] 1.260017e-73 1.000000e+00
#> [92,] 3.129421e-85 1.000000e+00
#> [93,] 8.807567e-60 1.000000e+00
#> [94,] 1.915922e-34 1.000000e+00
#> [95,] 4.525684e-68 1.000000e+00
#> [96,] 4.922630e-63 1.000000e+00
#> [97,] 1.435982e-66 1.000000e+00
#> [98,] 7.246796e-72 1.000000e+00
#> [99,] 1.570401e-28 1.000000e+00
#> [100,] 7.753220e-64 1.000000e+00
#> [101,] 1.715600e-203 1.000000e+00
#> [102,] 2.063080e-128 1.000000e+00
#> [103,] 4.144542e-181 1.000000e+00
#> [104,] 1.802435e-148 1.000000e+00
#> [105,] 9.595656e-178 1.000000e+00
#> [106,] 2.450871e-228 1.000000e+00
#> [107,] 3.858134e-95 1.000000e+00
#> [108,] 4.501334e-196 1.000000e+00
#> [109,] 2.115792e-166 1.000000e+00
#> [110,] 2.850242e-207 1.000000e+00
#> [111,] 7.896941e-130 1.000000e+00
#> [112,] 8.635475e-140 1.000000e+00
#> [113,] 1.065583e-157 1.000000e+00
#> [114,] 2.995927e-130 1.000000e+00
#> [115,] 6.014984e-156 1.000000e+00
#> [116,] 1.855013e-155 1.000000e+00
#> [117,] 6.112142e-143 1.000000e+00
#> [118,] 5.557076e-228 1.000000e+00
#> [119,] 4.071437e-265 1.000000e+00
#> [120,] 1.582251e-113 1.000000e+00
#> [121,] 6.551920e-177 1.000000e+00
#> [122,] 1.497616e-123 1.000000e+00
#> [123,] 3.260843e-235 1.000000e+00
#> [124,] 3.221091e-116 1.000000e+00
#> [125,] 2.126742e-164 1.000000e+00
#> [126,] 1.750926e-172 1.000000e+00
#> [127,] 1.827616e-110 1.000000e+00
#> [128,] 1.157196e-112 1.000000e+00
#> [129,] 1.541398e-163 1.000000e+00
#> [130,] 2.818306e-157 1.000000e+00
#> [131,] 1.280706e-189 1.000000e+00
#> [132,] 5.515772e-201 1.000000e+00
#> [133,] 8.508603e-169 1.000000e+00
#> [134,] 1.229485e-113 1.000000e+00
#> [135,] 1.419650e-137 1.000000e+00
#> [136,] 4.920802e-207 1.000000e+00
#> [137,] 1.319075e-174 1.000000e+00
#> [138,] 2.047411e-141 1.000000e+00
#> [139,] 3.924939e-108 1.000000e+00
#> [140,] 7.842830e-152 1.000000e+00
#> [141,] 4.784736e-178 1.000000e+00
#> [142,] 4.379310e-148 1.000000e+00
#> [143,] 2.063080e-128 1.000000e+00
#> [144,] 1.527640e-187 1.000000e+00
#> [145,] 1.865711e-187 1.000000e+00
#> [146,] 2.781164e-153 1.000000e+00
#> [147,] 4.075976e-127 1.000000e+00
#> [148,] 1.085405e-136 1.000000e+00
#> [149,] 2.104379e-158 1.000000e+00
#> [150,] 2.032250e-121 1.000000e+00
#>
#> attr(,"class")
#> [1] "mclustModel"