Statistical analysis plan template (SAP) for a thesis
A statistical analysis plan (SAP) is a document, written before you look at outcome data, that fixes exactly how you will analyse your data. A usable thesis SAP has 16 sections: administrative details, objectives and hypotheses, design, sample size, variable definitions, analysis populations, data cleaning, missing data, descriptive statistics, the primary analysis for each hypothesis, assumption checks with pre-decided fallbacks, secondary analyses, multiplicity, sensitivity and subgroup analyses, reporting, and a deviations log.
The outline below is adapted from the published guideline for clinical trial SAPs (Gamble et al., JAMA 2017), simplified for master's and PhD projects. That adaptation is our convention; if you are running a regulated clinical trial, use the full guideline and your trials unit's template.
Section-by-section SAP outline
| Section | What to write |
|---|---|
| 1. Administrative information | Title, version number and date, link to the protocol or ethics approval, who wrote and who approved the plan, and a version history. |
| 2. Background and objectives | The research questions and hypotheses exactly as they will be tested, each numbered so analyses can refer back to them. |
| 3. Study design | Design (for example cross-sectional survey, cohort, randomised trial), setting, timing of measurements, and any randomisation or blinding. |
| 4. Sample size | The target sample and how it was justified (power calculation with the effect size, alpha, power and its source; or a precision or feasibility rationale). |
| 5. Variables and outcomes | Each outcome and predictor with its definition, measurement instrument, scoring, level of measurement and time point. Name one primary outcome where your design has one. |
| 6. Analysis populations | Who is included in which analysis (for trials, for example, intention-to-treat and per-protocol), and the eligibility rules applied before analysis. |
| 7. Data management and cleaning | Range and consistency checks, handling of outliers (rule decided in advance), derived variables, and the software and version you will use. |
| 8. Missing data | How much you expect, how you will describe it, the assumed mechanism, and the main approach (for example complete-case or multiple imputation) with a sensitivity analysis. |
| 9. Descriptive statistics | Which summaries for which variables (mean and SD, median and IQR, counts and percentages), and the planned baseline or sample table. |
| 10. Primary analysis | For each hypothesis: the test or model, covariates and why, the effect measure with its confidence interval, and the significance level, sided-ness included. |
| 11. Assumption checks and fallbacks | Each assumption of the planned test, how it will be checked (plot or test), and what you will do if it is not met, decided now. |
| 12. Secondary and exploratory analyses | Listed separately and labelled as such, so they are not mistaken for confirmatory tests. |
| 13. Multiplicity | How you will handle multiple outcomes, groups or time points (for example a correction method, a hierarchy, or stating that results are exploratory). |
| 14. Sensitivity and subgroup analyses | Which ones, why, and how subgroup effects will be tested (an interaction term, not separate p-values per subgroup). |
| 15. Reporting | Planned tables and figures, decimal places, and the reporting guideline you will follow (for example CONSORT or STROBE). |
| 16. Deviations log | A dated record of every change after the plan was fixed, with the reason and whether it was made before or after seeing outcome data. |
Pre-specification: what it means in practice
Pre-specified means written down and dated before you see the results that the decision could influence. The point is to separate confirmatory tests from exploration, so that choices about covariates, outliers, transformations or which outcome to emphasise cannot be steered by the data. Practical steps:
- Finalise and date the SAP before unblinding, before linking outcome data, or at least before running outcome analyses.
- Share it with your supervisor and keep the dated copy; consider a public preregistration (for example on OSF) if your field expects it.
- Write fallbacks into the plan ("if residuals are clearly non-normal, we will use ..."), so most later changes are not deviations at all.
Assumption checks
For each planned test, list its assumptions and how you will check them. Common examples: independence of observations (a design question, not a test); approximately normal residuals and constant variance for linear models (inspect residual plots); linearity of continuous predictors; expected cell counts for chi-square tests; proportional hazards for Cox models. Prefer plots and judgement over relying solely on significance tests of assumptions, which are sensitive to sample size.
Deviations
Deviations are normal. What examiners and reviewers object to is undisclosed deviation. Record each change with the date, what changed, why, and whether you had seen outcome data. In the thesis, report the pre-specified analysis and the deviation, or explain clearly why the planned analysis was not possible.
Free download: SAP outline (fillable on paper)
A printable outline with all 16 sections, prompts under each, a hypothesis-to-test table with assumption checks and fallbacks, and a deviations log.
Download the PDF Three A4 pages. No email needed.
Do this in Notion
The free PDF is enough to do the job on paper. If you would rather keep it in one place that updates as you work, the Quantitative Analysis Plan is a Notion template that links each hypothesis to one planned test, lists that test's assumption checks, and flags every deviation from the plan with its date and reason.
It is a one-time purchase: Core $15, or Plus $24 with the AI pack. See exactly what is inside on the template page, or save by buying it with related templates in a bundle.
Sources
- Gamble C, Krishan A, Stocken D, et al. Guidelines for the content of statistical analysis plans in clinical trials. JAMA 2017;318(23):2337-2343. doi.org/10.1001/jama.2017.18556
- ICH E9: Statistical principles for clinical trials (1998) and E9(R1) addendum on estimands and sensitivity analysis (2019). www.ich.org/page/efficacy-guidelines
- Nosek BA, Ebersole CR, DeHaven AC, Mellor DT. The preregistration revolution. PNAS 2018;115(11):2600-2606. doi.org/10.1073/pnas.1708274114
Frequently asked questions
What is a statistical analysis plan?
A dated document, written before outcome data are analysed, that specifies the hypotheses, variables, statistical methods, assumption checks, missing data handling and sensitivity analyses you will use.
Do I need a statistical analysis plan for my thesis?
Not every programme requires one, but a SAP makes your methods chapter easier to write and helps you defend analytic choices in a viva. Clinical trials are generally expected to have one.
What is the difference between a protocol and a SAP?
The protocol describes the whole study; the SAP gives the detailed, technical analysis plan, often in more depth than the protocol's statistics section.
Can I change my SAP after collecting data?
Yes, but record each change as a dated deviation with the reason and whether you had seen outcome data, and report it transparently.
Is there an official SAP template?
For clinical trials, Gamble et al. (JAMA 2017) published guidelines on SAP content. The outline on this page is a simplified adaptation for student projects.