A complete worked introduction to medical statistics using the same
synthetic group of older adults followed over time in Stata, SPSS and R.
Follow the sequence or open the page you need.
The software changes; the statistical question does not. Each step
explains the decision first, then gives equivalent syntax for all
three packages.
Seven-step investigationStart at 01 or open the step you need
Analysis checkpoint
Set up once, then follow the investigation.
Work through these six prompts in order. Each one supplies what the next one needs.
1 · Before you start
You do not need to know a statistical test yet. Download the common teaching package and choose Stata, SPSS or RStudio. If the software is unfamiliar, use its first-contact guide before Step 01.
Words used on this page
Cohort
a defined group of people followed over time.
Exposure
the baseline characteristic or care being compared; here, medication review.
Outcome
a later health measure, such as disability at six months.
Observational study
researchers record care and outcomes rather than assigning treatment at random.
Association
an observed difference or pattern; it does not by itself prove cause and effect.
2 · Why this comes now
A reproducible analysis starts with the study design and checked data. The seven steps then build one argument in order: check, describe, compare, measure, model, examine confounding and report.
3 · Do this now
Download the complete teaching package and keep its data and syntax files together.
Choose one software route; keep the same route as you work through Sections 01–07.
Read the cohort brief, then begin with the participant timeline and data audit.
Same step in Stata and SPSS
Stata uses the commented .do file and SPSS uses the matching .sps file. Their commands look different, but every numbered section answers the same epidemiological question and should lead to the same decision.
4 · Read this
Use the route map and codebook first. At this point, read variable meanings and the study timeline—not effect estimates.
5 · Ready to continue when
Your chosen software is open, the common CSV and syntax file are in one folder, and you can say who is followed, what the exposure is and which outcomes occur later.
Does structured medication review relate to better six-month health?
You have a cohort of 720 adults aged 65–96. Medication review was
recorded at baseline; quality of life, disability, frailty, falls and
emergency admission were then observed for six months. Review was not
randomised, so people offered it may already have had greater clinical need.
DesignObservational cohort
Start with temporality, follow-up and measured baseline differences.
ExposureMedication review
Compare reviewed participants with those not reviewed.
TaskEstimate associations responsibly
Describe, compare, adjust and interpret without turning association into proof of effect.
Choose how to work
Follow the investigation or open one problem.
First time here · recommended
Work from 01 to 07
Each decision supplies information needed by the next. Begin with the cohort and finish with a reproducible interpretation.
720 entirely synthetic adults aged 65–96, followed for six months.
The data cover medication review, polypharmacy, frailty, disability,
quality of life, falls and hospital admission. No real patients are
represented.
These data were designed for teaching. The medication review is
observational, not randomised, so the crude comparison is deliberately
confounded by baseline frailty. Do not use the simulated results for
clinical decisions.
Model map
Start with the dependent variable.
The model is driven first by the type of outcome, then by the study
design, dependence between observations, distribution and target
measure. This is a starting map, not a substitute for checking
assumptions.
Continuous
Linear regression
Example: six-month EQ-5D-style score. Report an adjusted mean difference.