Learn R Programming

matrixCorr (version 0.12.3)

robust_ccc: MCD based robust concordance correlation coefficient

Description

Computes pairwise robust concordance correlation coefficients from the numeric columns of a matrix or data frame. The estimator replaces the classical means, variances, and covariance in Lin's concordance coefficient with joint minimum covariance determinant estimates.

Classical concordance can be strongly distorted by outliers because it depends directly on means, variances, and covariance. The minimum covariance determinant is a high breakdown estimator of multivariate location and scatter. It is designed primarily for data with an approximately elliptically symmetric and unimodal core distribution. It is not universally robust or distribution free.

Usage

robust_ccc(
  data,
  alpha = 0.75,
  ci = FALSE,
  conf_level = 0.95,
  n_boot = 500L,
  seed = NULL,
  na_method = c("error", "complete", "pairwise"),
  output = c("matrix", "sparse", "edge_list"),
  threshold = 0,
  diag = TRUE,
  mcd_nsamp = 500L
)

Value

A standard matrixCorr correlation result. Dense output has class c("corr_matrix", "robust_ccc", "corr_result", "matrix"). Confidence intervals are stored in the standard ci attribute with ci.method = "percentile_bootstrap". The result records alpha = alpha, mcd_nsamp = mcd_nsamp, and mcd_estimate = "reweighted".

Arguments

data

A numeric matrix or data frame containing at least two numeric columns. Non numeric columns in a data frame are ignored.

alpha

Numeric scalar in \([0.5, 1]\). This controls the fraction of observations used by the minimum covariance determinant estimator. Approximately alpha * n observations define the high quality subset. Lower values provide greater resistance to contamination. The approximate trimmed fraction is 1 - alpha. Default 0.75.

ci

Logical. If TRUE, attach paired nonparametric percentile bootstrap confidence intervals. Default FALSE.

conf_level

Confidence level used when ci = TRUE. Default 0.95.

n_boot

Positive integer giving the number of bootstrap resamples used when ci = TRUE. Default 500.

seed

Optional positive integer controlling both the stochastic FastMCD point estimates and bootstrap resampling. Stable offsets are used for different variable pairs. If NULL, the current R random number stream is used.

na_method

Character scalar controlling missing data handling. "error" rejects missing, NaN, and infinite values. "complete" removes rows that are incomplete in any retained numeric column before all estimates are calculated. "pairwise" selects finite rows separately for each variable pair.

output

Output representation. One of "matrix", "sparse", or "edge_list".

threshold

Nonnegative absolute value filter for sparse and edge list outputs. It must be zero for matrix output.

diag

Logical. Whether sparse and edge list outputs include diagonal entries.

mcd_nsamp

Positive integer giving the number of subsets used for initial estimates in the FastMCD search. Passed to the nsamp argument of robustbase::covMcd(). Default 500L. This is a search count, not the subset size controlled by alpha or the number of bootstrap resamples controlled by n_boot. Only numeric counts up to .Machine$integer.max are supported, not the character modes of covMcd().

Author

Thiago de Paula Oliveira

Details

For each paired sample, let \(\hat\mu_{X,MCD}\) and \(\hat\mu_{Y,MCD}\) be the components of the joint MCD location estimate. Let \(\hat\sigma^2_{X,MCD}\), \(\hat\sigma^2_{Y,MCD}\), and \(\hat\sigma_{XY,MCD}\) be entries of the joint MCD scatter estimate. The robust concordance estimate is $$ \hat\rho_R = \frac{2\hat\sigma_{XY,MCD}} {\hat\sigma^2_{X,MCD} + \hat\sigma^2_{Y,MCD} + (\hat\mu_{X,MCD} - \hat\mu_{Y,MCD})^2}. $$

The joint location and scatter are fitted with robustbase::covMcd() using raw.only = FALSE and nsamp = mcd_nsamp. Consequently, this function uses the final reweighted MCD estimates rather than the raw MCD subset estimates. No population moment rescaling is applied.

The default mcd_nsamp = 500L retains the published software convention. Larger counts increase the search effort and generally increase computation time. Changing the count can change the numerical MCD solution, and hence the coefficient and confidence interval, even with the same seed. The same count is used for every pair and every bootstrap refit. With a nonnull seed, repeated calls are reproducible for fixed data, arguments, and seed.

Reweighting is part of this estimator and is not a user option. Even when alpha = 1, the final covMcd() location and scatter can still be reweighted and must not be replaced by ordinary sample moments.

At least three finite paired observations are required for basic computability. An MCD fit can still be undefined for a very small or geometrically degenerate sample. If either robust marginal scatter is effectively zero, the corresponding coefficient is undefined and NA is returned. A diagonal entry is one only when its robust scatter is estimable and nondegenerate.

Confidence intervals are a matrixCorr inference extension. They are not an interval proposed by Bulut, Zobu, and Sağlam. Each bootstrap replicate samples paired rows with replacement and recalculates the complete MCD estimator. Failed or nonfinite replicate estimates are omitted before the percentile limits are calculated. The diagnostics attribute contains n_boot_success when intervals are requested. Interval calculation is expensive because every variable pair requires n_boot additional MCD fits. Its leading cost is \(O(p^2 B \mathop{\mathrm{cost}}(\text{bivariate MCD}))\).

