Created
August 2, 2016 15:13
-
-
Save revodavid/d88be24806cabbdace431f34cc8661a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| set.seed(1) | |
| N <- 2000 | |
| P <- 0.01 | |
| rare_success <- sample(c(TRUE, FALSE), N, replace=TRUE, prob=c(P, 1-P)) | |
| guess_not <- rep(0, N) | |
| plot(roc(rare_success, guess_not), print.auc=TRUE) | |
| ## | |
| ## Call: | |
| ## roc.default(response = rare_success, predictor = guess_not) | |
| ## | |
| ## Data: guess_not in 1978 controls (rare_success FALSE) < 22 cases (rare_success TRUE). | |
| ## Area under the curve: 0.5 | |
| simp_roc <- simple_roc(rare_success, guess_not) | |
| with(simp_roc, lines(1 - FPR, TPR, col="blue", lty=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment