Created
May 17, 2016 00:37
-
-
Save vladiim/d3037453bb25fb6ce20df8c43e0783ab 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
| chiS <- function(control_non_convert, control_convert, test_non_convert, test_convert) { | |
| control <- c(control_non_convert, control_convert) | |
| test <- c(test_non_convert, test_convert) | |
| d <- as.data.frame(rbind(control, test)) | |
| chisq.test(d) | |
| } | |
| diffReq <- function(control_non_convert, control_convert, confidence) { | |
| control_non_convert_test <- control_non_convert / 2 | |
| control_convert_test <- control_convert / 2 | |
| for (i in 1:control_non_convert_test) { | |
| test_non_convert <- control_non_convert_test - i | |
| test_convert <- control_convert_test + i | |
| pval <- chiS(control_non_convert_test, control_convert_test, test_non_convert, test_convert)$p.value | |
| if ((1 - pval) >= confidence) return(paste0("You need to convert: ", test_convert, " conversions to be ", confidence, " confident with your test result.")) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment