Lab 3

Project 3 – ER Visits Overview

Agenda

  1. Positron Installation

  2. Lab Review Worksheet (15 minutes)

  3. Overview of Project 3

  4. Work through select parts of Project 3

  5. Group work and time for questions

Positron Installation

Lab Review Worksheet

15:00

Group work to review essential material. To get started, Visit the following GitHub repository and read the README.md file.



https://www.github.com/berkeley-stat133/worksheet-lab3

ER Visits Project Overview

  • Dataset: Collected by 25 Pediatric Emergency Care Applied Research Network (PECARN) emergency rooms on patients with minor head trauma.

  • Goal: Practive Exploratory Data Analysis, a key step in most data science project.

  • Client: Dr. Bayes, a pediatric emergency physician and researcher with PECARN.

Project Overview

We will work through three major steps:

  1. Data Cleaning
    Prepare the dataset so it can be analyzed effectively.
  2. Exploratory Data Analysis (EDA)
    Use visualizations and summaries to find interesting patterns.
  3. Reporting Results
    Communicate findings clearly to Dr. Bayes.

Data Cleaning

Why clean data?

  • Ensure consistent formats in columns
  • Handle missing (NA) or inconsistent values
  • Makes dataset easier to work with

Key dplyr functions:

  • slice(), select(), arrange()
  • mutate(), filter(), summarise(), group_by()

Exploratory Data Analysis (EDA)

  • Purpose: uncover insights and understand the data before modeling

  • Tools:

    • ggplot2 for visualization.
    • dplyr for summary tables and quick data manipulation.
    • tidyr for reshaping.
    • readr for reading data.
    • ALL part of the tidyverse 🔥😮‍💨🙏💯

Exploratory Data Analysis (EDA)

  • Common plots:
    • Bar charts (categorical variables)
    • Histograms (continuous variables)
    • Scatterplots (relationship between two variables)
    • Boxplots and Violin plots (distributions across groups)
    • Facets (compare subgroups)
  • Common summaries:
    • Missing value analysis
    • Counts and proportions
    • Means, medians, standard deviations

Example with ggplot2

library(ggplot2)
data |> 
    ggplot(aes(x = age, fill = ct_scan_needed)) + 
    geom_histogram(bins=18) + 
    labs(title = "Age Distribution by CT Scan Need",
         x = "Age (years)",
         y = "Count") +
    theme_minimal()

Step 3: Reporting to Dr. Bayes

Remember your audience:

Dr. Bayes is a clinician, not a statistician.

Use clear visuals and plain language.


Focus on actionable insights:

  • Which patients are at highest risk?

  • When might a CT be unnecessary?

Project Work Time

25:00

Get started on the project and feel free to ask questions.