Welcome to Medical Statistics

  • ✔️ Find a seat and check in with the persons sitting next to you
  • ✔️ If you haven’t prepared R and RStudio, find somebody who did that you can sit next to.
  • ✔️ Check out the website https://danmazjen.github.io/medicinsk-statistik/

Before we start the session today…

Mac users

In you Terminal, run:

xcode-select --install

You need this to install the {medisr} package

This as been added to the website installation guide

🙋‍♀️ do you have R & RStudio?

Why Medical statistics?

Why Medical statistics?

Trup declaring medis needs to learn more R stats

Reason 1

Why Medical statistics?

Trup declaring medis needs to learn more R stats

Reason 2

Medical science
and clinical practice

depends on
→

Medical statistics

Medical science
and clinical practice

depends on
→
←
informed by

Medical statistics

Jobs that emphasize statistical literacy

Branch Job Statistical literacy needed?
🧬 Biomedicine Research Scientist High
Biomedical Researcher High
Biomarker Scientist High
Clinical/Preclinical Researcher High
Bioinformatics Scientist Very high
Diagnostics Development Scientist Moderate–high
Laboratory Scientist Moderate
Quality Control Specialist Moderate
Quality Assurance Specialist Moderate
Laboratory Operations Coordinator Low
💊 Translational Medicine Clinical Research Scientist High
Clinical Research Associate (CRA) Moderate
Clinical Trial Coordinator High
Clinical Data Scientist Very high
Drug Development Scientist High
Pharmacovigilance Scientist High
Medical Researcher Very-High
Regulatory Affairs Specialist Moderate-High
Clinical Operations Specialist Low–moderate
Clinical Project Coordinator Moderate
Medical Affairs Low–moderate
Quality/Compliance Low
📊 Medical Market Access Health Economist Very high
Health Economics Analyst Very high
HTA Analyst Very High
Market Access Analyst Very High
Pricing & Reimbursement Specialist High
Market Research Analyst High
Healthcare Data Analyst Very high
Market Access Manager Moderate
Healthcare Consultant Moderate
Procurement/Tender Specialist Low–moderate
Public Affairs/Stakeholder Relations Low
Business Development Low–moderate

🎉

hiding pain learning R-stats

Case 1: “Just send a quick summary”

A cardiology department at a regional hospital has been collaborating with a pharmaceutical company developing a new diagnostic support tool for chest pain patients. Before deciding whether to include your hospital in a larger clinical trial, the company asks for a quick baseline summary of your recent patients:

“Nothing complicated — just basic descriptive numbers so our statisticians can take a look.”

You are given a dataset of 303 patients admitted with chest pain (age, cholesterol, blood pressure, heart rate, etc.), along with whether they were later confirmed to have coronary artery disease. Your supervisor tells you:

“This is not a statistics task — we just need simple summaries like average values and variability for key variables. The statisticians will handle the rest.”

Later that day, you receive a follow-up email:

“Please report mean and standard deviation for age, cholesterol, resting blood pressure, and max heart rate, stratified by heart disease status. We need it today to decide whether your site qualifies.”

The data is stored in .csv format and the company has provided you access to a GDPR-friendly and secure server where all the company data are stored. The only software installed on the server is R and RStudio.

Case 1: “Just send a quick summary”

  • Any questions about words?
  • Is the task clear?
  • What skills will you need to master in order to do it?

Let’s practice reading some figures

What do you make of this plot?

What about this one?

What can we learn from data?

  • We saw how max heart rate vary between patients having coronary artery disease…
  • We saw how max heart rate change across peoples age…
  • Now, could it just be that the patients with coronary artery disease are older?
  • Let’s make a plot and check together!

Open your Rstudio

turtle-open-rstudio

Exploring the Heart Disease dataset

  1. Go to https://danmazjen.github.io/medicinsk-statistik, exercises, and find the Cleveland Heart Disease dataset

  2. Copy the following code:

hd_data <- medisr::hd_data
# or if you didn't manage to download the medisr package yet:
hd_data <- readr::read_csv("https://www.statlearning.com/s/Heart.csv")
  1. Paste it into your R console and check if you see the data in your variable pane.

Code-along

1library(ggplot2)

2hd_data
1
Tell R you will be using the ggplot2 package
2
Take hd_data, and then,

Code-along

1library(ggplot2)

2hd_data |>
3  ggplot(
4    aes(x = HD, y = Age)
5    ) +
6  geom_boxplot()
1
Tell R you will be using the ggplot2 package
2
Take hd_data, and then,
3
Make a ggplot skeleton
4
Select the x and y variables using aes (aestetics)
5
End the ggplot function that has a parenthesis open. Add + more…
6
Specify the type of plot you want ggplot to do with the skeleton

You made your first plot with R code! 🎉🥳

Medical Statistics

In this course, we will

  • develop statistical literacy skills
  • Learn to make medical inference from statistics
  • Perform statistics with the help of R

Develop statistical literacy skills

  • Interpret results from medical studies (e.g. p-values, confidence intervals, effect sizes)
  • Critically evaluate claims in clinical research and media
  • Identify common statistical pitfalls and misleading conclusions

Learn to make medical inference from statistics

  • Translate statistical results into clinically meaningful conclusions
  • Understand uncertainty and variability in patient outcomes
  • Statistical significance does not equal clinical importance — ask whether the result would actually change patient care

Perform statistics using R

  • Plotting data using ggplot2 as you’ve already experienced
  • Run statistical tests such as t-test, regression, etc.
  • Read and understand the R output

friends-with-r

🙋‍♀️ How many have read results in a paper and wondered what the numbers actually mean?

🙋‍♀️ How many have wondered how scientists make predictions for future disease probabilities?

🙋‍♀️ Would you be interested in learning how to navigate scientific claims based on data?

This course is for you 🎉

🚶🚶‍♀️ Do you have coding/programming experience?

Never <——-> I took a course in computer science

🚶🚶‍♀️ Are you scared of statistics?

Not at all <——-> I had nightmares about this course already

🚶🚶‍♀️ How good are you right now at statistics?

Ronald Fisher level <——-> Who is Ronald Fisher?

🚶🚶‍♀️ How high expectations do you have for yourself in this course?

I want to learn everything <——-> I don’t mind failing 1st time

The program for today:

Rest of the day: learning the basics of R for medical statistics

  • If you don’t have R installed yet - no break for you, sorry 👀
  • If you need help, grab hold of a teacher

Otherwise — 10 minutes break now!

friends-with-r

RStudio IDE

RStudio is a window that helps us navigate in R.

Setup and layout

General RStudio Options

  • Tools >> Global Options
    • General Save Workspace to .RData on exit (never)

  • Tools >> Global Options >> Code
    • Editing: Use native pipe operator

    • Saving: Automatically save when editor loses focus

Rest of session

See the website chapter 11.4

A gentle introduction to R