Language Reference

MCD Call

CALL MCD (sc, coef, dist, opt, x) ;

This subroutine is supported only by the IML procedure.

The MCD subroutine computes the minimum covariance determinant estimator. The MCD call is the robust estimation of multivariate location and scatter, defined by minimizing the determinant of the covariance matrix computed from h points. The algorithm for the MCD subroutine is based on the FAST-MCD algorithm given by Rousseeuw and Van Driessen (1999).

These robust locations and covariance matrices can be used to detect multivariate outliers and leverage points. For this purpose, the MCD subroutine provides a table of robust distances.

In the following discussion, N is the number of observations and n is the number of regressors. The input arguments to the MCD subroutine are as follows:

opt

refers to an options vector with the following components (missing values are treated as default values):

opt[1]

specifies the amount of printed output. Higher option values request additional output and include the output of lower values.

0

prints no output except error messages.

1

prints most of the output.

2

additionally prints case numbers of the observations in the best subset and some basic history of the optimization process.

3

additionally prints how many subsets result in singular linear systems.

The default is opt[1]=0.

opt[2]

specifies whether the classical, initial, and final robust covariance matrices are printed. The default is opt[2]=0. The final robust covariance matrix is always returned in coef.

opt[3]

specifies whether the classical, initial, and final robust correlation matrices are printed or returned. The default is opt[3]=0.

0

does not return or print.

1

prints the robust correlation matrix.

2

returns the final robust correlation matrix in coef.

3

prints and returns the final robust correlation matrix.

opt[4]

specifies the quantile h used in the objective function. The default is opt[4]= h equals left bracket StartFraction upper N plus n plus 1 Over 2 EndFraction right bracket. If the value of h is specified outside the range StartFraction upper N Over 2 EndFraction plus 1 less than or equals h less than or equals StartFraction 3 upper N Over 4 EndFraction plus StartFraction n plus 1 Over 4 EndFraction, it is reset to the closest boundary of this region.

opt[5]

specifies the number upper N Subscript normal upper R normal e normal p of subset generations. This option is the same as described for the LMS subroutine and the LTS subroutine. Due to computer time restrictions, not all subset combinations can be inspected for larger values of N and n.

When opt[5] is zero or missing:

  • If upper N greater than 600, up to five disjoint random subsets are constructed with sizes as equal as possible, but not to exceed 300. Inside each subset, upper N Subscript normal upper R normal e normal p Baseline equals 500 divided by 5 equals 100 subset combinations of n observations are chosen.

  • If upper N less than or equals 600, the number of subsets is taken from the following table.

    n 1 2 3 4 5 6 7 or more
    upper N Subscript normal l normal o normal w normal e normal r 500 50 22 17 15 14 0

  • If the number of observations N is smaller than upper N Subscript normal l normal o normal w normal e normal r, as given in the table, then all possible subsets are used; otherwise, upper N Subscript normal upper R normal e normal p Baseline equals 500 subsets are chosen randomly. This means that an exhaustive search is performed for opt[5]=negative 1.

x

refers to an upper N times n matrix bold upper X of regressors.

Missing values are not permitted in x. Missing values in opt cause default values to be used for each option.

The MCD subroutine returns the following values:

sc

is a column vector that contains the following scalar information:

sc[1]

the quantile h used in the objective function

sc[2]

number of subsets generated

sc[3]

number of subsets with singular linear systems

sc[4]

number of nonzero weights w Subscript i

sc[5]

lowest value of the objective function upper F Subscript normal upper M normal upper C normal upper D attained (smallest determinant)

sc[6]

Mahalanobis-like distance used in the computation of the lowest value of the objective function upper F Subscript normal upper M normal upper C normal upper D

sc[7]

the cutoff value used for the outlier decision

coef

is a matrix with n columns that contains the following results in its rows:

coef[1,]

location of ellipsoid center

coef[2,]

eigenvalues of final robust scatter matrix

coef[3:2+n,]

the final robust scatter matrix for opt[2]=1 or opt[2]=3

coef[2+n+1:2+2n,]

the final robust correlation matrix for opt[3]=1 or opt[3]=3

dist

is a matrix with N columns that contains the following results in its rows:

dist[1,]

Mahalanobis distances

dist[2,]

