Go though LabAssignment5.pdf
LabAssignment5.pdf
Download LabAssignment5.Rmd
LabAssignment5.Rmd in RStudio and run codes inside. Things should be exactly same as LabAssignment5.pdf
.
Download, open LabAssignment5_boba.Rmd
LabAssignment5_boba.Rmd and save as a new Rmd file for your own Lab Assignment submission. Knit this Rmd file to see if you can make a html, pdf or words. If you couldn’t, just use RStudio Cloud or the Binder RStudio set by Po.
Run/add/edit/delete the codes in your own copy of LabAssignment5_boba.Rmd
and add/edit/delete some writings. Knit to see how the .pdf looks like. Tidy up the codes and writings. Knit and submit!
https://en.wikipedia.org/wiki/Lady_tasting_tea
https://en.wikipedia.org/wiki/Fisher%27s_exact_test
https://en.wikipedia.org/wiki/Ronald_Fisher
https://en.wikipedia.org/wiki/Muriel_Bristol
One day at Rothamsted, Ronald Fisher offered Bristol a cup of hot tea that he had just drawn from an urn. Bristol declined it, saying that she preferred the flavour when the milk was poured into the cup before the tea. Fisher scoffed that the order of pouring could not affect the flavour. Bristol insisted that it did and that she could tell the difference. Overhearing this debate, William Roach said, “Let’s test her.”
David Salsburg reports that a colleague of Fisher, H. Fairfield Smith, revealed that in the actual experiment the lady succeeded in identifying all eight cups correctly.
tea <- matrix(c(4,0,0,4),2,2)
rownames(tea) <- c(paste0(emo::ji("tea"), emo::ji("milk_glass")), paste0(emo::ji("milk_glass"), emo::ji("tea")))
colnames(tea) <- c(emo::ji("smile"), emo::ji("upset"))
knitr::kable(tea)
😄 | 😫 | |
---|---|---|
🍵🥛 | 4 | 0 |
🥛🍵 | 0 | 4 |
fisher.test(tea, alternative="greater")
##
## Fisher's Exact Test for Count Data
##
## data: tea
## p-value = 0.01429
## alternative hypothesis: true odds ratio is greater than 1
## 95 percent confidence interval:
## 2.003768 Inf
## sample estimates:
## odds ratio
## Inf
There is no secret ingredient. – Mr. Ping 🍜
Read the R Documentation of every functions you have seen.
?fisher.test
How Po knows all those built-in functions in R?
Way 1: Google it
Way 2: Read R Help/Documentation
Interactive R course lessons swirl https://swirlstats.com/students.html
Install swirl with the following commands.
# If you haven't installed the swirl package yet
install.packages("swirl")
library(swirl)
install_course_github("swirldev", "R_Programming_E")
After swirl is installed (you only need to do it once), you can start/resume the R tutorial with the commands:
library(swirl)
swirl()
Schedule some time to go though all the lessons by yourself! Almost all of the R codes you need to know are here in those lessons.
If you prefer more static readings (Po did read them to learn R!):
If you like RStudio’s data science things,