Marinstatslectures

Like Us on FacebookFollow Us on TwitterSubscribe to Us on Youtube!Join Us on Google+

Chi-Square Test, Fishers Exact Test, and Cross Tabulations in R (R Tutorial 4.7)

In this video, you will learn to conduct the Chi-Square test of independence, a parametric method used for testing independence between two categorical variables, and Fisher's Exact test, a nonparametric equivalent to chi-square test, as well as produce cross tabulations.

In this tutorial we will first explain when it is appropriate to use the chi-square test of independence to analyze the data. Then you will learn to produce a contingency table for two categorical variables in R using the "table" command and a barplot to visually examine the relationship between two categorical variables before conducting the chi-square test of independence. Here, you will also learn to use the “besides” argument to produce clustered bar charts.

Next, we will demonstrate how to use the "chisq.test" command in R to produce the chi-square test. In this video, you will learn to use additional arguments on the "chisq.test" command; for example you will be able to use the "correct" argument to do the Yate's continuity correction for the test.

Later in the video, you will learn to ask R to return attributes stored in an object using "attributes" command and extract certain attributes from an object using the ($). You will also learn when to use Fisher's exact test, how to use the "fisher.test" command in R to do the test, how to ask R to return confidence interval for the odds ratio using the "conf.int" argument and to set the desired level of confidence using the "conf.level" argument on the "fisher.test" command.

We recommend using the link below to download the dataset and practice on your own while watching this tutorial.

 

You can access and download the dataset that was used in this tutorial here:

Tab Delimited LungCapDataset for R TutorialsExcel LungCap Dataset for R Tutorials

 

 

Previous Video in Series 4 R Tutorials

Back to Series 4 R Tutorials

Next Video in Series 4 R Tutorials