Marinstatslectures

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

Relative Risk, Odds Ratio and Risk Difference (aka Attributable Risk) in R (R Tutorial 4.8)

In this video, you will learn to calculate the relative risk, odds ratio and risk difference (also known as attributable risk) using the epiR package in R. The relative risk, odds ratio and attributable risk are all measures of the direction and the strength of the association between two categorical variables. These are numeric summaries for analyzing 2x2 tables, also known as cross-tabluations.

First, we will show you how to explore the relationships between variables by producing a 2-way table using the "table" command and a side-by-side bar plot using "barplot" command and "beside" argument. Tutorial 2.1 shows in detail how to produce a bar plot.

In this tutorial we will use the epiR package to calculate the summaries, although there are other options that you can choose from. Tutorial 1.10 explains in detail how to find packages and install them. You will learn to calculate relative risks, odd ratios and attributable risks using the "epi.2by2" command, to specify whether the data is from a cohort study or case-control study using the "cohort.count" or "case.control" arguments, and to set the confidence interval using the "conf.level" argument on this command.

We will demonstrate how to interpret the odds ratio. You will also learn to present the data in a table using the standard a,b,c,d notation of exposed/unexposed and diseased/not-diseased using "matrix" command or using square brackets and "cbind" commands.

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