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

The MBC Procedure

Parameter Estimates for Selected Model
ClusterVariableMeanCovariance
HeightWidthWeight3
1Height1.213490.004300.000140050.03748
 Width0.71109 0.001760.02778
 Weight36.27450  4.08257
2Height1.779640.007570.001240.08550
 Width0.63619 0.001420.03318
 Weight37.65945  4.02232
3Height0.938930.003270.00015888-0.11160
 Width0.59277 0.001350.01157
 Weight35.88766  9.76032

Mixing Probability Estimates
for Selected Model
Mixing
Component
Mixing
Probability
10.52334
20.28662
30.19003

Model Selection Summary
Covariance
Structure
Number of
Clusters
Noise
Component
Number of
Parameters
-2 Log LAICAICCBIC
EVV3N27-9.2363344.7636756.48460127.28231
EEE3N1748.5081482.5081486.91102134.46432
EEI3N1464.0123092.0123094.97004134.79974
EVI3N1845.2459381.2459386.20245136.25835
VVI3N2036.6341976.6341982.81066137.75911
VVV3N296.2272164.2272177.92800152.85834
EEV3N23131.15440177.15440185.45515247.44805
VII3N141026.605511054.605511057.563251097.39295
EII3N121075.292021099.292021101.458681135.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

The MBC Procedure

Model Selection Summary
Covariance
Structure
Number of
Clusters
Noise
Component
Number of
Parameters
-2 Log LAICAICCBIC
EVV3N27-9.2363344.7636756.48460127.28231
VVI3N20162.69679202.69679208.87326263.82170
VVV3N29157.72594215.72594229.42673304.35707
EEV3N23256.65424302.65424310.95500372.94790
EEE3N17289.96205323.96205328.36493375.91823
EVI3N18303.23126339.23126344.18779394.24369
EEI3N14324.15413352.15413355.11188394.94157
VII3N141026.605491054.605491057.563241097.39293
EII3N121075.292761099.292761101.459421135.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
ClusterVariableMeanCovariance
HeightWidthWeight3
1Height1.213480.004300.000140410.03749
 Width0.71109 0.001760.02778
 Weight36.27437  4.08255
2Height0.938920.003270.00015841-0.11160
 Width0.59277 0.001350.01159
 Weight35.88795  9.76185
3Height1.779640.007570.001240.08550
 Width0.63619 0.001420.03318
 Weight37.65945  4.02246

Mixing Probability Estimates
for Selected Model
Mixing
Component
Mixing
Probability
10.52337
20.19001
30.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

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

The MBC Procedure

Model Selection Summary
Covariance
Structure
Number of
Clusters
Noise
Component
Number of
Parameters
-2 Log LAICAICCBIC
VVV3N29-19.5746438.4253652.12615127.05649
EVV3N27-9.2363344.7636756.48460127.28230
EEV3N2312.6566558.6566566.95741128.95031
EEE3N1748.5080982.5080986.91097134.46427
EEI3N1464.0123092.0123094.97005134.79974
EVI3N1845.2459181.2459186.20243136.25834
VVI3N2036.6341976.6341982.81066137.75911
VII3N141026.605401054.605401057.563141097.39284
EII3N121075.290451099.290451101.457121135.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
ClusterVariableMeanCovariance
HeightWidthWeight3
1Height0.939010.003940.00019642-0.13391
 Width0.59276 0.001620.01388
 Weight35.88904  11.69267
2Height1.779640.005290.000867940.05971
 Width0.63619 0.000988630.02317
 Weight37.65945  2.80942
3Height1.213410.004720.000157800.04118
 Width0.71108 0.001920.03042
 Weight36.27394  4.46530

Mixing Probability Estimates
for Selected Model
Mixing
Component
Mixing
Probability
10.18995
20.28662
30.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.

Last updated: November 05, 2020