This estimator retains the form and interpretation of Lin's concordance coefficient. It differs from the robust concordance variants of King and Chinchilli, which use alternative distance or loss functions. It also differs from the Bayesian robust concordance estimator of Feng, Baumgartner, and Svetnik, which uses heavy tailed multivariate modelling.

References

Bulut H, Zobu M, Sağlam V (2026). A High-Breakdown MCD-Based Robust Concordance Correlation Coefficient. Mathematics 14(1), 196. tools:::Rd_expr_doi("10.3390/math14010196")

Hubert M, Debruyne M, Rousseeuw PJ (2018). Minimum covariance determinant and extensions. WIREs Computational Statistics 10, e1421. tools:::Rd_expr_doi("10.1002/wics.1421")

Rousseeuw PJ, Van Driessen K (1999). A Fast Algorithm for the Minimum Covariance Determinant Estimator. Technometrics 41, 212 to 223. tools:::Rd_expr_doi("10.1080/00401706.1999.10485670")

King TS, Chinchilli VM (2001). Robust estimators of the concordance correlation coefficient. Journal of Biopharmaceutical Statistics 11, 83 to 105. tools:::Rd_expr_doi("10.1081/BIP-100107651")

Feng D, Baumgartner R, Svetnik V (2015). A Robust Bayesian Estimate of the Concordance Correlation Coefficient. Journal of Biopharmaceutical Statistics 25, 490 to 507. tools:::Rd_expr_doi("10.1080/10543406.2014.920342")

Crawford SB and colleagues (2007). Computer programs for the concordance correlation coefficient. Computer Methods and Programs in Biomedicine 88, 62 to 74. tools:::Rd_expr_doi("10.1016/j.cmpb.2007.07.003")

See Also

robustbase::covMcd(), ccc(), pbcor(), wincor()

Examples

Run this code
# Three measurement methods with an approximately normal core
set.seed(42)
x <- rnorm(40)
measurements <- cbind(
  reference = x,
  method_a = x + rnorm(40, sd = 0.2),
  method_b = 0.4 + 1.2 * x + rnorm(40, sd = 0.3)
)
fit <- robust_ccc(measurements, seed = 42)
print(fit)
summary(fit)
estimate(fit)
coef(fit)
tidy(fit)
plot(fit)

# Compare classical and robust CCC before and after discordant contamination
contaminated <- measurements
contaminated[1, "reference"] <- 9
contaminated[1, "method_a"] <- -8
fit_contaminated <- robust_ccc(contaminated, seed = 42)
rbind(
  clean = c(
    classical = estimate(ccc(measurements))[1, 2],
    robust = estimate(fit)[1, 2]
  ),
  contaminated = c(
    classical = estimate(ccc(contaminated))[1, 2],
    robust = estimate(fit_contaminated)[1, 2]
  )
)

# Alpha controls the retained subset fraction, not the search count
fit_half <- robust_ccc(contaminated, alpha = 0.5, seed = 42)
estimate(fit_half)

# Increase the initial subset search count while retaining reweighted MCD
fit_more <- robust_ccc(contaminated, mcd_nsamp = 1000L, seed = 42)
attr(fit_more, "mcd_nsamp")
attr(fit_more, "mcd_estimate")

# Global complete rows versus the finite overlap for each pair
incomplete <- measurements
incomplete[1, "reference"] <- NA
incomplete[2, "method_a"] <- Inf
fit_complete <- robust_ccc(incomplete, na_method = "complete", seed = 42)
fit_pairwise <- robust_ccc(incomplete, na_method = "pairwise", seed = 42)
estimate(fit_complete)
estimate(fit_pairwise)

# Thresholded outputs retain entries with absolute CCC at least 0.9
# Every MCD pair is still fitted before output conversion
fit_sparse <- robust_ccc(
  measurements, seed = 42, output = "sparse", threshold = 0.9, diag = FALSE
)
fit_edges <- robust_ccc(
  measurements, seed = 42, output = "edge_list", threshold = 0.9, diag = FALSE
)
fit_sparse
tidy(fit_edges)

# Paired percentile bootstrap intervals require many additional MCD fits
# \donttest{
# A small count keeps this illustration short; the default is 500 resamples
fit_ci <- robust_ccc(
  measurements, ci = TRUE, conf_level = 0.95, n_boot = 100L, seed = 42
)
summary(fit_ci)
tidy(fit_ci)
ci(fit_ci)
confint(fit_ci)
plot(fit_ci)
attr(fit_ci, "diagnostics")$n_complete
# Off diagonal entries count finite bootstrap estimates
# Valid diagonal intervals are fixed at [1, 1] without refitting
attr(fit_ci, "diagnostics")$n_boot_success
# }

# Interactive viewing requires both suggested packages
if (interactive() &&
    requireNamespace("shiny", quietly = TRUE) &&
    requireNamespace("shinyWidgets", quietly = TRUE)) {
  view_corr_shiny(fit)
}

Run the code above in your browser using DataLab