EDA with R: From Basic Stats to Advanced Plots

Coursera · Beginner ·🛠️ AI Tools & Apps ·8mo ago

Key Takeaways

Explores healthcare data using R and Tidyverse for EDA

Full Transcript

Welcome. Let's say you're a data analyst at an important hospital and you're trying to understand all the different metrics that are associated with your patients and see how we can provide more care or actually better care. We'll be using the tidyverse library to achieve this goal. We'll be performing EDA or exploratory data analysis where we go into the data, try to understand if there's any issues and try to make a story out of it. First, let's begin with loading our library and our data set. All right, let's try to look at it. We see very common columns such as ids, age, other numeric metrics, some boolean and categorical metrics such as insurance, hospital visits, and diabetes status. All right, let's clean this variable. I'm sorry, this terminal. And let's start by calculating the mean for these numerical categories. Again, you can do mean or median. You want to make sure to add this parameter NA. RM equals true to avoid using any NAS in your analysis. Let's run this and see what happens. Beautiful. As we expected, we can see that we have created the mean values for all these categories. Age, PMI, blood pressure systolic, and blood pressure diastolic. Now, let's move on to the plot, the fun part. First, let's create a histogram using the GM histogram with a bin width of five, which is a customizable parameter. Let's run this. As you can see, we have a simple histogram but powerful. The insights we can graph from here is that the majority of our patients are in the 50 to around 60 age group. All right. Now, let's move in and add a new layer coloring. in this case by insurance type. We do this by using the fill parameter and adding the column that we're [clears throat] interested in as a color. Now, as you can see, we have the same plot, but now with extra coloring. This will allow us to see a big picture of the types of insurance that we have in our patient pool. In this case, public and private are the majority with very few having none. Now let's move into a different type of plot, a box plot. In this case, denoted by the geomeore box plot. We're also adding a new layer which is the labs parameter where we add titles. In this case, a nice overarching title BM BMI by gender as well as titles for the X and Y axis. Turn this As you can see, this bar is immediate. We also can see any outliers from this as well as our titles for our plots. Beautiful. This is great. All right. Now, we're going into a different type of plot, a scatter plot or a GM underscore plot. We also have this alpha parameter, which is the thickness of the points. Let's plot BMI versus blood pressure systolic and see what it looks like. All right. In this case, we can see a scattering, a lot of scattering, not much of a trend, but at least we can visualize everything. This will allow us to understand whether we have patients with really high blood pressure. In this case, for example, this one, very low BMI, but really high blood pressure. Might be worth looking into this patient. Now let's see as we're trying to understand the data we're trying to put numerical values to it. In this case correlation let's see if we can plot the correlation value for BMI versus blood pressure systolic which we plotted in the previous plot. Remember to use use equals complete.obs to only use complete observations or in other words entries that have no NAS. Let's clean the terminal so it's much cleaner. And this, as you can see, we have a correlation of nearly 1%. Quite low. It makes sense. A lot of the data was really scattered. But remember, you can do this with any numerical combination, so it's worth investigating. Now, let's circle back to the box plot and see if we can combine what we learned where we're adding a plot and then using the fill parameter to add some coloring to it. In this case, the insurance type versus the number of hospital visits. All right, let's see how this looks. Beautiful. Just as we expected, a box plot with coloring. This is fantastic. Remember all these plots are customizable. So it's at your disposal to try to understand what the best combination of color and viewing will attract your audience attention. Now let's circle back and try to understand what we did today and understand that we did a lot of parts of EDA starting with analyzing general statistics and then moving on to visualizations and customization of these visualizations where we learned about histogram plots, box plots and scatter plots. We also learned how to calcate a correlation which is a very powerful statistic. And there you have it. We learned a lot but you're doing great. So keep going and happy coding.

Original Description

Learn how to analyze healthcare data using R and Tidyverse. Follow along as we explore patient data through statistics and visualizations, perfect for healthcare analysts and data science beginners. 🕐 Timestamps: 0:00 - Introduction & Setup 0:32 - Loading Healthcare Dataset 1:01 - Basic Statistical Analysis 1:31 - Creating Histograms 2:02 - Insurance Type Analysis 2:32 - Box Plots & Demographics 3:19 - Scatter Plots 4:04 - Correlation Analysis 4:48 - Advanced Visualizations 5:24 - Summary & Best Practices 🎓 This is a course preview of the *Microsoft R Programming for Everyone Professional Certificate* on Coursera. With the complete program, you'll: • Learn to write efficient R code • Collaborate through GitHub • Analyze complex datasets • Use AI tools to enhance productivity • No prior programming experience needed • Build a professional portfolio of hands-on projects using real datasets in a Microsoft development environment Enroll now to access the complete 5-course program 👇 https://bit.ly/4nNMkGi #HealthcareAnalytics #DataScience #RProgramming
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Coursera · Coursera · 0 of 60