robust distances based on the final estimates

dist[3,]

weights (1 for small robust distances; 0 for large robust distances)

Example

Consider the Brownlee (1965) stackloss data used in the example for the MVE subroutine.

For upper N equals 21 and n equals 4 (three explanatory variables including intercept), you obtain a total of 5,985 different subsets of 4 observations out of 21. If you decide not to specify opt[5], the MCD algorithm chooses 500 random sample subsets, as in the following statements:

   /* Int X1  X2  X3   Y  Stackloss data */
aa = { 1  80  27  89  42,
       1  80  27  88  37,
       1  75  25  90  37,
       1  62  24  87  28,
       1  62  22  87  18,
       1  62  23  87  18,
       1  62  24  93  19,
       1  62  24  93  20,
       1  58  23  87  15,
       1  58  18  80  14,
       1  58  18  89  14,
       1  58  17  88  13,
       1  58  18  82  11,
       1  58  19  93  12,
       1  50  18  89   8,
       1  50  18  86   7,
       1  50  19  72   8,
       1  50  19  79   8,
       1  50  20  80   9,
       1  56  20  82  15,
       1  70  20  91  15 };

a = aa[,2:4];            /* X1-X3 */
opt = j(8, 1, .);
opt[1] = 2;              /* ipri */
opt[2] = 1;              /* pcov: print COV */
opt[3] = 1;              /* pcor: print CORR */

call mcd(sc, xmcd, dist, opt, a);

A portion of the output is shown in the following figures. Figure 250 shows a summary of the MCD algorithm and the final h points selected.

Figure 250: Summary of MCD

Fast MCD by Rousseeuw and Van Driessen
Number of Variables3
Number of Observations21
Default Value for h12
Specified Value for h12
Breakdown Value42.86
- Highest Possible Breakdown Value - 


Figure 251 shows the observations that were chosen that are used to form the robust estimates.

Figure 251: Selected Observations


MCD Estimates (Obtained by Subsampling and Iteration)


The best half of the entire data set obtained after full iteration consists of the cases:

456789101112131420


Figure 252 shows the MCD estimators of the location, scatter matrix, and correlation matrix. The MCD scatter matrix is multiplied by a factor to make it consistent with the data that come from a single Gaussian distribution.

Figure 252: MCD Estimators

MCD Location Estimate
VAR1VAR2VAR3
59.520.83333333387.333333333

MCD Scatter Matrix Estimate
 VAR1VAR2VAR3
VAR15.18181818184.81818181824.7272727273
VAR24.81818181827.60606060615.0606060606
VAR34.72727272735.060606060619.151515152

Consistent Scatter Matrix
 VAR1VAR2VAR3
VAR18.65784378158.05027579687.8983838007
VAR28.050275796812.7082970138.4553211199
VAR37.89838380078.455321119931.998580526


Figure 253 shows the classical Mahalanobis distances, the robust distances, and the weights that identify the outlying observations (that is, leverage points when explaining y with these three regressor variables).

Figure 253: Robust Distances

Classical Distances and Robust (Rousseeuw) Distances
Unsquared Mahalanobis Distance and
Unsquared Rousseeuw Distance of Each Observation
NMahalanobis DistancesRobust DistancesWeight
12.25360312.1732820
22.32474512.2556770
31.5937129.2639900
41.2718981.4013681.000000
50.3033571.4200201.000000
60.7728951.2911881.000000
71.8526611.4603701.000000
81.8526611.4603701.000000
91.3606222.1205901.000000
101.7459971.8097081.000000
111.4657021.3622781.000000
121.8415041.6674371.000000
131.4826491.4167241.000000
141.7787851.9882401.000000
151.6902415.8748580
161.2919345.6061570
172.7000166.1333190
181.5031555.7604320
191.5932216.1562480
200.8070542.1723001.000000
212.1767617.6227690


Robust distances are based on reweighted estimates.


The cutoff value is the square root of the 0.975 quantile of the chi square distribution with 3 degrees of freedom.


Points whose robust distance exceeds 3.0575159206 have received a zero weight in the last column above.


There were 9 such points in the data.


These may include boundary cases.


Only points whose robust distance is substantially larger than the cutoff should be considered outliers.


Last updated: April 11, 2025