Each QUBES Resource of the Week highlights openly licensed materials shared by QUBES users and partners.

Chi-squared test of independence between two categorical variables (Version 1.0)

By Matthew Aiello-Lammens

2018 Swirl FMN Logo



Module Description:

This resource is an activity designed to be completed in Swirl, an interactive platform for learning and teaching R in the RStudio console.  Instructors can learn more about Swirl and how to implement a Swirl lesson here. 

In this lesson, students will have the opportunity to work through a chi-squared test of independence between two categorical variables.  By the end of this lesson, the student should be able to 1) construct a contingency table using R, 2) use the `chisq.test` function to perform a chi-squared test of independence, and 3) interpret the results of this test. The example in this lesson uses data from Roberts, J. 1993. Regeneration and growth of coolibah, Eucalyptus coolibah subsp. arida, a riparian tree, in the Cooper Creek region of South Australia. Australian Journal of Ecology 18, 345–350. A more detailed analysis for this case study can also be found in Logan, M. 2010. Biostatistical Design and Analysis Using R. Wiley-Blackwell. PP 478-480.



Teaching Setting:

This resource was designed for a non-calculus based Introduction to Statistics for the Life Sciences course, which was comprised of primarily second and third year Biology, Biopsychology, Health Science, and Environmental Science students.  The students worked through this Swirl lesson after receiving a lecture on Chi-squared tests (approximately 1 hour). The lecture material is provided in this resource and was primarily based on those available from the OpenIntro Statistics (https://www.openintro.org/stat/textbook.php?stat_book=os) resources (https://docs.google.com/presentation/d/1BQ7kVN8IEWTCXENiFLdGXjsfbZijxCIgqbMpxLkujAc/edit#slide=id.g18ef082036_0_0). Students were encouraged to work in pairs as they proceeded through the lesson.



QUBES Citation:

Aiello-Lammens, M. (2019). Chi-squared test of independence between two categorical variables. Reducing Barriers to Teaching with R in Undergraduate Biology, QUBES Educational Resources. doi:10.25334/Q4244V


Visit Resource



Related Materials and Opportunities:

The author created this resource while participating in the Reducing Barriers to Teaching with R in Undergraduate Biology Faculty Mentoring Network (FMN) during the Fall 2018 semester.  In this FMN, participants focused on developing, implementing, and sharing modules for teaching statistical and biological concepts in R with Swirl, an interactive platform for learning and teaching R in the RStudio console. Swirl lessons simplify the R learning process by providing a guided, interactive experience through on-screen prompts and exercises which students answer directly in R. Swirl lessons can incorporate diverse biological datasets and can be used to seamlessly integrate learning of biology content, programming, and data analysis. The associated Swirlify package features a user-friendly shiny app for developing custom lessons.  Browse all Swirl lessons developed by participants in the the Reducing Barriers to Teaching with R in Undergraduate Biology FMN. 

Students can complete Swirl lessons using RStudio Cloud directly in their browsers - no software installation required.    

Another Swirl-focused FMN is running during the Spring 2019 semester: the Make Teaching with R in Undergraduate Biology Less Excruciating (Make TRUBLE) FMN.  Swirl lessons generated by FMN participants will be posted on the Make TRUBLE FMN site when they become available. 

If you are interested in staying up to date on the latest FMN information, be sure to subscribe to the QUBES Newsletter

Attention QUBES Partners:  If you are interested in sponsoring an FMN, please contact Deborah Rook at deb.rook “at” bioquest.org.  Learn how running your own FMN can further your project’s goals. 



If you adopt and adapt this module, you are highly encouraged to share your adaptation back with the QUBES community using the QUBES Resources System for sharing Open Education Resources.
QUBES on Social Media
QUBES is a community of math and biology educators who share resources and methods for preparing students to use quantitative approaches to tackle real, complex, biological problems.
Copyright © 2019 QUBES, All rights reserved.
P.O. Box 126, Boyds, MD 20841
You are receiving this email because you have shown interest in receiving updates from QUBES.

Subscribe / Unsubscribe from mailing list
View ROW on QUBESHub
QUBES Resource of the Week: Issue 28