← Previous Next →
1 Principles of Obesity Economics with Professor Kevin Frick
Principles of Obesity Economics with Professor Kevin Frick
Coursera
2 Introduction to the U.S. Food System: Perspectives from Public Health by John Hopkins University
Introduction to the U.S. Food System: Perspectives from Public Health by John Hopkins University
Coursera
3 E-learning and Digital Cultures
E-learning and Digital Cultures
Coursera
4 Equine Nutrition with Jo-Anne Murray
Equine Nutrition with Jo-Anne Murray
Coursera
5 Coursera Meetup BBQ
Coursera Meetup BBQ
Coursera
6 Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Coursera
7 Nutrition for Health Promotion and Disease Prevention with Katie Clark
Nutrition for Health Promotion and Disease Prevention with Katie Clark
Coursera
8 Information Security and Risk Management in Context with Dr. Barbara Endicott-Popovsky
Information Security and Risk Management in Context with Dr. Barbara Endicott-Popovsky
Coursera
9 Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Coursera
10 Writing in the Sciences with Kristin Sainani
Writing in the Sciences with Kristin Sainani
Coursera
11 Economic Issues, Food, and You with Jennifer Clark
Economic Issues, Food, and You with Jennifer Clark
Coursera
12 Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Coursera
13 Useful Genetics with Professor Rosie Redfield
Useful Genetics with Professor Rosie Redfield
Coursera
14 A History of the World since 1300!!!! with Jeremy Adelman
A History of the World since 1300!!!! with Jeremy Adelman
Coursera
15 Microeconomics  with Richard McKenzie
Microeconomics with Richard McKenzie
Coursera
16 Discrete Optimization with Professor Pascal Van Hentenryck
Discrete Optimization with Professor Pascal Van Hentenryck
Coursera
17 Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Coursera
18 Science from Superheroes to Global Warming with Michael Dennin
Science from Superheroes to Global Warming with Michael Dennin
Coursera
19 Introduction to Digital Sound Design with Steve Everett by Emory University
Introduction to Digital Sound Design with Steve Everett by Emory University
Coursera
20 Women and the Civil Rights Movement with Dr. Elsa Barkley Brown
Women and the Civil Rights Movement with Dr. Elsa Barkley Brown
Coursera
21 Galaxies and Cosmology with S. George Djorgovski
Galaxies and Cosmology with S. George Djorgovski
Coursera
22 Science, Technology, and Society in China I, II, and III: Basic Concepts with Naubahar Sharif
Science, Technology, and Society in China I, II, and III: Basic Concepts with Naubahar Sharif
Coursera
23 Introduction to Pharmacy with Kenneth M. Hale, R.Ph., Ph.D.
Introduction to Pharmacy with Kenneth M. Hale, R.Ph., Ph.D.
Coursera
24 AIDS with Kimberley Sessions Hagen, EdD
AIDS with Kimberley Sessions Hagen, EdD
Coursera
25 Health Informatics in the Cloud with Mark Braunstein
Health Informatics in the Cloud with Mark Braunstein
Coursera
26 Songwriting with Pat Pattison by Berklee College of Music
Songwriting with Pat Pattison by Berklee College of Music
Coursera
27 Software Defined Networking with Dr. Nick Feamster
Software Defined Networking with Dr. Nick Feamster
Coursera
28 Epigenetic Control of Gene Expression with Dr Marnie Blewitt
Epigenetic Control of Gene Expression with Dr Marnie Blewitt
Coursera
29 Guitar for Beginners - Introduction to Guitar with Thaddeus Hogarth by Berklee College of Music
Guitar for Beginners - Introduction to Guitar with Thaddeus Hogarth by Berklee College of Music
Coursera
30 Organizational Analysis with Daniel McFarland
Organizational Analysis with Daniel McFarland
Coursera
31 Scientific Computing with J. Nathan Kutz
Scientific Computing with J. Nathan Kutz
Coursera
32 Jazz Improvisation - Introduction to Improvisation with Gary Burton by Berklee College of Music
Jazz Improvisation - Introduction to Improvisation with Gary Burton by Berklee College of Music
Coursera
33 Principles of Economics for Scientists with Antonio Rangel
Principles of Economics for Scientists with Antonio Rangel
Coursera
34 Introduction to Music Production with Loudon Stearns by Berklee College of Music
Introduction to Music Production with Loudon Stearns by Berklee College of Music
Coursera
35 Principles of Public Health with Zuzana Bic
Principles of Public Health with Zuzana Bic
Coursera
36 The Science of Gastronomy with King Chow, Lam Lung Yeung by HKUST
The Science of Gastronomy with King Chow, Lam Lung Yeung by HKUST
Coursera
37 The Language of Hollywood: Storytelling, Sound, and Color with Scott Higgins by Wesleyan University
The Language of Hollywood: Storytelling, Sound, and Color with Scott Higgins by Wesleyan University
Coursera
38 Nutrition and Physical Activity for Health with John M. Jakicic, Ph.D., and Amy D. Rickman,...
Nutrition and Physical Activity for Health with John M. Jakicic, Ph.D., and Amy D. Rickman,...
Coursera
39 Nutrition, Health, and Lifestyle: Issues and Insights with Jamie Pope, MS, RD, L
Nutrition, Health, and Lifestyle: Issues and Insights with Jamie Pope, MS, RD, L
Coursera
40 Survey of Music Technology with Jason Freeman by Georgia Institute of Technology
Survey of Music Technology with Jason Freeman by Georgia Institute of Technology
Coursera
41 Exercise Physiology: Understanding the Athlete Within with Mark Hargreaves
Exercise Physiology: Understanding the Athlete Within with Mark Hargreaves
Coursera
42 Canine Theriogenology for Dog Enthusiasts with Margaret V. Root
Canine Theriogenology for Dog Enthusiasts with Margaret V. Root
Coursera
43 Web Intelligence and Big Data with Gautam Shroff
Web Intelligence and Big Data with Gautam Shroff
Coursera
44 Critical Perspectives on Management with  Rolf  Strom-Olsen
Critical Perspectives on Management with Rolf Strom-Olsen
Coursera
45 El ABC  del emprendimiento esbelto  with Sergio  Ortiz Valdes
El ABC del emprendimiento esbelto with Sergio Ortiz Valdes
Coursera
46 Interprofessional Healthcare Informatics with Karen  Monsen
Interprofessional Healthcare Informatics with Karen Monsen
Coursera
47 Creativity, Innovation, and Change with Jack V. Matson, Darrell Velegol and Kath
Creativity, Innovation, and Change with Jack V. Matson, Darrell Velegol and Kath
Coursera
48 Innovacion educativa con recursos abiertos with Maria Soledad Ramirez Montoya an
Innovacion educativa con recursos abiertos with Maria Soledad Ramirez Montoya an
Coursera
49 Inspiring Leadership through Emotional Intelligence with Richard Boyatzis
Inspiring Leadership through Emotional Intelligence with Richard Boyatzis
Coursera
50 Matematicas y movimiento with
Matematicas y movimiento with
Coursera
51 Sustainability of Food Systems: A Global Life Cycle Perspective with Jason Hill
Sustainability of Food Systems: A Global Life Cycle Perspective with Jason Hill
Coursera
52 Latin American Culture with Enrique Tames
Latin American Culture with Enrique Tames
Coursera
53 Latin American Culture' with undefined
Latin American Culture' with undefined
Coursera
54 Computer Security with Dan Boneh
Computer Security with Dan Boneh
Coursera
55 Introduction to Art: Concepts & Techniques
Introduction to Art: Concepts & Techniques
Coursera
56 Programmed cell death
Programmed cell death
Coursera
57 El ABC  del emprendimiento esbelto
El ABC del emprendimiento esbelto
Coursera
58 Understanding economic policymaking
Understanding economic policymaking
Coursera
59 History of Rock, Part 1 by University of Rochester
History of Rock, Part 1 by University of Rochester
Coursera
60 Pensamiento Cientifico
Pensamiento Cientifico
Coursera

