# NAs in variables:
x1 x2 x3 x4
0 0 0 0
0 observation(s) with NAs.
Estimated lambda: 6.768405
…using the clustMixType R Package
02-07-2026
| Algorithm | Authors | Package | Downloads |
|---|---|---|---|
| Gower + PAM | Kaufman and Rousseeuw (1990) | \(\texttt{cluster}\) | 1253012 |
| k-prototypes | Szepannek (2018) | \(\texttt{clustMixType}\) | 67105 |
| MixGHD | Cristina Tortora et al. (2021) | \(\texttt{MixGHD}\) | 6370 |
| kamila | Foss and Markatou (2018) | \(\texttt{kamila}\) | 3243 |
| Fuzzy clustering | C. Tortora and Palumbo (2022) | \(\texttt{FPDclustering}\) | 4312 |
| clustMD | McParland and Gormley (2016) | \(\texttt{clustMD}\) | 4115 |
| Mixed k-means | Ahmad and Dey (2007) | \(\texttt{DisimForMixed}\) | 2260 |
| Spectral clustering | Mbuga and Tortora (2022) | \(\texttt{SpectralClMixed}\) | 2840 |
\[ d(x_i, \mu_j) = \underbrace{\sum_{m=1}^q (x_i^m - \mu_j^m)^2}_{numeric \, variables} + \lambda \underbrace{\sum_{m=q+1}^p \delta(x_i^m, \mu_j^m)}_{factor \, variables}\]
Initialize prototypes \(\mu_j\) randomly.
Assign observations \(x_i\) to their closest prototype w.r.t. \(d()\).
Update prototypes with cluster specific means/modes.
Go back to step 2.
Distance type: huang
Numeric predictors: 2
Categorical predictors: 2
Lambda: 6.768405
Number of Clusters: 4
Cluster sizes: 106 94 101 99
Within cluster error: 332.0333 281.4438 374.4996 321.5224
Cluster prototypes:
x1 x2 x3 x4
1 B B -1.666238 -1.796813
2 A A -1.536931 -1.271467
3 A A 1.646250 1.758957
4 B B 1.188594 1.393680
| \(\texttt{na.rm}\) | |
|---|---|
| \(\texttt{"yes"}\) | cluster only complete cases |
| \(\texttt{"no"}\) | ignore missings |
| \(\texttt{"imp.onestep"}\) | impute only once after convergence |
| \(\texttt{"imp.internal"}\) | impute after each iteration |
Original: \[ d(x_i, \mu_j) = \sum_{m=1}^q (x_i^m - \mu_j^m)^2 + \lambda \sum_{m=q+1}^p \delta(x_i^m, \mu_j^m)\]
New: \[ d(x_i, \mu_j) = \sum_{m=1}^q \lambda_m (x_i^m - \mu_j^m)^2 + \sum_{m=q+1}^p \lambda_m \delta(x_i^m, \mu_j^m)\]
Original (Euklid/Hamming): \[ d(x_i, \mu_j) = \underbrace{\sum_{m=1}^q \lambda_m (x_i^m - \mu_j^m)^2}_{numeric \, variables} + \underbrace{\sum_{m=q+1}^p \lambda_m \delta(x_i^m, \mu_j^m)}_{categorical \, variables}\] Gower (1971), Podani (1999): \[\begin{align} d(x_i, \mu_j) &= \underbrace{\sum_{m=1}^q \lambda_m \frac{|x_i^m - \mu_j^m|}{\underset{i=1,\ldots,n}{range}\{x_i^m\}}}_{numeric \, variables} + \underbrace{\sum_{m=q+1}^p \lambda_m \delta(x_i^m,\mu_j^m)}_{categorical \, variables} \nonumber \\ &\phantom{=} + \underbrace{\sum_{m=p+1}^o \lambda_m \frac{|rank(x_i^m) - \mu_j^m|}{\underset{i=1,\ldots,n}{range}\{rank(x_i^m)\}}}_{ordinal \, variables} \end{align}\]
Figure 1: Simulation Design
| Algorithm | 2 | 3 | 4 | 8 | 16 |
|---|---|---|---|---|---|
| k-proto (Huang) | 0.873 | 0.424 | 0.404 | 0.313 | 0.302 |
| k-proto (Gower) | 0.871 | 0.346 | 0.366 | 0.726 | 0.810 |
| Gower + PAM | 0.871 | 0.346 | 0.319 | 0.740 | 0.811 |
Figure 2: Runtime in seconds
| Index | Range | |
|---|---|---|
| \(C\) index | \([0,1]\) | \(\rightarrow\) min |
| Dunn index | \([0,\infty]\) | \(\rightarrow\) max |
| \(\Gamma\) | \([-1,1]\) | \(\rightarrow\) max |
| Gplus | \([0,N_W N_B / N_D]\) | \(\rightarrow\) min |
| McClain | \([0,\infty]\) | \(\rightarrow\) min |
| Ptbserial | \([-\infty,\infty]\) | \(\rightarrow\) max |
| Silhouette | \([-1,1]\) | \(\rightarrow\) max |
| \(\tau\) | \([-1,1]\) | \(\rightarrow\) max |
…Simulation study suggests SW, \(\Gamma\) or Gplus (SW fastest to compute).
[1] 0.04408281
# NAs in variables:
x1 x2 x3 x4
0 0 0 0
0 observation(s) with NAs.
Estimated lambda: 6.442523
\(\hat{\lambda}_m^{num} = s^2_m\) for numeric variables and
\(\hat{\lambda}_m^{cat} = 1 - \sum_i p_i^2\) for factor variables.
\(\hat{\lambda} = \overline{\hat{\lambda}_m^{num}} / \overline{\hat{\lambda}_m^{cat}}\).
…more appropriate: argument \(\texttt{fac.method = 2}\): \[\begin{align} \hat{\lambda}_m^{cat} &=& 0 \cdot p_{mode} + 1 \cdot (1-p_{mode}) \\ &=& 1 - p_{mode} \end{align}\]
x1 x2 x3 x4
0.470000 0.455000 3.273097 3.131737
\[ T = \sum_i d(x_i, \mu_{j(i)}) = \sum_i \left( \sum_{m=1}^q (x_i^m - \mu_{j(i)}^m)^2 + \lambda \sum_{m=q+1}^p \delta(x_i^m, \mu_{j(i)}^m) \right)\] \[ T =: \sum_{m=1}^p T^m = \sum_{m=1}^q \left( \sum_i (x_i^m - \mu_{j(i)}^m)^2 \right) + \sum_{m=q+1}^p \left( \lambda \sum_i \delta(x_i^m, \mu_{j(i)}^m) \right)\]
Factor 1 Factor 2 Numeric 1 Numeric 2
0.000 0.000 1288.550 1376.301
\[ T_0 =: \sum_{m=1}^p T_0^m = \sum_{m=1}^q \left( \sum_i (x_i^m - \mu^m)^2 \right) + \sum_{m=q+1}^p \left( \lambda \sum_i \delta(x_i^m, \mu^m) \right) \]
… and variable importance: \(VI^m = T^m - T_0^m\).
$vi_decomp
x1 x2 x3 x4
decomp 0.0000000 0.0000000 6.418022e+02 6.153018e+02
decomp0 9400.0000000 9100.0000000 6.513463e+02 6.232156e+02
decomp_redu 9400.0000000 9100.0000000 9.544130e+00 7.913863e+00
vi_rel 0.5076291 0.4914281 5.154125e-04 4.273731e-04
$vi_rand
[1] 0.6021046 0.6019655 0.2674440 0.0000000
$vi_decomp
x1 x2 x3 x4
decomp 0.94 0.91 134.0010050 90.5807852
decomp0 0.94 0.91 651.3463133 623.2156261
decomp_redu 0.00 0.00 517.3453083 532.6348409
vi_rel 0.00 0.00 0.4927191 0.5072809
$vi_rand
[1] 0.0000000 0.0000000 0.3652064 0.6146235
$vi_decomp
x1 x2 x3 x4
decomp 59.00000000 60.00000000 144.933419 151.2672169
decomp0 94.00000000 91.00000000 651.346313 623.2156261
decomp_redu 35.00000000 31.00000000 506.412895 471.9484092
vi_rel 0.03351331 0.02968321 0.484902 0.4519015
$vi_rand
[1] 0.5339776 0.5597048 0.6547060 0.6463334
$vi_decomp
x1 x2 x3 x4
decomp 0.4300000000 0.0000000 147.7798285 2.42448330
decomp0 0.9400000000 546.0000000 651.3463133 6.23215626
decomp_redu 0.5100000000 546.0000000 503.5664849 3.80767296
vi_rel 0.0004839242 0.5180835 0.4778196 0.00361299
$vi_rand
[1] 0.0000000 0.6704998 0.2972868 0.0000000
$vi_decomp
x1 x2 x3 x4
decomp 154.6205430 122.4079299 156.2038547 189.7098929
decomp0 605.5971266 586.2695588 651.3463133 623.2156261
decomp_redu 450.9765837 463.8616289 495.1424586 433.5057332
vi_rel 0.2446324 0.2516219 0.2685902 0.2351554
$vi_rand
[1] 0.2327542 0.2853187 0.3813225 0.2911520
Variable importance can be used to assess the appropriateness of \(\lambda\).
