flowchart TD
subgraph Q1["First quarter"]
P1["<b>Why and with whom</b><br/><i>reproducibility,<br/>teams, privacy</i>"]
P2["<b>Your toolkit</b><br/><i>R, Git, renv, Docker,<br/>compendium, AI</i>"]
P3["<b>Data in hand</b><br/><i>acquire, tidy, join,<br/>plot, impute,<br/>de-identify</i>"]
end
subgraph Q2["Second quarter"]
P4["<b>Documents and<br/>pipelines</b><br/><i>Quarto, targets,<br/>remote compute</i>"]
P5["<b>Analysis practice</b><br/><i>SAP, DMSP, tests, CI</i>"]
P6["<b>Industry</b><br/><i>CDISC, SAS</i>"]
P7["<b>Analysis to audience</b><br/><i>case studies, ethics,<br/>communication, deposit</i>"]
P8["<b>Capstone</b><br/><i>HF-HOME, export<br/>to deposit</i>"]
end
P1 --> P2 --> P3 --> P4 --> P5
P5 --> P6
P5 --> P7
P6 -.-> P8
P7 --> P8
1 Introduction
For the things we have to learn before we can do them, we learn by doing them.
Aristotle, Nicomachean Ethics, trans. W. D. Ross (c. 350 BCE)
1.1 What is ‘practicum’?
A practicum is a supervised, hands-on course of study. We intend this book as a practicum in the fullest sense: it teaches skills that cannot be acquired by reading, only by doing. Every chapter closes with exercises that require the reader to sit at a keyboard and produce an artifact, whether that is a Git commit, a Docker container, or a finished analysis report.
The book is the companion to Statistical Computing in the Age of AI, the methods-focused volume. The methods volume teaches what to compute and why; this volume teaches how to compute it reproducibly, so that the analysis survives scrutiny.
1.2 What this book covers
The book is organized into eight parts, and every chapter belongs to one of them. Table 1.1 names, for each part, the question it answers, its chapters, and the tools it teaches. Parts I to III are the first quarter of the two-quarter sequence. They cover why the work is done this way, the tools it is done with, and the path from raw files to a dataset you can trust. The tools include the project environment: the lockfile, the container, and the research compendium, so that the work rebuilds on another machine from the start. Parts IV to VIII are the second quarter. They cover the document that reports the analysis, the pipeline and remote compute that scale it, and the plan and tests that make it defensible. They also cover the industrial conventions the analysis may have to meet, its delivery to an audience, and a capstone that does all of it on one study.
| Part | The question it answers | Chapters | Key tools |
|---|---|---|---|
| Why and with whom | Why work reproducibly, and what do you owe your collaborators and the people in the data? | Chapter 2, Chapter 3, Chapter 4 | The three kinds of reproducibility, the intake conversation, the HIPAA pathways |
| Your toolkit | What do you work with every day, how do you keep a history of it, and how does it run on another machine? | Chapter 5 (optional), Chapter 6, Chapter 7, Chapter 8, Chapter 9, Chapter 10, Chapter 11, Chapter 12 | R and an IDE, Git and GitHub, renv, Docker, the research compendium, language models and coding agents |
| Data in hand | How do raw files become an analysis dataset you can trust? | Chapter 13, Chapter 14, Chapter 15, Chapter 16, Chapter 18, Chapter 19 (optional), Chapter 20, Chapter 21, Chapter 22 | readr, dplyr, tidyr, forcats, stringr, lubridate, ggplot2, naniar, mice; optionally SQL and dbplyr |
| Documents and pipelines | How does the analysis become a document that rebuilds itself, and how does it scale beyond one laptop? | Chapter 23, Chapter 24, Chapter 25 | Quarto, targets, remote compute |
| Analysis practice | How do you show that the analysis was planned in advance and computes what it claims? | Chapter 26, Chapter 27 | The statistical analysis plan (SAP) and data management and sharing plan (DMSP), Git tags, tinytest, GitHub Actions |
| Industry | How does the work meet the conventions of regulated drug development? | Chapter 28, Chapter 29 | SDTM, ADaM, SAS |
| Analysis to audience | How does a finished analysis reach its readers honestly, and in a form they can check? | Chapter 30, Chapter 31, Chapter 32, Chapter 33, Chapter 34 | Computed reports, the memo, the response to reviewers, repositories and DOIs |
| Capstone | Can you take one study from raw export to deposit? | Chapter 35 | All of the above |
The order is a dependency order. The environment comes before the data, so that every dataset is built in a project that already rebuilds on another machine. The first quarter ends with data in hand because everything in the second quarter acts on a dataset. A Quarto document reports on it, a plan constrains what may be done with it, and a deposit archives it. In this ordering, ethics and deposition come late, and deliberately so. Deposition is instruction about handing over something you have not built until then. The ethics chapter argues that the infrastructure of this book is orthogonal to whether an analysis misleads. That argument is only persuasive once the infrastructure has been built. (A print volume may place the ethics chapter earlier, beside de-identification, as a prerequisite rather than a conclusion. Either order teaches the same argument.)
Eight appendices follow. The first covers alternative wrangling paradigms, for reading code that is not tidyverse (Appendix A). The second is the survey of peer programs on which several chapters base their case for existing (Appendix B). The third is an inventory of the lab’s own software (Appendix C). Several chapters use this software, and we disclose it rather than distribute it quietly. The remaining five are a glossary (Appendix D), an instructor guide (Appendix E), a survey of AI tooling as of this edition (Appendix F), a guide to migrating R Markdown projects (Appendix G), and an index to every chapter’s cheat sheet (Appendix H).
Figure 1.1 shows the shape of the whole. A reader who skips ahead will find the later parts assuming the earlier ones.
1.3 What this book does not cover
- The statistical theory underlying specific models (linear, generalized linear, mixed, survival). For that, see the companion book Statistical Computing in the Age of AI or a standard reference.
- Experimental design, sample-size calculation, or causal inference beyond what is needed to execute an analysis plan.
- Specialized computing platforms (Bioconductor, Stan, deep-learning frameworks) beyond brief mention.
- The algorithms of computational statistics: numerical optimization, Monte Carlo and simulation design, the bootstrap, and Bayesian computation. These dominate many peer statistical-computing courses; here they are the territory of the companion volume.
- Statistical theory in any depth.
The trade-off is deliberate. On the one hand, a deeper treatment of any single method would merit a volume of its own. On the other, the analyst who cannot move a finished analysis through the full workflow is poorly served by depth alone. We have therefore aimed for breadth across the workflow rather than depth on any one method.
1.4 Who this book is for
The intended reader is a graduate student or early-career biostatistician who has working R fluency and is now learning to operate professionally: that is, working on teams, satisfying regulatory requirements, and producing reproducible artifacts that survive peer review.
We assume the following of the reader:
- R proficiency at the level of R for Data Science (Wickham, Çetinkaya-Rundel, and Grolemund, 2nd edition).
- Familiarity with statistical methods at the master’s level (linear and generalized linear models, basic survival, regression diagnostics).
- Comfort with the command line and basic file- system operations.
We do not, on the other hand, assume any of the following:
- Prior Git, Docker, or
renvexperience. - Prior collaboration with clinical investigators.
- Experience with regulatory or industry-sponsored research.
1.5 How to read this book
For each chapter, the workflow we recommend is the following:
- Read the chapter through once, without running code. Notice the structure: the card, the opening quiz, the sections with their checks and callouts, the exercises.
- Replicate the examples in your own environment. Type, do not copy-paste. The typing forces you to read each character; the copy-paste does not.
- Do the exercises without consulting an LLM. The cognitive cost of producing the answer yourself is, it appears, part of the learning.
- Extend by sending the LLM prompt callouts to a language model and critiquing the responses against your own work.
The book is, we grant, somewhat dense. Reading two chapters per week is a sustainable pace. At that pace the whole book is a two-quarter sequence, with Parts I to III in the first quarter and Parts IV to VIII in the second. A one-quarter core path of twenty chapters is laid out in the preface. Most of the learning happens in the exercises; the chapters support them.
1.6 The habits this book teaches
The book has one idea under all of its tools: make silent failures loud. The errors that damage an analysis are rarely the ones that stop it. A join that multiplies rows, a package update that changes a number, and a figure built from a stale intermediate file all run without complaint. Each chapter teaches a habit that turns one of those quiet failures into a loud one, and each habit below is numbered so that later chapters can point back to it.
- The compendium is the unit. Code, data, environment, and document travel together, in one declared structure.
- Raw data are evidence; derived data are a build product. Never edit what you received; regenerate everything else.
- Version control from day one. Every change is a commit; tag what you submit.
- Pin the environment. Snapshot writes the lockfile, restore reads it, and a container pins what the lockfile cannot.
- Pre-specify, then tag. Write the analysis plan and tag it before you see the outcome.
- Count before and after every join. Declare the relationship you expect and let the code refuse anything else.
- Convert late, validate early. Keep types loose while reading and cleaning; check them hard before modeling.
- A bug that produces a plausible number is the expensive kind. A bug that produces
NAannounces itself; write the assertion that makes the quiet one loud. - Test the statistics, not the shape. A test that only checks that a column exists passes on a wrong answer.
- Every number in the prose is computed. Typed numbers drift from the analysis that produced them.
- Lead with the answer, and match the verb to the design. Say what you found first; say ‘is associated with’ unless the design licenses ‘causes’.
- Every model output is a hypothesis until verified. Send a language model structure, not data, and check what it returns as you would check a junior colleague’s work.
You do not need to memorize the list now. Every chapter ends by naming the habits it has exercised, and Chapter 35 returns to the whole list.
1.7 Getting help
Ask in the course forum first, where the people answering know the book and the running study. Beyond the course, Posit Community (https://forum.posit.co) answers questions about R, the tidyverse, Quarto, and RStudio, and Stack Overflow answers well-posed programming questions tagged r.
Whoever you ask, send a minimal reproducible example: the smallest code, with the smallest synthetic data, that shows the problem. The reprex package runs your code in a clean session and formats the code and its output for pasting, so a missing library() call or an object that exists only in your workspace shows up before anyone else sees it. A display-only example:
reprex::reprex({
library(dplyr)
visits <- tibble::tibble(id = c(1, 1, 2), sbp = c(120, NA, 135))
visits |>
summarize(mean_sbp = mean(sbp))
})A reprex is habit 1 at its smallest scale: code and data that travel together and run on someone else’s machine. Building one often answers the question before you post it.
Never post protected health information, rows of any dataset held under a data-use agreement, or credentials such as tokens, passwords, and keys, even in a private message. The rules are the same as for a language model (habit 12), and Section 12.3 sets them out: send structure, not data.
To report an error in this book, open an issue in the repository’s issue tracker (https://github.com/rgt47/practicum/issues); each page of the HTML edition links to it. Name the chapter and section, quote the passage, and say what you expected.
1.8 The chapter pattern
Every chapter follows the same template, and the Conventions page before this introduction describes its visual elements. In order:
- Opening. A paragraph that states the problem the chapter solves, usually as a failure that runs without error, followed by an epigraph.
- Pipeline diagram. The analysis pipeline with the stage the chapter teaches highlighted.
- Chapter card. Reading time; what you’ll need from earlier chapters and which packages the code loads; what you’ll be able to do; and an outline.
- Skip ahead? Three open-ended questions, in the style of Advanced R (Wickham, 2019). If all three come easily, you can bypass the chapter. Answers appear in the Prerequisites-answers section at the end, and each quiz links directly to them.
- Sections. Each teaches one idea through a worked example on the running study, and ends with exercises (solutions folded beneath them) and a Check: a short question with its answer folded inside.
- Callouts within the sections. A Verification is a command that confirms a worked example did what it claims; a Pitfall is a silent failure that analysts actually hit; an LLM prompt is a prompt for a language model or coding agent, placed beside the task it helps with, together with the check that verifies its output.
- Rules of thumb. The numbered habits the chapter has exercised, each restated as a rule.
- Cumulative practice. Exercises that combine this chapter with earlier ones, and one to do on your own work.
- Cheat sheet. The chapter’s commands in one table, each with the check that confirms it worked.
- Further reading and Prerequisites answers.
Because the pattern repeats, by the third chapter the reader will know where to find each component.
1.9 On the Age-of-AI framing
The companion textbook is titled Statistical Computing in the Age of AI. This Practicum is named for its content (Biostatistics Practicum) rather than the AI framing, but the framing is present throughout. Chapters carry LLM prompt callouts showing how to use AI assistance for the chapter’s tools, each with the check that verifies the output, and Chapter 12 is the chapter on AI-assisted coding more generally. The ‘LLM’ in the callout title is shorthand. It covers both a chat interface and a coding agent, such as Claude Code, that reads a project’s files and edits them directly. Chapter 12 treats the distinction and when each is the right tool.
The position the books take is consistent. Large language models, and the coding agents built on them, increase analyst productivity. They do not replace analyst judgment. The chapters argue this by demonstration. We encourage the reader to use the AI assistance the book describes, to verify it the way the book describes, and to form their own view.
1.10 What this book is, in three sentences
This is a graduate practicum in the daily work of biostatistical data analysis. It comprises eight parts: why and with whom the work is done, the toolkit, data in hand, documents and pipelines, analysis practice, industry, analysis to audience, and a capstone. The test of the book, in our view, is whether the reader who has worked through it can produce a reproducible, defensible analysis of a real biomedical question with an interdisciplinary team, using AI assistance without being misled by it.