Related Reads

📰
AI Inventory Rebalancing: The Smarter Way to Eliminate Stockouts and Excess Inventory
Learn how AI inventory rebalancing can help eliminate stockouts and excess inventory, and why it matters for growing businesses
Medium · AI
📰
I kept losing the things AI made for me, so I built an iPhone library for them
Build a library to organize AI-generated content and improve productivity
Dev.to AI
📰
The Real App-Building Kit for Non-Technical Founders: Trustworthy AI-Powered Development
Non-technical founders can build and extend apps using AI-powered development kits without coding expertise, learn how to get started
Dev.to AI
📰
“5 AI Tools That Can Save You Hours Every Week”
Discover 5 AI tools to boost productivity and save hours every week, including Chat GPT, Grammarly, Notion AI, Otter.ai, and Canva's Magic Studio
Medium · AI

Chapters (10)

Introduction & Setup
0:32 Loading Healthcare Dataset
1:01 Basic Statistical Analysis
1:31 Creating Histograms
2:02 Insurance Type Analysis
2:32 Box Plots & Demographics
3:19 Scatter Plots
4:04 Correlation Analysis
4:48 Advanced Visualizations
5:24 Summary & Best Practices
Up next
How To Deploy Lovable App To Netlify 2026 | Full Guide
Tutorial Stack
Watch →