Created
November 15, 2017 22:01
-
-
Save pierreroudier/19d212cf664487174062c22a9e6fe310 to your computer and use it in GitHub Desktop.
Quick comparison R2-CCC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(dplyr) | |
# Creating dummy data | |
d <- data.frame( | |
x = rnorm(100,10,3) | |
) %>% | |
mutate( | |
y = jitter(x, factor = 800) - 5 * cos(x/10) | |
) | |
# You can see a good fit btw preds and obs, but not with the 1:1 line | |
d %>% | |
ggplot(aes(x = x, y = y)) + | |
geom_abline(slope = 1, intercept = 0, lty = 2, colour = "red") + | |
geom_smooth(method = "lm", colour = "royalblue") + | |
geom_point() + | |
coord_equal() | |
# This problem in the predictions is overlooked by R-squared, | |
# but taken into account by the CCC | |
caret::R2(d$x, d$y) | |
epiR::epi.ccc(d$x, d$y)$rho.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment