Statistical analysis planning guide
How to Write a Statistical Analysis Plan: A Practical Guide
A statistical analysis plan describes how researchers intend to analyse their data to answer a scientific question. It translates study objectives into specific analytical procedures, explaining which observations will be analysed, how outcomes will be defined, which statistical methods will be used and how important sources of uncertainty will be addressed.
Writing a useful statistical analysis plan involves more than naming a statistical test. Researchers need to define the effect or association they want to estimate, choose methods that correspond to the study design and document important analytical decisions before the results can influence those choices.
This guide explains how to write a statistical analysis plan for clinical and biomedical research, with practical examples, common mistakes and a checklist for reviewing the completed document. It focuses on principles relevant to many study designs while explaining where additional requirements arise for randomised clinical trials.
A clinical research study involves a series of connected decisions, from defining the research question to publishing the findings. The six stages below provide a framework for understanding the research process and how the different parts of a study fit together.
- Develop the research question
- Plan the study
- Prepare and conduct the study
- Collect and manage data
- Analyse and interpret
- Write, submit and publish
Research rarely follows a perfectly straight path. For example, deciding how to analyse the data may reveal that you need additional measurements, a different study design or a revised recruitment target. These decisions are best resolved before data collection begins.
Table of contents
1. What is a statistical analysis plan?
A statistical analysis plan (SAP) is a document that describes the intended analyses for a research study. It explains how data will be prepared, which participants or observations will contribute to each analysis, how statistical models will be specified and how the results will be presented.
An SAP helps researchers make important decisions before seeing findings that might influence their choices. It also allows collaborators, reviewers and other qualified analysts to understand what was planned and whether the completed analyses followed that plan.
Why write an SAP?
Statistical analysis often involves decisions that can affect the estimated results. Researchers may choose between plausible models, include different covariates, transform variables, exclude observations or use alternative approaches to missing data. Sometimes these decisions are scientifically justified. However, selecting among them after examining the results can introduce bias, even without a deliberate attempt to obtain a favourable finding.
Prespecification reduces opportunities for such result-driven decisions. It can also reveal problems before data collection is complete, such as an imprecisely defined outcome or a measurement schedule that cannot support the intended model.
In 2017, Gamble and colleagues published consensus-based guidance for the content of clinical-trial SAPs in the Journal of the American Medical Association (JAMA) . Their recommendations comprise 55 items addressing analysis populations, outcomes, statistical methods, missing data and administrative information ( Gamble et al. 2017 ).
The guidance was developed for clinical trials, with particular relevance to medicinal-product trials. Many principles also apply to other intervention studies and observational research, although appropriate content and detail depend on the project.
An SAP does not guarantee valid results
A prespecified analysis can still be inappropriate. A poorly chosen model does not become scientifically defensible simply because it was documented before data collection. The purpose of an SAP is to improve clarity, transparency, reproducibility and analytical discipline. Researchers must still justify methods, examine relevant assumptions and interpret findings in relation to the study design.
2. When should you write and finalise an SAP?
Statistical planning should begin early enough to influence the study design, outcome definitions, measurement schedule and sample-size justification. Ideally, researchers establish the principal analytical strategy while developing the protocol, then document implementation details in the SAP.
The timing of final approval depends on the research design and applicable requirements. A central principle is that important analytical choices should be finalised before the people making those decisions have access to results that could influence them.
Prespecification is about access to information
Consider a clinical-trial statistician who remains unaware of participants’ treatment allocation. The statistician may be able to review certain pooled data-quality summaries or variable distributions without learning which intervention performed better. However, even blinded reviews can influence analytical decisions, so the scope of the review and resulting changes should be documented.
For a confirmatory randomised trial, an appropriate approach is to establish the main analysis early and finalise the detailed SAP before relevant unblinded comparative results are available. Sponsor, institutional and regulatory requirements may specify additional timing or approval procedures.
Kahan and colleagues developed the Pre-SPEC framework to help researchers prespecify statistical analyses sufficiently clearly to reduce selective analytical decision-making. Its five principles include making decisions early, identifying one primary analysis, specifying its components, allowing independent implementation and using deterministic rules where data-dependent choices are unavoidable ( Kahan et al. 2020 ).
What about retrospective and observational studies?
Retrospective studies present additional challenges because the data already exist when the research question or analysis plan is developed. Investigators may know the distribution of important variables, previous findings or results from earlier analyses. An SAP can still improve transparency and analytical consistency, but researchers should not describe decisions as prospectively specified if relevant information was already available.
Document when the plan was prepared, what data or results had been examined and which decisions were made subsequently. Where feasible, complete the SAP before inspecting the associations or comparisons intended to answer the research question.
The European Network of Centres for Pharmacoepidemiology and Pharmacovigilance (ENCePP) provides guidance on statistical planning for observational research, including the value of documenting analytical decisions and the difficulties posed by retrospective data ( ENCePP methodological guide ).
Can an SAP be changed?
Yes. Changes may be necessary when researchers discover an unexpected data structure, identify a problem with a planned model or encounter circumstances the original plan did not anticipate. An amendment should explain what changed, why it changed, when the decision was made and what relevant information was available. Changes made after examining results deserve particular scrutiny and transparent reporting.
If a proposed change alters the primary outcome, scientific question or intended treatment effect, the study protocol may also need amendment through the applicable procedures.
3. What is the difference between a research protocol and an SAP?
The research protocol describes the overall study, including its rationale, objectives, design, population, procedures, measurements and planned analysis. The SAP expands the statistical component into a detailed specification.
For a straightforward study, an appropriately detailed statistical section within the protocol may be sufficient. More complex projects, particularly regulated clinical trials, often benefit from or require a standalone SAP.
| Component | Research protocol | Statistical analysis plan |
|---|---|---|
| Primary purpose | Describe the planned study | Specify how the data will be analysed |
| Research objectives | Define the scientific questions | Connect each objective to an analysis |
| Outcomes | Identify and describe measurements | Define analytical variables and derivations |
| Study population | Describe eligibility and recruitment | Define who contributes to each analysis |
| Statistical methods | Summarise the intended approach | Specify models, covariates, contrasts and reporting |
| Missing data | Describe the intended strategy | Explain assumptions, procedures and sensitivity analyses |
| Documentation | Track study-level amendments | Track analysis-specific decisions and amendments |
The documents must remain consistent. If the protocol identifies clinic systolic blood pressure at 12 weeks as the primary outcome, the SAP should not quietly substitute a different measurement or timepoint.
For randomised trials, the Standard Protocol Items: Recommendations for Interventional Trials (SPIRIT) guideline explains the minimum information that should appear in a trial protocol. Its 2025 update recognises that detailed statistical methods may be documented in a separate SAP while requiring the protocol to describe important features of the intended analyses ( SPIRIT 2025 explanation and elaboration ).
For more on documenting the overall study, see How to Write a Research Protocol: A Practical Guide .
4. Start with the research question and effect of interest
Before specifying a statistical model, establish what the analysis is intended to estimate. Consider the fictional study used throughout this series: a 12-week parallel-group randomised trial comparing supervised exercise with usual care in adults with hypertension.
The primary objective is to estimate the effect of assignment to supervised exercise, compared with assignment to usual care, on clinic systolic blood pressure at 12 weeks. That objective provides a starting point, but further decisions are necessary. Which population is the comparison intended to describe? What happens if a participant stops attending exercise sessions? Will blood-pressure measurements collected after discontinuation remain relevant? How will the difference between groups be summarised?
These questions concern the effect being investigated, not simply the statistical test used.
Estimand: the effect we want to estimate
An estimand The specific effect or difference the study aims to learn about: what researchers want to know. precisely describes the treatment effect that a study aims to estimate. It defines what the researchers want to know, not how they will calculate it.
The International Council for Harmonisation of Technical Requirements for Pharmaceuticals for Human Use (ICH) develops international guidelines for pharmaceutical research and regulation. Its ICH E9(R1) addendum to the guideline on statistical principles for clinical trials introduces a framework for defining the effect of interest.
The framework specifies the treatment conditions, target population, outcome variable, population-level summary measure and strategies for handling events occurring after treatment assignment that affect the interpretation or existence of the outcome ( ICH E9(R1), via the European Medicines Agency ).
Such events are called intercurrent events . Examples include stopping the assigned intervention, switching treatment or receiving an additional therapy that affects the outcome.
For the exercise trial, the investigators may wish to estimate the effect of assignment to the supervised programme regardless of whether participants complete every session. Under a treatment-policy strategy , outcomes after intervention discontinuation can remain relevant to the question. Alternatively, the investigators might ask what the effect would have been if all participants had followed their assigned programme as intended. That is a different question, often requiring stronger assumptions and a different analytical strategy.
Estimator: the method used to estimate the effect
An estimator The statistical method used to calculate an estimate of that effect or difference from the data. is the statistical procedure used to estimate the quantity defined by the estimand. For example, a baseline-adjusted linear regression model might estimate the difference in mean systolic blood pressure between randomised groups. However, naming the model does not establish how intervention discontinuation is handled or whether missing outcomes can be adequately addressed.
Put simply: The estimand defines the question we want to answer. The estimator describes how we use the data to calculate an answer.
The distinction is useful beyond regulated clinical trials: define the scientific quantity of interest before choosing a method to estimate it. The estimand framework should also be applied with care because not all target effects can be estimated reliably from the available data ( BMJ estimands primer, 2024 ).
5. Define the analysis populations
An SAP must identify which participants or observations contribute to each analysis and how they will be classified. Terms such as intention to treat , modified intention to treat and per protocol are not sufficiently informative without operational definitions.
Intention-to-treat analyses
The intention-to-treat principle generally concerns analysing randomised participants according to their originally assigned groups, regardless of subsequent adherence. For the exercise trial, participants would retain their randomised group classification even if they stopped attending supervised sessions.
However, maintaining the original group classification does not resolve missing outcome data. If a participant has no 12-week blood-pressure measurement, the SAP must explain how that absence will be handled. A statement such as participants will be analysed according to intention to treat therefore needs further detail. Specify which participants are included, how the data will be handled and how the analysis supports the intended effect of interest.
Per-protocol and other populations
A per-protocol analysis commonly focuses on participants who satisfy predefined criteria concerning adherence or protocol compliance. The criteria should be justified and specified before examining the relevant results. For example, an exercise study might classify adherence using recorded session attendance.
However, restricting the analysis to adherent participants can compromise the comparability created by randomisation because adherence may be associated with prognosis, motivation or response to treatment. A simple per-protocol comparison does not automatically estimate the causal effect that would occur if everyone adhered to their assigned intervention. That question may require additional statistical methods and assumptions.
Studies may also define safety populations or other analysis sets. Explain their purpose, inclusion rules and group classification rather than relying on labels alone.
6. Define outcomes, variables and data preparation
The SAP should convert the outcomes identified in the protocol into precisely defined analytical variables. For the exercise trial, the primary outcome is mean clinic systolic blood pressure at 12 weeks. The SAP should identify the recorded values used to construct this measure, how multiple readings are summarised and which assessment is selected when measurements occur within an acceptable visit window.
Specify analytical variables
Relevant details include units, coding conventions, permitted values, variable derivations and the definition of the baseline assessment. Suppose blood pressure is recorded three times during each visit. The analyst should not have to decide afterwards whether the primary outcome uses the first reading, the average of all three readings or another summary.
The chosen procedure should follow the measurement protocol and its scientific rationale. What matters for the SAP is that the resulting analytical variable is defined clearly and consistently.
Distinguish cleaning from exclusion
Data preparation may involve resolving duplicate records, correcting verified transcription errors or identifying measurements that failed a predefined quality check. These procedures differ from excluding valid observations merely because they are unusual. An extreme blood-pressure value might reflect an error, a genuine clinical observation or a situation needing further review.
The SAP or associated data management documentation should explain how such cases will be investigated. Decisions should be documented, and valid observations should not be discarded simply because they affect the estimated result.
Document transformations and derived variables
When analyses require transformations, standardisation or composite outcomes, specify how the variables will be calculated and interpreted. If several observations contribute to a participant-level summary, define the aggregation procedure and the unit of analysis. For repeated observations, describe which timepoints will be included and how their dependence will be represented.
Transformations should be selected for defensible statistical or scientific reasons, not because they produce more favourable findings.
7. Specify the primary statistical analysis
The primary-analysis section should identify the principal model, comparison, adjustment variables, effect estimate and approach to quantifying uncertainty. The description should be detailed enough that another qualified analyst can implement the planned procedure without making substantial additional methodological decisions.
Replace vague wording with an analysis specification
Vague SAP wording
Differences in blood pressure between groups will be analysed using appropriate statistical tests.
This statement does not specify the primary outcome, effect estimate, model or method of comparison.
Improved illustrative SAP wording
The primary analysis will estimate the between-group difference in mean clinic systolic blood pressure at 12 weeks using a linear regression model with randomised group and baseline systolic blood pressure as predictors. The intervention effect will be reported as the adjusted mean difference between the supervised exercise and usual-care groups, expressed in mmHg, with a 95% confidence interval.
This is a more useful specification, but a complete SAP must also define the analysis population, missing-data approach, handling of relevant intercurrent events, model assumptions and any additional prespecified decisions.
Explain why the model fits the design
For this example, baseline-adjusted linear regression may be appropriate for a continuous outcome measured at 12 weeks. Adjustment for baseline systolic blood pressure can improve precision when the model and study design support that approach. The SAP should specify whether baseline adjustment is the primary method and whether an unadjusted comparison will also be reported. Any additional adjustment variables require clear justification.
The primary between-group comparison should not be replaced by separate tests of change within each randomised group. A statistically significant change in one group and a non-significant change in another does not establish a difference between the groups.
See Change Scores vs ANCOVA: Which Should You Use? for a more detailed comparison. Analysis of covariance (ANCOVA) is a statistical approach that compares outcomes between groups while accounting for specified covariates, such as baseline measurements.
Document the statistical details
Depending on the design and method, the SAP may need to specify the outcome distribution, link function, interaction terms, random effects, correlation structure, estimation method and relevant degrees-of-freedom approach. It should also define the primary contrast, reference categories, confidence interval level, significance threshold where appropriate and any planned multiplicity adjustment.
For the fictional trial, the central result is the estimated adjusted mean difference in systolic blood pressure with its confidence interval. The interval provides information about the estimate’s uncertainty under the chosen model, while the scientific interpretation must also consider bias, measurement quality and other limitations.
8. Plan secondary and exploratory analyses
The SAP should distinguish analyses addressing prespecified secondary objectives from exploratory analyses used to investigate additional patterns. This distinction matters because the number and purpose of analyses influence how strongly the findings can support particular conclusions.
Specify secondary analyses
For each important secondary outcome, identify its definition, assessment timepoint, analysis population and intended method. When several confirmatory comparisons are planned, explain whether and how the analysis will address multiple testing. The appropriate strategy depends on study objectives and the inferential framework; there is no universal correction that should be applied automatically to every set of secondary outcomes.
Label exploratory analyses honestly
Exploratory analyses may identify unexpected relationships, generate hypotheses or reveal questions for future research. Such work can be valuable, but its conclusions should reflect its exploratory nature. An association discovered after examining numerous models does not become a prespecified confirmatory result because it has a small P value. Report the purpose and timing of these analyses transparently.
9. Explain how missing data will be handled
Missing data can affect the precision and validity of an analysis. The SAP should anticipate plausible reasons for missingness, define the main analytical approach and identify assumptions that may need examination.
In the exercise trial, participants may miss their 12-week assessment because of illness, practical difficulties or withdrawal from further measurements. Different reasons for missingness can have different implications for analysis.
Separate missing outcomes from intervention discontinuation
A participant who stops attending exercise sessions does not necessarily have missing outcome data. If the 12-week blood-pressure assessment is completed, it may still contribute to an analysis addressing the effect of randomised assignment. Conversely, a participant who attends every session may have a missing outcome measurement.
The SAP should distinguish these situations because an intervention-related event and a missing measurement are not the same analytical problem.
State assumptions and methods
A complete-case analysis uses observations with the data required for the specified model. It may be valid under certain conditions, but it can produce biased estimates when missingness is associated with factors affecting the outcome.
Multiple imputation and likelihood-based methods may be appropriate in some circumstances, but neither automatically removes missing-data bias. Their validity depends on assumptions, model specification and the information available. If multiple imputation is planned, the SAP may need to specify the imputation variables, model structure, number of imputations, treatment of relevant interactions and how estimates will be combined.
Avoid describing a method merely as missing data will be handled using multiple imputation . Without implementation detail, analysts may still have numerous consequential choices to make.
Examine important assumptions
Some missing-data assumptions concern unobserved information and therefore cannot be verified directly using the available data. A sensitivity analysis can examine how conclusions change under plausible alternatives.
For example, researchers might assess whether the estimated exercise effect changes materially if participants with missing outcomes are assumed to have systematically different blood-pressure values from otherwise comparable participants with observed outcomes. The purpose is to understand how strongly conclusions depend on assumptions, not to search for an alternative analysis that reproduces the preferred result.
10. Prespecify sensitivity, subgroup and additional analyses
Additional analyses serve different purposes. An SAP should distinguish analyses designed to assess robustness from those examining effect modification or answering separate scientific questions.
Sensitivity analyses
A sensitivity analysis evaluates the robustness of a conclusion to a specified assumption or analytical choice. For example, an analysis might examine an alternative plausible missing-data assumption while retaining the same treatment effect of interest.
Changing the outcome definition, population or treatment-effect question may instead change the estimand. Such an analysis can still be useful, but it should not automatically be presented as a sensitivity analysis of the original effect. The ICH E9(R1) framework makes this distinction important when defining treatment effects and assessing conclusions about them.
Subgroup analyses
A subgroup analysis investigates whether the estimated treatment effect differs across participant characteristics. The exercise-trial investigators might, for example, explore whether the effect varies according to a specified baseline characteristic. An appropriate assessment commonly uses a statistical interaction rather than separate significance tests within each subgroup.
A significant result in one subgroup and a non-significant result in another does not establish that the subgroup effects differ. Subgroup analyses should be justified and specified carefully, particularly when the study was not designed to detect effect modification.
Other additional analyses
Supplementary and exploratory analyses may use different outcome summaries, models or populations to answer useful secondary questions. Describe their scientific purpose and how their results will be interpreted. The SAP should make it easy to distinguish the principal analysis from supplementary investigations.
11. Describe assumptions and diagnostic procedures
Statistical methods rely on assumptions. The SAP should identify important assumptions associated with the planned analysis and explain how relevant problems will be evaluated.
For linear regression, these may concern the relationship between predictors and the outcome, residual behaviour, variance assumptions and influential observations. However, model diagnostics should not become a mechanical series of significance tests that determines the final analysis without reference to the scientific question.
Plan reasonable responses to problems
A statement such as the data will be tested for normality and an appropriate test selected is usually insufficient. It does not explain which assumption matters, how it will be evaluated or why a particular alternative method would address the problem.
Where important contingencies are foreseeable, document the intended response or a justified decision rule. Some problems cannot be anticipated, but necessary departures should be explained and distinguished from the original plan.
Account for the data structure
Repeated observations from the same participant, clustering within centres, matched data and unequal follow-up may require methods that account for dependence or other design features. The SAP should explain how these characteristics will be handled rather than treating every recorded observation as statistically independent.
For guidance on matching methods to different outcome types and dependence structures, see How to Choose the Right Statistical Test for Your Study .
Research teams who need help developing or reviewing a suitable analytical strategy can explore Blazon Scientific’s research and statistical services .
12. Plan tables, figures and statistical reporting
An SAP is more useful when it shows how the intended results will be presented. Mock tables and figures can identify incomplete specifications before analysis begins. These outputs also allow collaborators to check whether the proposed analyses will answer the study objectives.
Develop mock Results tables
For the exercise trial, the primary Results table might contain:
| Output | Planned reporting |
|---|---|
| Exercise-group sample size | Number contributing to the primary analysis |
| Usual-care sample size | Number contributing to the primary analysis |
| Baseline systolic blood pressure | Descriptive summary for each group |
| Twelve-week systolic blood pressure | Descriptive summary for each group |
| Primary effect estimate | Baseline-adjusted between-group mean difference |
| Uncertainty | 95% confidence interval |
| Additional inference | Prespecified P value or other inferential quantity, if applicable |
The descriptive group means and adjusted treatment effect have different roles. Subtracting the displayed group means will not necessarily reproduce the model-adjusted estimate. The SAP should also define what each sample size represents, particularly when some participants have missing measurements or different amounts of observed data.
Plan figures that answer the question
A figure may show outcome distributions by randomised group and assessment timepoint, with clearly defined summaries and uncertainty intervals. Another may display the primary effect estimate and confidence interval. Choose figures according to what readers need to understand. A clear table may sometimes communicate the important information more effectively than a complicated multi-panel figure.
13. Document software, responsibilities and version control
An SAP should contain enough administrative information to identify the document, its status and who is responsible for preparing and approving it. Include the study identifier, version number, version date and relevant authors or reviewers. Where applicable, document approval by investigators, statisticians, sponsors or other responsible parties.
Specify software and reproducibility arrangements
Identify the planned statistical software and any important packages or procedures where useful. Software versions may change during a project. Record the versions actually used in the final analysis documentation, along with significant departures from the original plan.
Reproducible scripts and a documented data-processing workflow can improve auditability, particularly when analyses involve complex transformations or multiple datasets. The SAP should identify supporting documents that define variable derivations and analytical datasets.
Record changes and deviations
Maintain a transparent history of substantive SAP revisions. Describe what changed, why the change was necessary and what results or data were accessible when the decision was made.
Departing from an inappropriate analysis may be scientifically necessary. The problem is not necessarily the deviation itself, but concealing the change or presenting a result-driven decision as though it were prespecified.
14. Common statistical analysis plan mistakes
Several problems repeatedly make SAPs difficult to implement or weaken the credibility of the resulting analysis.
Listing statistical tests without defining the primary analysis
An SAP that lists several possible tests without identifying the main analysis leaves important decisions unresolved. Define the principal question, effect estimate and analytical strategy before describing alternatives.
Confusing the effect of interest with the model
A statistical model is a procedure for estimating a quantity. It does not necessarily define the population, outcome or handling of events that affect the interpretation of the treatment effect.
Using undefined analysis populations
Terms such as intention to treat and per protocol require operational definitions. Specify who contributes to each analysis, how group assignment is handled and what happens when outcomes are missing.
Ignoring missing-data assumptions
Simply excluding participants with missing measurements may be inappropriate. Likewise, choosing a more elaborate missing-data method does not guarantee validity. The SAP must explain the assumptions and justify the proposed strategy.
Selecting models using only diagnostic P values
A sequence of normality tests followed by automatic statistical-test selection is not a substitute for a defensible analytical plan. The scientific question, outcome, design and relevant assumptions should guide the primary method.
Treating every additional analysis as a sensitivity analysis
A sensitivity analysis should investigate robustness to a defined assumption about the target effect. An analysis addressing a different question should be labelled accordingly.
Failing to reconcile the SAP and protocol
The SAP should elaborate the protocol rather than silently redefine it. Differences in primary outcomes, analysis populations, timepoints or intended effects require careful review and transparent documentation.
Statistical analysis plan quality checklist
Use this checklist to assess whether the SAP is sufficiently detailed, coherent and ready for implementation.
- The SAP has an identifiable version, date and study reference.
- Its purpose and relationship with the study protocol are clear.
- The primary research question and objective are specified.
- The primary effect or association of interest is defined.
- Relevant intercurrent events are addressed where applicable.
- Analysis populations are precisely defined.
- The primary outcome and analytical variable are unambiguous.
- Relevant units, coding and variable-derivation rules are documented.
- The primary statistical model and comparison are specified.
- Adjustment variables and other important model terms are identified.
- The primary effect measure and uncertainty interval are defined.
- Relevant multiplicity considerations are addressed.
- Secondary and exploratory analyses are distinguished.
- Missing-data assumptions and methods are explained.
- Important sensitivity analyses are specified and justified.
- Planned subgroup analyses have appropriate definitions and methods.
- Relevant diagnostics and responses to important problems are described.
- Mock tables or figures show how the principal results will be reported.
- Software, responsibilities and reproducibility arrangements are documented.
- Amendments and deviations can be identified and explained.
- The SAP agrees with the protocol and applicable requirements.
The checklist supports statistical review. It does not establish that the intended analyses are valid or replace study-specific methodological expertise.
Frequently asked questions
What is the difference between a statistical analysis plan and a research protocol?
A research protocol describes the overall study, including its rationale, design, procedures and outcomes. A statistical analysis plan provides greater detail about how the data will be prepared, analysed and reported. The SAP should agree with the protocol while defining analytical decisions sufficiently clearly for implementation.
Does every research study need a separate statistical analysis plan?
Not necessarily. Smaller or simpler studies may contain an adequate analysis specification within the protocol or another documented plan. A standalone SAP is often useful for complex projects and may be required for particular clinical trials. The main principle is to document the analytical strategy clearly and at an appropriate point in the research process.
Can I write an SAP after collecting the data?
Ideally, statistical planning begins before data collection, particularly where analytical decisions affect measurements or sample-size calculations. A detailed SAP may sometimes be completed later if the relevant results have not influenced the decisions. When researchers have already inspected data or results, the SAP should accurately disclose what was known and avoid presenting retrospective choices as prospectively specified.
Should an SAP include statistical code?
Code is not universally required within the SAP itself. However, scripts or sufficiently detailed pseudocode can improve reproducibility and demonstrate that the planned analysis is implementable. Complex projects may benefit from maintaining code alongside the SAP with appropriate version control.
What if the planned statistical analysis is inappropriate?
Researchers should document why the original analysis is unsuitable, describe the justified alternative and record when the decision was made. Where necessary, the SAP and protocol should be amended through the appropriate procedures. The final research report should distinguish important departures from the original plan, particularly when changes occurred after examining results.
References and further guidance
- 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. Source .
- SPIRIT 2025 explanation and elaboration: updated guideline for protocols of randomised trials. BMJ . 2025;389:e081660. Source .
- Kahan BC, Forbes G, Cro S. How to design a pre-specified statistical analysis approach to limit p-hacking in clinical trials: the Pre-SPEC framework. BMC Medicine . 2020;18:253. Source .
- International Council for Harmonisation. ICH E9(R1): Addendum on estimands and sensitivity analysis in clinical trials. European Medicines Agency guidance .
- European Network of Centres for Pharmacoepidemiology and Pharmacovigilance. Methodological Guide, Chapter 12: Statistical analyses. ENCePP guidance .
- The estimands framework: a primer on the ICH E9(R1) addendum. BMJ . 2024;384:e076316. Source .
