Introducing hypothesis testing via the binomial distribution

Objective

To introduce students to hypothesis testing via the binomial test.By the end of the lesson, you should be able to

  • define and explain null hypothesis significance testing

  • develop null and alternative hypotheses

  • define a p-value and explain how it may obtained and interpreted

  • define statistical power, type I error, and type II error

  • contrast one- and two-sided tests

  • define binomial data and evaluate using binomial tests

  • develop confidence intervals for binomial data

  • relate hypothesis testing and estimation methods

Background reading

Course notes links for background reading also contain code used to produce R output used in slides.

Lecture slides (click to open in Google slides!)

Connected swirl lesson

Swirl is an R package that provides guided lessons to help you learn and review material. These lessons should serve as a bridge between all the code provided in the slides and background reading and the key functions and concepts from each lesson. A full course lesson (all lessons combined) can also be downloaded using the following instructions.

THIS IS ONE OF THE FEW TIMES I RECOMMEND WORKING DIRECTLY IN THE CONSOLE! THERE IS NO NEED TO DEVELOP A SCRIPT FOR THESE INTERACTIVE SESSIONS, THOUGH YOU CAN!

  • install the “swirl” package

  • run the following code once on the computer to install a new course

    library(swirl)
    install_course_github("jsgosnell", "JSG_swirl_lessons")
  • start swirl!

    swirl()
  • then follow the on-screen prompts to select the JSG_swirl_lessons course and the lessons you want

    • Here we will focus on the Hypothesis testing starting with binomial tests lesson
  • TIP: If you are seeing duplicate courses (or odd versions of each), you can clear all courses and then re-download the courses by

    • exiting swirl using escape key or bye() function

      bye()
    • uninstalling and reinstalling courses

      uninstall_all_courses()
      install_course_github("jsgosnell", "JSG_swirl_lessons")
    • when you restart swirl with swirl(), you may need to select

      • No. Let me start something new

Connected assignment(click here)

Using these skills and applying concepts correctly to interpret data sets may seem easy when you read about them or listen during class, but practice is key to ensuring you understand the material. Practice problems are provided for each lesson. The link above points you to the appropriate link in the course notes. You can make a copy (technically a fork, since you can’t directly edit it) of the entire course notes website in github @ https://github.com/jsgosnell/cuny_biostats_book and work from there. The benefit is this allows you to see updates to the site (if you sync your fork). The downside is you have to work interactively or build the entire site when you render a changed file. This is doable but may take more time than students need (and may lead to merge issues!).

Alternatively,your instructor may use a different delivery method (like github classroom) or provide alternative problems.

In general you should only work edit .qmd files! Everything/anything else is produced during the session and should not be edited. All files can be uploaded to github though.

Solutions are also provided for all problems via the course notes, but try them before you look at the answers!

Extra material

Data referenced in class

References

Bisazza, Angelo, Claudio Cantalupo, Andrew Robins, Lesley J. Rogers, and Giorgio Vallortigara. 1996. “Right-Pawedness in Toads.” Nature 379 (6564): 408–8. https://doi.org/10.1038/379408a0.
Fischer, Andreas, Yerin Lee, T’ea Dong, and Gerhard Gries. 2021. “Know Your Foe: Synanthropic Spiders Are Deterred by Semiochemicals of European Fire Ants.” Royal Society Open Science 8 (5): 210279. https://doi.org/10.1098/rsos.210279.
Geipel, Inga, Ciara E. Kernan, Amber S. Litterer, Gerald G. Carter, Rachel A. Page, and Hannah M. ter Hofstede. 2020. “Predation Risks of Signalling and Searching: Bats Prefer Moving Katydids.” Biology Letters 16 (4): 20190837. https://doi.org/10.1098/rsbl.2019.0837.
Hama, Yukihiro, Minoru Uematsu, Yutaka Sakurai, and Shoichi Kusano. 2001. “Sex Ratio in the Offspring of Male Radiologists.” Academic Radiology 8 (5): 421–24. https://doi.org/10.1016/S1076-6332(03)80550-0.
Klem, D. 1989. “Bird: Window Collisions.” The Wilson Bulletin 101 (4): 606–20. https://www.jstor.org/stable/4162790.
Perezgonzalez, Jose D. 2015. “Fisher, Neyman-Pearson or NHST? A Tutorial for Teaching Data Testing.” Frontiers in Psychology 6. https://www.frontiersin.org/journals/psychology/articles/10.3389/fpsyg.2015.00223.