Psychology dissertation g-computation helps researchers estimate average outcomes under clearly defined hypothetical interventions rather than merely describing adjusted associations. It can answer questions such as how mean distress might differ if every eligible participant received a digital intervention versus if none received it, under explicit causal assumptions.
This guide explains when g-computation is appropriate, how point-treatment standardisation differs from the longitudinal parametric g-formula, which assumptions support interpretation, and what diagnostics belong in a dissertation. The aim is a transparent analysis that a reader can audit, not a sophisticated label attached to an ordinary regression.
What psychology dissertation g-computation estimates
G-computation is an outcome-modelling approach to standardisation. The researcher fits a model for the outcome conditional on treatment and measured covariates, predicts each participant’s outcome under each intervention being compared, and averages those predictions over the target population. Contrasting the standardised means or risks gives a marginal effect estimate.
For a single treatment decision, this procedure is sometimes called regression standardisation or the parametric g-formula. In longitudinal settings, the algorithm extends to changing treatments and confounders by modelling and simulating the sequence of time-varying variables. G-computation and the g-formula are often used as synonyms, but they should not be confused with g-estimation, which estimates structural nested models.
The free Causal Inference: What If book by Hernán and Robins develops standardisation and the parametric g-formula within a broader causal framework. Naimi, Cole and Kennedy’s introduction to g-methods explains why these methods are especially relevant when standard regression conditioning cannot recover the intended causal contrast.
Begin with an estimand, not an available model
Write the causal question before opening statistical software. Define the target population, intervention strategies, outcome, follow-up period and effect measure. “Does app use predict anxiety?” is associational and underspecified. A clearer question is: among first-year university students meeting a prespecified anxiety threshold, what is the 12-week difference in mean anxiety if everyone is offered guided app support within seven days versus information-only support?
This question still requires operational details. State what counts as an offer, whether additional support is allowed, when the outcome is measured and how competing events or withdrawal are handled. The related target trial emulation guide can help align eligibility, strategy assignment and the start of follow-up.
Select an estimand that readers can interpret. Common choices are a mean difference for a continuous wellbeing score, a risk difference or risk ratio for a binary outcome, and a survival probability contrast for a time-to-event outcome. Do not default to an odds ratio merely because the fitted outcome model is logistic. Predictions can be transformed into risks and absolute contrasts.
| Question element | Example decision | Why it matters |
|---|---|---|
| Population | Eligible first-year students with elevated anxiety | Defines whose covariate distribution is averaged |
| Strategies | Guided support offer versus information only | Determines the counterfactual predictions |
| Outcome | Validated anxiety score at 12 weeks | Sets the model, timing and interpretation |
| Contrast | Population-average mean difference | Prevents coefficient-driven reporting |
| Follow-up | From aligned time zero to week 12 | Limits immortal-time and selection problems |
When g-computation is a defensible choice
For a point treatment, g-computation is useful when the outcome can be modelled plausibly across the covariate patterns in the target population. It produces marginal predictions even when the fitted regression coefficients are conditional. It also allows flexible contrasts across treatment levels and can translate nonlinear outcome models into interpretable risks or means.
The longitudinal parametric g-formula is especially valuable when a time-varying confounder predicts later treatment and is itself changed by earlier treatment. For example, weekly distress may influence whether a participant uses a coping app next week, while earlier app use changes current distress. Conditioning conventionally on current distress can block part of the earlier treatment effect, whereas omitting it leaves later treatment confounded.
Keil and colleagues’ worked time-to-event example shows how the parametric g-formula handles treatment-confounder feedback through sequential modelling and simulation. The method is not automatically appropriate because data are longitudinal. It is justified by the causal structure, the intervention question and adequate information to estimate the required models.
State the identification assumptions plainly
Consistency and well-defined interventions
Consistency links an individual’s observed outcome to the potential outcome under the strategy that individual actually followed. It becomes doubtful when “treatment” combines materially different versions. Six therapy sessions delivered by different approaches, durations and levels of clinician support may not represent one stable intervention. Define treatment versions or explain why they can be combined.
Exchangeability after measured adjustment
Conditional exchangeability requires no unmeasured common causes of treatment and outcome after adjustment for the chosen covariates. In a longitudinal analysis, this requirement applies at every treatment time given the measured history. It cannot be proven from the dataset. Use theory, subject knowledge, timing and a directed acyclic graph to justify the adjustment set.
Do not select confounders using p-values, stepwise procedures or whether they improve model fit. A variable may be important even when its sample association is weak. Conversely, adjusting for a mediator or collider can create bias. The confounding variables guide explains these distinctions.
Positivity and sufficient overlap
Every strategy must have a non-zero probability within covariate histories relevant to the target population. If all participants at immediate risk are necessarily referred for intensive support, the no-support outcome for that group is not learned from the data. G-computation may still return a number, but it would rely on unsupported extrapolation.
Inspect treatment distributions across key histories and compare the ranges of predicted treatment probabilities. For continuous treatments, check whether the proposed intervention stays within supported values. A realistic dynamic intervention may be better supported than an extreme “always versus never” contrast.
Correct model specification
Point-treatment g-computation relies on the outcome model. The longitudinal parametric g-formula additionally models time-varying covariates, outcomes, censoring and sometimes competing events. Misspecified nonlinearities, interactions, distributions or time trends can accumulate across simulated steps. Flexible terms can help, but complexity does not remove the need for diagnostics and substantive judgement.
Prepare data with an explicit timeline
For a point treatment, establish that baseline covariates precede treatment and that the outcome follows it. For repeated decisions, use a person-period dataset with one row per participant per time interval. Distinguish baseline variables, covariate history, treatment at the current time, subsequent censoring and later outcomes.
A timeline often reveals errors that a variable list hides. If a weekly distress average and weekly app use are measured during the same seven days, their ordering is ambiguous. Consider lagged summaries or shorter intervals that reflect the actual decision process. Never use future values to predict earlier treatment or eligibility.
Document missingness separately for baseline covariates, time-varying variables and outcomes. Complete-case analysis can change the target population and introduce selection bias. Multiple imputation may be appropriate under stated assumptions, but the imputation model must respect time ordering and the substantive analysis. Repeat the complete g-computation procedure within each imputed dataset and combine uncertainty correctly.
Run point-treatment g-computation step by step
1. Fit the outcome model
Model the outcome as a function of treatment and the prespecified confounders. Include scientifically plausible nonlinearities and treatment-covariate interactions where effect heterogeneity matters. Match the outcome distribution and link function, but remember that the final estimand comes from standardised predictions rather than an isolated coefficient.
2. Create counterfactual datasets
Copy the analytic dataset once for each strategy. In one copy, set treatment to the first intervention value for every participant; in the other, set it to the comparator. Keep baseline covariates at their observed values. This preserves the target population’s covariate distribution.
3. Predict and average outcomes
Use the fitted model to predict each participant’s outcome in every counterfactual dataset. Average predictions within each strategy. For a binary outcome, average predicted probabilities rather than class labels. For a continuous outcome, average predicted means.
4. Contrast strategies and quantify uncertainty
Calculate the prespecified mean difference, risk difference, risk ratio or another marginal contrast. Use a bootstrap that resamples participants and repeats model fitting, counterfactual prediction and averaging in every replicate. When observations are clustered, resample at the appropriate highest independent unit rather than individual rows.
| Stage | Required decision | Evidence to save |
|---|---|---|
| Outcome model | Link, functional forms and interactions | Formula, diagnostics and rationale |
| Interventions | Values or rules assigned to treatment | Operational definitions and support checks |
| Prediction | Marginal mean or risk under each strategy | Participant-level predictions and summaries |
| Contrast | Absolute or relative effect measure | Estimate, interval and units |
| Uncertainty | Bootstrap or valid analytic method | Resampling unit, replicates and failures |
Extend the algorithm to longitudinal interventions
Longitudinal g-computation simulates entire trajectories. First fit models for each time-varying covariate using its past history, then model treatment or set it according to the chosen intervention, and finally model the outcome or event process. Generate a large Monte Carlo population by resampling baseline covariates and simulating forward one time step at a time.
At each step, update the simulated history, apply the intervention rule, and predict subsequent covariates and outcomes. Repeat the process under each strategy. Average final outcomes or risks across the simulated population, then contrast strategies. The gfoRmula package documentation describes support for discrete or continuous time-varying treatments, several outcome types, censoring and competing events.
Strategies can be static, such as intervention at every wave, or dynamic, such as offer additional support when distress exceeds a prespecified threshold. They may also be stochastic, assigning treatment according to a modified probability distribution. Choose rules that are meaningful, operational and supported by observed histories. The package’s intervention vignette demonstrates deterministic and threshold-based specifications.
Diagnose the analysis before interpreting effects
Check natural-course calibration
Simulate the natural course, in which treatment follows its observed process, and compare simulated means, risks and covariate distributions with observed data over time. Close agreement does not prove every intervention model is correct, but major discrepancies are a clear warning. Check variables at each time rather than only the final outcome.
Examine model fit and residual patterns
Assess continuous, binary, count and categorical submodels using diagnostics suited to their distributions. Plot observed versus predicted summaries over time and across important covariate strata. Check influential cases, nonlinearities and interactions. Avoid a single omnibus fit statistic as proof of adequacy.
Evaluate support for each strategy
Record how often the intervention changes observed treatment and whether simulated histories leave the observed data range. Sparse histories can produce unstable extrapolation even when average treatment probabilities look acceptable. Restrict the target population or modify the strategy when support is weak.
Separate Monte Carlo error from sampling uncertainty
Increase the simulation size until estimates are stable across random seeds. Monte Carlo error reflects finite simulation and can usually be reduced computationally. Sampling uncertainty reflects having observed only one sample and requires an appropriate bootstrap or other valid procedure. Report both choices clearly.
| Diagnostic | Warning sign | Reasonable response |
|---|---|---|
| Natural-course calibration | Simulated trends diverge from observed trends | Review timing, distributions and model forms |
| Intervention support | Rules assign rare or unseen histories | Narrow the population or redefine strategies |
| Residual checks | Systematic patterns across time or severity | Add justified nonlinearities or interactions |
| Monte Carlo stability | Estimates change across seeds | Increase simulations and inspect rare events |
| Bootstrap stability | Frequent model or simulation failures | Investigate sparsity and simplify defensibly |
A worked psychology example
Imagine a six-week observational study of 800 university students. Each week records prior distress, sleep difficulty, workload and use of an optional guided coping programme. Wellbeing at week seven is the outcome. Earlier programme use may affect current distress, while current distress influences later use.
The dissertation compares two dynamic strategies: offer guided support whenever prior distress exceeds a validated threshold, versus offer information-only support under the same condition. At baseline, the researcher specifies eligibility, time zero, measurement windows, the threshold, permissible co-interventions and the population-average difference in week-seven wellbeing.
Models predict weekly distress, sleep and programme engagement from relevant past history. A Monte Carlo sample is generated from observed baseline covariates and simulated forward under each strategy. The analysis produces standardised mean wellbeing under both strategies and their difference, with participant-level bootstrap confidence intervals.
Suppose natural-course simulated distress follows observed averages closely in weeks one to three but diverges in weeks four to six. The researcher should not interpret intervention contrasts yet. They should investigate time trends, nonlinear severity effects, measurement changes and dropout. This hypothetical example illustrates the decision process; its numbers are not empirical findings.
Compare g-computation with nearby methods
Propensity score matching models treatment assignment and constructs a matched comparison for a point exposure. Inverse probability weighting also models treatment and creates a weighted pseudo-population. G-computation instead models the outcome process and standardises predictions over a target population.
The marginal structural models guide covers longitudinal weighting when treatment-confounder feedback occurs. Both MSM weighting and the parametric g-formula can target sustained strategies, but they rely on different nuisance models and diagnostics. Agreement across well-implemented estimators can be informative; disagreement should prompt investigation rather than selective reporting.
Doubly robust estimators combine outcome and treatment models so that, under other identification conditions, consistency may require one of the two nuisance-model components to be correct. Targeted maximum likelihood estimation and augmented inverse probability weighting are examples. They do not rescue poor design, unmeasured confounding or unsupported interventions.
Use g-computation when its estimand, models and diagnostics are feasible. A simpler associational analysis may be more honest if the causal assumptions cannot be defended. Method choice should follow the research question and available evidence, not a hierarchy of statistical prestige.
Sensitivity analyses that add information
Pre-specify alternative reasonable outcome-model forms, interaction structures and intervention definitions. Compare static and clinically plausible dynamic strategies where both are supported. For longitudinal analyses, vary lag structures and time functions only when each alternative represents a coherent causal timeline.
Assess how missing-data assumptions, censoring definitions and competing-event handling affect conclusions. Repeat analyses after excluding histories with poor support, and label the resulting target population. Quantitative bias analysis may explore specified unmeasured confounding, but it requires transparent bias parameters rather than vague reassurance.
Do not run dozens of variations and present only those that agree. A multiverse or specification-curve approach can display structured uncertainty when many defensible choices exist. Explain why estimates differ and which assumption each sensitivity analysis probes.
Reporting checklist for a dissertation
- State the target population, strategies, time zero, follow-up, outcome and effect measure.
- Provide a causal diagram and a time-ordered variable table.
- Justify confounders using knowledge and prior evidence rather than significance tests.
- Give every model formula, link, distribution, nonlinear term and interaction.
- Describe counterfactual data construction or the longitudinal simulation algorithm.
- Report natural-course calibration, model diagnostics and intervention support.
- State the Monte Carlo size, random seed strategy, bootstrap unit and number of successful replicates.
- Present strategy-specific standardised outcomes, absolute contrasts and uncertainty.
- Separate assumptions from diagnostics and acknowledge unmeasured confounding.
- Share reproducible code and a data dictionary where consent and governance permit.
Common errors to avoid
Do not call an adjusted regression coefficient g-computation without generating and averaging counterfactual predictions. Do not use post-treatment covariates in a point-treatment outcome model unless the estimand and method specifically require them. Do not define intervention values outside the observed support.
Avoid presenting natural-course agreement as proof of causal validity. It cannot verify exchangeability or eliminate misspecification under interventions. Do not ignore failed bootstrap replicates, simulation instability or implausible generated values. Finally, do not imply that an observational estimate proves an intervention works.
Frequently asked questions
Is g-computation just regression?
It usually uses regression models, but the target estimate comes from predicting each participant’s outcome under specified strategies and averaging those predictions. A conditional coefficient alone is not the g-computation estimate.
Are g-computation and the g-formula the same?
The terms are often used interchangeably. Some authors prefer g-formula because g-computation can be confused with g-estimation, a different method for structural nested models.
Can g-computation handle time-varying confounding?
Yes. The longitudinal parametric g-formula can model and simulate time-varying confounders affected by earlier treatment, provided the required variables, temporal ordering, support and modelling assumptions are adequate.
Does g-computation remove unmeasured confounding?
No. Causal interpretation still requires conditional exchangeability based on measured covariates. Sensitivity analysis can explore specific departures but cannot manufacture missing information.
How large should the Monte Carlo sample be?
There is no universal number. Increase it until estimates are stable across seeds and Monte Carlo error is negligible relative to sampling uncertainty. Report the chosen size and stability checks.
Should a dissertation use the bootstrap?
Often yes, particularly when uncertainty must cover model fitting and standardisation. Resample the independent unit and repeat the entire estimation process. Respect clustering and report failed replicates.
Which software can run g-computation?
R, Stata, SAS and other statistical environments can implement it. Dedicated packages can help with longitudinal algorithms, but software does not choose the estimand, causal structure or defensible intervention.
Conclusion
Psychology dissertation g-computation turns an explicit intervention question into standardised counterfactual predictions. A credible analysis defines its estimand first, respects temporal ordering, states exchangeability, consistency and positivity assumptions, diagnoses the outcome process and reports uncertainty without overstating causality.
If you need methodological support, seek ethical guidance that helps you understand, document and defend each decision. Consultation should complement supervision, protect confidential data and strengthen your independent analysis rather than produce hidden or unverifiable work.
