The MBC Procedure
Example 12.2 Adjusting Starting Values
This example shows how you can use alternative starting values to influence the model fitting process.
The data in this example consist of physical measurements of 159 freshwater fish. The data set is available from Puranen (1917).
Each measurement includes species, weight, height, width, and three length variables. The values that are recorded for height and width are percentages of the third length variable.
The following DATA step creates the data table mycas.fish. These statements assume that your CAS engine libref is named mycas, but you can substitute any appropriately defined CAS engine libref.
data mycas.fish (drop=HtPct WidthPct);
input Species Weight Length1 Length2 Length3 HtPct WidthPct @@;
*** transform variables;
if Weight <= 0 or Weight =. then delete;
Weight3=Weight**(1/3);
Height=HtPct*Length3/(Weight3*100);
Width=WidthPct*Length3/(Weight3*100);
Length1=Length1/Weight3;
Length2=Length2/Weight3;
Length3=Length3/Weight3;
logLengthRatio=log(Length3/Length1);
datalines;
1 242.0 23.2 25.4 30.0 38.4 13.4 1 290.0 24.0 26.3 31.2 40.0 13.8
1 340.0 23.9 26.5 31.1 39.8 15.1 1 363.0 26.3 29.0 33.5 38.0 13.3
1 430.0 26.5 29.0 34.0 36.6 15.1 1 450.0 26.8 29.7 34.7 39.2 14.2
1 500.0 26.8 29.7 34.5 41.1 15.3 1 390.0 27.6 30.0 35.0 36.2 13.4
1 450.0 27.6 30.0 35.1 39.9 13.8 1 500.0 28.5 30.7 36.2 39.3 13.7
1 475.0 28.4 31.0 36.2 39.4 14.1 1 500.0 28.7 31.0 36.2 39.7 13.3
1 500.0 29.1 31.5 36.4 37.8 12.0 1 . 29.5 32.0 37.3 37.3 13.6
1 600.0 29.4 32.0 37.2 40.2 13.9 1 600.0 29.4 32.0 37.2 41.5 15.0
1 700.0 30.4 33.0 38.3 38.8 13.8 1 700.0 30.4 33.0 38.5 38.8 13.5
1 610.0 30.9 33.5 38.6 40.5 13.3 1 650.0 31.0 33.5 38.7 37.4 14.8
1 575.0 31.3 34.0 39.5 38.3 14.1 1 685.0 31.4 34.0 39.2 40.8 13.7
1 620.0 31.5 34.5 39.7 39.1 13.3 1 680.0 31.8 35.0 40.6 38.1 15.1
... more lines ...
7 19.7 13.2 14.3 15.2 18.9 13.6 7 19.9 13.8 15.0 16.2 18.1 11.6
;
This example uses the variables height, width, and weight3 for analysis. Your goal is to find the model that best represents the clustering in these three variables.
The “Getting Started” example and Example 12.1: Storing and Scoring both show how to use PROC MBC to compare several models, but both examples rely on random starting values to begin the model fitting. PROC MBC provides two other ways to generate starting values: the k-means technique and predefined starting values.
When you specify INIT=KMEANS, the procedure uses the k-means technique to get starting values for the cluster weights, means, and covariances. This is equivalent to starting with the M-step in the EM algorithm. The k-means method might be a better method for starting values in some situations, particularly where the clusters are roughly spherical.
You use the INIT statement to specify variables that contain initial cluster assignment weights for each observation. The procedure uses these weights for the initial E-step in the EM algorithm. You might want to use the INIT statement in cases where you have prior knowledge of clustering and want to use that knowledge to influence the model fitting process.
The following statements use the default, or random start, method to generate initial values and to choose from several models that are distinguished by covariance structure:
proc mbc data=mycas.fish seed=9982346 covstruct=(eee eei eev eii evi evv vii vvi vvv)
nclusters=3;
var height width weight3;
run;
Output 12.2.1 summarizes the parameter estimates, mixing estimates, and fit statistics for the selected model, which has three clusters and uses the VVV covariance structure.
Output 12.2.1: Selected Model Using INIT=RANDOM Option
| Parameter Estimates for Selected Model | |||||
|---|---|---|---|---|---|
| Cluster | Variable | Mean | Covariance | ||
| Height | Width | Weight3 | |||
| 1 | Height | 1.21349 | 0.00430 | 0.00014005 | 0.03748 |
| Width | 0.71109 | 0.00176 | 0.02778 | ||
| Weight3 | 6.27450 | 4.08257 | |||
| 2 | Height | 1.77964 | 0.00757 | 0.00124 | 0.08550 |
| Width | 0.63619 | 0.00142 | 0.03318 | ||
| Weight3 | 7.65945 | 4.02232 | |||
| 3 | Height | 0.93893 | 0.00327 | 0.00015888 | -0.11160 |
| Width | 0.59277 | 0.00135 | 0.01157 | ||
| Weight3 | 5.88766 | 9.76032 | |||
| Mixing Probability Estimates for Selected Model | |
|---|---|
| Mixing Component | Mixing Probability |
| 1 | 0.52334 |
| 2 | 0.28662 |
| 3 | 0.19003 |
| Model Selection Summary | |||||||
|---|---|---|---|---|---|---|---|
| Covariance Structure | Number of Clusters | Noise Component | Number of Parameters | -2 Log L | AIC | AICC | BIC |
| EVV | 3 | N | 27 | -9.23633 | 44.76367 | 56.48460 | 127.28231 |
| EEE | 3 | N | 17 | 48.50814 | 82.50814 | 86.91102 | 134.46432 |
| EEI | 3 | N | 14 | 64.01230 | 92.01230 | 94.97004 | 134.79974 |
| EVI | 3 | N | 18 | 45.24593 | 81.24593 | 86.20245 | 136.25835 |
| VVI | 3 | N | 20 | 36.63419 | 76.63419 | 82.81066 | 137.75911 |
| VVV | 3 | N | 29 | 6.22721 | 64.22721 | 77.92800 | 152.85834 |
| EEV | 3 | N | 23 | 131.15440 | 177.15440 | 185.45515 | 247.44805 |
| VII | 3 | N | 14 | 1026.60551 | 1054.60551 | 1057.56325 | 1097.39295 |
| EII | 3 | N | 12 | 1075.29202 | 1099.29202 | 1101.45868 | 1135.96697 |
To see the effect of a different method of determining starting values, you can use the INIT=KMEANS option. The following statements use the k-means method of initialization:
proc mbc data=mycas.fish seed=9982346 init=kmeans
covstruct=(eee eei eev eii evi evv vii vvi vvv)
nclusters=3;
var height width weight3;
run;
Output 12.2.2 summarizes the model selection process for the k-means method. The selected model uses the EVV covariance structure, and the fit statistics for other models are different from the result that uses the default random start method. In particular, the log-likelihood statistic for each of the top three models is a good deal worse with the k-means method than with the default method. This might be associated with the fact that the three clusters are not really spherical, so the starting values that are determined using the k-means method might not be suitable in this situation.
Output 12.2.2: Model Selection Summary Using INIT=KMEANS Option
| Model Selection Summary | |||||||
|---|---|---|---|---|---|---|---|
| Covariance Structure | Number of Clusters | Noise Component | Number of Parameters | -2 Log L | AIC | AICC | BIC |
| EVV | 3 | N | 27 | -9.23633 | 44.76367 | 56.48460 | 127.28231 |
| VVI | 3 | N | 20 | 162.69679 | 202.69679 | 208.87326 | 263.82170 |
| VVV | 3 | N | 29 | 157.72594 | 215.72594 | 229.42673 | 304.35707 |
| EEV | 3 | N | 23 | 256.65424 | 302.65424 | 310.95500 | 372.94790 |
| EEE | 3 | N | 17 | 289.96205 | 323.96205 | 328.36493 | 375.91823 |
| EVI | 3 | N | 18 | 303.23126 | 339.23126 | 344.18779 | 394.24369 |
| EEI | 3 | N | 14 | 324.15413 | 352.15413 | 355.11188 | 394.94157 |
| VII | 3 | N | 14 | 1026.60549 | 1054.60549 | 1057.56324 | 1097.39293 |
| EII | 3 | N | 12 | 1075.29276 | 1099.29276 | 1101.45942 | 1135.96771 |
Output 12.2.3 shows the parameter estimates and mixing estimates for the selected model. The parameter estimates and mixing estimates are broadly similar to those for the default initialization method, but dissimilar enough to drive the difference in the selected model.
Output 12.2.3: Parameter Estimates and Mixing Estimates Using INIT=KMEANS Option
| Parameter Estimates for Selected Model | |||||
|---|---|---|---|---|---|
| Cluster | Variable | Mean | Covariance | ||
| Height | Width | Weight3 | |||
| 1 | Height | 1.21348 | 0.00430 | 0.00014041 | 0.03749 |
| Width | 0.71109 | 0.00176 | 0.02778 | ||
| Weight3 | 6.27437 | 4.08255 | |||
| 2 | Height | 0.93892 | 0.00327 | 0.00015841 | -0.11160 |
| Width | 0.59277 | 0.00135 | 0.01159 | ||
| Weight3 | 5.88795 | 9.76185 | |||
| 3 | Height | 1.77964 | 0.00757 | 0.00124 | 0.08550 |
| Width | 0.63619 | 0.00142 | 0.03318 | ||
| Weight3 | 7.65945 | 4.02246 | |||
| Mixing Probability Estimates for Selected Model | |
|---|---|
| Mixing Component | Mixing Probability |
| 1 | 0.52337 |
| 2 | 0.19001 |
| 3 | 0.28662 |
The remaining option for adjusting starting values is the INIT statement. Using the INIT statement requires you to specify variables that give initial weights for each observation.
The following statements produce a scatter plot of the Height and Width variables, labeling each point with a species number:
proc sgplot data=mycas.fish;
scatter x=height y=width / group=species;
run; quit;
Output 12.2.4 suggests that the species encodes useful information about the clustering.
Output 12.2.4: Fish Measurement Data with Species Labels

