CCC <- function(x, y) { ## Purpose: ## Calculate Concordance Correlation Coefficient (CCC). ## Evaluate agreement in a unitless way: CCC is between -1 and 1, with perfect (reverse) agreement at 1 (-1). ## Ref: (Page 258-289) Lawrence, I., and Kuei Lin. "A concordance correlation coefficient to evaluate reproducibility." Biometrics (1989): 255-268. ## ## Author: Feiming Chen (Copyright 2026; GPLv3; No Warranty; gnu.org/licenses) ## ## Arguments: ## - x : a numeric vector ## - y : a numeric vector (equal length as "x"; not checked) ## ## Return: ## - CCC : Concordance Correlation Coefficient (for a paired sample) ## ________________________________________________ CCC <- 2 * cov(x, y) / (var(x) + var(y) + (mean(x) - mean(y))^2) CCC } if (F) { # Unit Test CCC(1:10, 1:10) # 1 CCC(1:10, 10:1) # -1 CCC(1:10, rep(1, 10)) # 0 CCC(1:10, 11:20) # 0.15493 }
Friday, April 24, 2026
Calculate Concordance Correlation Coefficient (CCC)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment