## ------------------------------------------------------------------------ binom.test(x = 8, n = 10) ## ------------------------------------------------------------------------ binom.test(16, 20) ## ------------------------------------------------------------------------ binom.test(x = 51, n = 235, p = 1/6, alternative = 'greater') ## ------------------------------------------------------------------------ binom.test(x = 8, n = 9) ## ------------------------------------------------------------------------ # These two give the same answer chisq.test(x = c(50, 50)) # But here we explicitly state the probability chisq.test(x = c(50, 50), p = c(0.5, 0.5) ) ## ------------------------------------------------------------------------ chisq.test(x = c(50,50), p = c(3/4, 1/4)) ## ------------------------------------------------------------------------ prop.test(c(4, 196), c(40, 3270)) ## ------------------------------------------------------------------------ count <- matrix(c(38, 14, 11, 51), nrow = 2, dimnames = list(c('gnocchi', 'pasta'), c('grass', 'peas'))) count chisq.test(count) ## ------------------------------------------------------------------------ TeaTasting <- matrix(c(3, 1, 1, 3), nrow = 2, dimnames = list(Guess = c("Milk", "Tea"), Truth = c("Milk", "Tea"))) TeaTasting fisher.test(TeaTasting, alternative = "greater")