You can use these visible clusterings to generate initialization variables. The following DATA step shows one way to generate initialization variables that reflect your observations:
data mycas.fishlbl;
set mycas.fish;
if (species in (6,7)) then do; z1=1; z2=0; z3=0; end;
else if (species in (1,4)) then do; z1=0; z2=1; z3=0; end;
else do; z1=0; z2=0; z3=1; end;
;
PROC MBC uses the initialization values for each observation as a set of weights that drive the parameter estimates and mixing estimates for the first EM iteration. The following statements use these initialization values by including them in the desired order in the INIT statement:
proc mbc data=mycas.fishlbl
covstruct=(eee eei eev eii evi evv vii vvi vvv)
nclusters=3;
var height width weight3;
init z1 z2 z3;
run;
Output 12.2.5 summarizes the model selection process. The ordering of models does not match that from either of the previous results, but the selected model uses the same covariance structure (VVV) as the random start approach.
Output 12.2.5: Model Selection Summary Using INIT Statement
| Model Selection Summary | |||||||
|---|---|---|---|---|---|---|---|
| Covariance Structure | Number of Clusters | Noise Component | Number of Parameters | -2 Log L | AIC | AICC | BIC |
| VVV | 3 | N | 29 | -19.57464 | 38.42536 | 52.12615 | 127.05649 |
| EVV | 3 | N | 27 | -9.23633 | 44.76367 | 56.48460 | 127.28230 |
| EEV | 3 | N | 23 | 12.65665 | 58.65665 | 66.95741 | 128.95031 |
| EEE | 3 | N | 17 | 48.50809 | 82.50809 | 86.91097 | 134.46427 |
| EEI | 3 | N | 14 | 64.01230 | 92.01230 | 94.97005 | 134.79974 |
| EVI | 3 | N | 18 | 45.24591 | 81.24591 | 86.20243 | 136.25834 |
| VVI | 3 | N | 20 | 36.63419 | 76.63419 | 82.81066 | 137.75911 |
| VII | 3 | N | 14 | 1026.60540 | 1054.60540 | 1057.56314 | 1097.39284 |
| EII | 3 | N | 12 | 1075.29045 | 1099.29045 | 1101.45712 | 1135.96540 |
Output 12.2.6 shows the parameter estimates and mixing estimates. The selected model matches the selected model from the random start approach, but with a different order for the clusters.
Output 12.2.6: Parameter Estimates and Mixing Estimates Using INIT Statement
| Parameter Estimates for Selected Model | |||||
|---|---|---|---|---|---|
| Cluster | Variable | Mean | Covariance | ||
| Height | Width | Weight3 | |||
| 1 | Height | 0.93901 | 0.00394 | 0.00019642 | -0.13391 |
| Width | 0.59276 | 0.00162 | 0.01388 | ||
| Weight3 | 5.88904 | 11.69267 | |||
| 2 | Height | 1.77964 | 0.00529 | 0.00086794 | 0.05971 |
| Width | 0.63619 | 0.00098863 | 0.02317 | ||
| Weight3 | 7.65945 | 2.80942 | |||
| 3 | Height | 1.21341 | 0.00472 | 0.00015780 | 0.04118 |
| Width | 0.71108 | 0.00192 | 0.03042 | ||
| Weight3 | 6.27394 | 4.46530 | |||
| Mixing Probability Estimates for Selected Model | |
|---|---|
| Mixing Component | Mixing Probability |
| 1 | 0.18995 |
| 2 | 0.28662 |
| 3 | 0.52343 |
This approach results in different fit statistics for some of the other models that are considered. In this case, the use of initialization variables through the INIT statement does not select a model different from that selected using the default method. However, the difference in the fit statistics for the other models that are considered in the selection process shows the effect of the different initialization method.