## S3 method for class 'numeric'
ccc(actual, predicted, correction = FALSE, ...)
## S3 method for class 'numeric'
weighted.ccc(actual, predicted, w, correction = FALSE, ...)
ccc(
...,correction = FALSE
)
weighted.ccc(
...,
w,correction = FALSE
)
Concordance Correlation Coefficient
ccc.numeric | R Documentation |
Description
A generic function for the concordance correlation coefficient. Use weighted.ccc()
for the weighted concordance correlation coefficient.
Usage
Arguments
actual
|
A |
predicted
|
A |
correction
|
A |
…
|
Arguments passed into other methods. |
w
|
A |
Value
A <numeric>
vector of length 1.
Definition
Let \(\rho_c \in [0,1]\) measure the agreement between \(y\) and \(\upsilon\). The classifier agreement is calculated as,
\[ \rho_c = \frac{2 \rho \sigma_{\upsilon} \sigma_y}{\sigma_{\upsilon}^2 + \sigma_y^2 + (\mu_{\upsilon} - \mu_y)^2} \]
Where:
-
\(\rho\) is the pearson correlation coefficient
-
\(\sigma_y\) is the unbiased standard deviation of \(y\)
-
\(\sigma_{\upsilon}\) is the unbiased standard deviation of \(\upsilon\)
-
\(\mu_y\) is the mean of \(y\)
-
\(\mu_{\upsilon}\) is the mean of \(\upsilon\)
If correction == TRUE
each \(\sigma_{i \in [y, \upsilon]}\) is adjusted by \(\frac{1-n}{n}\)
Examples
# 1) fit a linear
# regression
<- lm(
model ~ .,
mpg data = mtcars
)
# 1.1) define actual
# and predicted values
# to measure performance
<- mtcars$mpg
actual <- fitted(model)
predicted
# 2) evaluate in-sample model
# performance
cat(
"Concordance Correlation Coefficient", ccc(
actual = actual,
predicted = predicted,
correction = FALSE
),"Concordance Correlation Coefficient (corrected)", ccc(
actual = actual,
predicted = predicted,
correction = TRUE
),"Concordance Correlation Coefficient (weigthed)", weighted.ccc(
actual = actual,
predicted = predicted,
w = mtcars$mpg/mean(mtcars$mpg),
correction = FALSE
),sep = "\n"
)