Open educational resources for clinical research, biostatistics, epidemiology, data science, and outbreak research. This repository contains comprehensive Quarto documents with practical examples, code demonstrations, and best practices for statistical analysis in clinical settings.
As described in the contributions guide contributors need to have a copy of the repository either as a clone or a fork.
The repository can be cloned with Git, for example, over HTTPS:
git clone git+https://github.com/ISARICResearch/Learningor over SSH:
git clone git+ssh://git@github.com/ISARICResearch/LearningNote
If using SSH consult the GitHub SSH guide for more information on creating and setting up SSH keys to connect to your GitHub account.
Alternatively, if you're developing in a Git-integrated IDE such as VS Code then cloning can be performed within the IDE.
The repository can also be forked, if a fork is preferred, using the Fork option on the GitHub repository home page.
Before running any Quarto documents, install required packages:
source("setup_packages.R")Packages installed:
- tidyverse — Data manipulation and visualization
- gtsummary — Publication-quality summary tables
- report — Automated statistical reporting
- quarto — Quarto document rendering
- markdown — Markdown processing
- gt — Grammar of tables for formatted table output
- knitr — Dynamic document generation
The script checks for existing installations and only installs missing packages.
Navigate to the Introduction-to-Statistics-for-Clinical-Research-main/ directory and render any Quarto document (.qmd):
R:
quarto::quarto_render("Introduction-to-Statistics-for-Clinical-Research-main/1_Descriptive Statistics_CREDO.qmd")All Quarto documents are located in Introduction-to-Statistics-for-Clinical-Research-main/. The course is organized sequentially, starting with critical foundational modules before building to advanced statistical methods.
These modules establish essential R programming and conceptual skills required for all subsequent statistics modules.
File: Basic_R_Programming.qmd
Essential R skills for statistical analysis in clinical research.
Topics covered:
- R fundamentals (objects, vectors, data frames)
- Functions and function calling
- Type expectations and parameter validation
- Calling functions: step-by-step procedure
- Common errors and debugging
- Type safety in clinical data processing
- Clinical research examples
Why this matters:
- Functions are the foundation of all subsequent analysis
- Type mismatches cause silent wrong results (dangerous in clinical context)
- Understanding R prevents costly errors in data handling
Related documentation: See R_FUNCTIONS_GUIDE.md for comprehensive function reference with detailed type safety emphasis (611 lines)
File: R_FUNCTIONS_GUIDE.md (611 lines)
Comprehensive R functions reference with critical type safety emphasis.
Core concepts:
- Function anatomy and calling conventions
- Type expectations (numeric, character, logical, vector, data frame, list, NULL)
- Type mismatch: Common errors and silent wrong results
- Type checking and validation for clinical safety
- Parameter expectations and validation
- Best practices for calling functions safely
Why this matters:
- Silent failures are dangerous in clinical research
- Functions expect specific types (not optional)
- Wrong types can produce medically incorrect results without error messages
- Validation prevents dosing errors and data integrity problems
Clinical context examples:
- Medication dosing calculations
- Patient data processing
- Lab value calculations
- Data integrity verification
File: 1_Descriptive Statistics_CREDO.qmd
Foundational concepts for summarizing data in clinical research.
Topics covered:
- Data types and exploration (continuous, categorical, binary)
- Missing data handling and reporting
- Summary statistics (mean, median, standard deviation, IQR)
- Visualizing distributions (histograms, box plots)
- Stratified analysis and group comparisons
- Best practices for exploratory data analysis
Key callouts: Importance of data inspection, missing data risks, outlier detection, proportions vs. counts, summary statistics selection
Code examples: Real-world clinical datasets, patient demographics, lab values
File: 2_Populations and Samples.qmd
Understanding sampling designs and population inference.
Topics covered:
- Population vs. sample concepts
- Sampling methods and bias
- Sample size calculations
- Representativeness and generalizability
File: 3_Probability and Confidence Intervals.qmd
Quantifying uncertainty in clinical estimates.
Topics covered:
- Probability distributions (normal, binomial, t-distribution)
- Central limit theorem
- Confidence intervals (interpretation and calculation)
- Standard error and margin of error
Files:
4.1_Hypothesis Testing and Rank Tests.qmd(Part 1)4.2_Hypothesis Testing and Rank Tests.qmd(Part 2)
Statistical testing for clinical hypotheses.
Topics covered:
- Hypothesis testing framework (null/alternative hypotheses)
- Type I and Type II errors, power
- t-tests, ANOVA, chi-squared tests
- Rank-based tests (Mann-Whitney U, Wilcoxon signed-rank, Kruskal-Wallis)
- Multiple comparisons and corrections
File: 5_Linear and Logistic Regression_CREDO.qmd
Modeling relationships between variables.
Topics covered:
- Linear regression (simple and multiple)
- Model assumptions and diagnostics
- Logistic regression for binary outcomes
- Odds ratios and model interpretation
- Model comparison and goodness-of-fit
Enhancements:
- 10 strategic callouts on regression best practices
- New Output 4.5: Statistical Model Comparison with side-by-side metrics
- Emphasis on clinical vs. statistical significance
- Confounding and covariate adjustment
- Outlier impact and removal decisions
Key callouts: Regression assumptions, visual data inspection, coefficient interpretation, correlation vs. causation, outlier handling, model comparison
File: 6_Survival Analysis_CREDO.qmd
Analyzing time-to-event outcomes with censoring.
Topics covered:
- Censoring and time-to-event data
- Kaplan-Meier survival curves
- Log-rank test for group comparisons
- Cox proportional hazards model (univariable and multivariable)
- Hazard ratios and interpretation
- Proportional hazards assumption checking
Enhancements:
- 8 strategic callouts on survival analysis best practices
- Improved document structure with consistent heading hierarchy
- Clear progression: concept → data setup → visualization → testing → adjustment
- Clinical context and interpretation guidance
Key callouts: Censoring definition, data preparation, Kaplan-Meier features, Cox output interpretation, confounding adjustment, hazard ratio interpretation
| File | Purpose |
|---|---|
PIPE_OPERATORS_GUIDE.md |
Base R pipe |> vs. magrittr pipe %>% comparison, with clinical examples |
R_FUNCTIONS_GUIDE.md |
Comprehensive R functions reference with type safety and parameter validation (611 lines) |
CLINICAL_RESEARCH_STATISTICS_COMPLETE.md |
Complete enhancement summary across all modules |
| File | Purpose |
|---|---|
OUTLIER_ANALYSIS_SUMMARY.md |
Outlier detection and removal methodology |
ANOVA_COMPARISON_SUMMARY.md |
Statistical model comparison techniques |
SURVIVAL_ANALYSIS_ENHANCEMENTS.md |
Detailed survival analysis improvements |
FUNCTIONS_EXPANSION_SUMMARY.md |
Type safety and parameter validation expansion |
- Render individual modules as needed in your course
- Modify code examples to match your clinical context
- Extract callouts for emphasis on key concepts
- Use comparison tables (e.g., model comparison in Module 5) for teaching statistical decision-making
- Run the setup script to install dependencies
- Start with Basic R Programming module — Covers essential R skills and type safety
- Consult R_FUNCTIONS_GUIDE.md — Deep dive on functions and parameter validation
- Work through statistics modules sequentially (1 → 6) for comprehensive foundation
- Execute code chunks to see output; modify and experiment
- Review callouts for best practices and common pitfalls
- Study clinical examples to understand real-world application
- Start with Basic R Programming (prerequisite) for essential R foundations
- Study R_FUNCTIONS_GUIDE.md for deep understanding of functions and type safety
- Progress through statistics modules (1 → 6) at your own pace
- Use supporting documentation for deeper dives (pipe operators, survival analysis)
- Reference guides for syntax and implementation details
credo-learning/
├── README.md (this file)
├── setup_packages.R (run this first!)
├── R_FUNCTIONS_GUIDE.md (comprehensive functions reference — read after Basic R Programming)
├── LICENSE
├── Introduction-to-Statistics-for-Clinical-Research-main/
│ ├── Basic_R_Programming.qmd ⭐ START HERE (prerequisite)
│ ├── 1_Descriptive Statistics_CREDO.qmd ⭐ ENHANCED
│ ├── 2_Populations and Samples.qmd
│ ├── 3_Probability and Confidence Intervals.qmd
│ ├── 4.1_Hypothesis Testing and Rank Tests.qmd
│ ├── 4.2_Hypothesis Testing and Rank Tests.qmd
│ ├── 5_Linear and Logistic Regression_CREDO.qmd ⭐ ENHANCED
│ ├── 6_Survival Analysis_CREDO.qmd ⭐ ENHANCED
│ ├── *.html (rendered outputs)
│ ├── *_files/ (Quarto support directories)
│ └── README.md (module-level documentation)
├── PIPE_OPERATORS_GUIDE.md
├── CLINICAL_RESEARCH_STATISTICS_COMPLETE.md
└── [other documentation files]
✅ Clinical Context — All examples use realistic clinical research scenarios
✅ Best Practices — 30+ strategic callouts highlighting key concepts and pitfalls
✅ Executable Code — Every code chunk is fully functional and tested
✅ Statistical Rigor — Emphasis on assumptions, diagnostics, and proper interpretation
✅ Type Safety — R function guide emphasizes type expectations and validation
✅ Comprehensive — 7 sequential modules covering statistics fundamentals to survival analysis
- R ≥ 4.1 (for base pipe
|>) - Quarto ≥ 1.3
- Packages (installed via
setup_packages.R):- tidyverse, gtsummary, report, quarto, markdown, gt, knitr
See LICENSE file for terms and conditions.
- Review the callouts in each Quarto document for best practices
- Consult
PIPE_OPERATORS_GUIDE.mdfor pipe syntax questions - Reference
R_FUNCTIONS_GUIDE.mdfor function calling and type safety - Check individual module READMEs for module-specific guidance
Repository members who manage access, maintenance and change management issues are listed below:
- Esteban Garcia-Gallo - esteban.garcia@ndm.ox.ac.uk
- Sara Duque Vallejo - sara.duquevallejo@ndm.ox.ac.uk
- Sandeep Murthy - sandeep.murthy@ndm.ox.ac.uk
- Esteban Garcia-Gallo - esteban.garcia@ndm.ox.ac.uk
- Ibrahim Kwaku Duah - kwakuduah@kccr.de
- Robert Asampong - r.asampong@kccr.de
A general set of contributions guidelines and basic workflow is described here.
Additional aspects include those listed below.
- Test all code examples thoroughly
- Add clinical context where helpful
- Document any structural changes
- Ensure git tracking is clean (HTML files in
.gitignore) - Update this README with new modules or features