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/

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.

Medical science and clinical practice relies on statistics

Medical statistics relies on clinical knowledge and patient data

Medical science and clinical practice relies on statistics

What do you make of this plot?

What about this one?

Can we spot heart disease from simple data?

Max heart rate and coronary heart disease…

Max heart rate and age…

Age and coronary heart disease?

Exploring the Heard 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 <- readr::read_csv("https://raw.githubusercontent.com/DanMazJen/medicinsk-statistik/main/data/hd_data.csv")
  1. Past 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

Medical Statistics

In this course, we will

  • develop statistical literacy skills
  • Learn to make medical inference from statistics
  • Perform statistics using 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

🙋‍♀️ 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

Please open your RStudio now

5 minutes break

We’ll start again by learning the basics of R for medical purposes

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

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

Getting or asking for help 🙋‍♀️🙋‍♂️

  • Put the red origami hat on your laptop to get help
  • We are 2-3 teachers eager to help
  • Table mates, try to help out too
  • We’re all learning here!
    • This is a supportive and safe environment
    • Remember our Code of Conduct