Sampling/ Longitudinal Study
Sample Size Estimation, Measuring Change

How to Calculate Sample Size for a Longitudinal Study

A longitudinal study follows the same people across multiple rounds of data collection. This guide explains the underlying statistics first, then shows how to apply them using AnalyZ Solutions.

6 min read Sample Size Estimation Intermediate

A longitudinal study follows the same group of people across multiple rounds of data collection. This guide first explains what a longitudinal study is and when it applies, then the general formula behind the calculation, then walks through how to apply it in AnalyZ Solutions.

01What a longitudinal study is, and when it applies

A longitudinal study, sometimes called a panel study, enrols a group of participants and returns to measure the same individuals repeatedly over time, at two or more waves. This is different from a repeated cross-section, which surveys a fresh sample at each round, and different from a single cross-sectional survey, which measures the population only once. Because the same people are tracked, a longitudinal study can describe individual trajectories over time, not just how the population average moved.

A longitudinal design is a strong fit when three conditions hold together.

Why tracking the same people matters

Following the same individuals over time captures information a series of fresh, unrelated samples cannot. It allows a study to describe how individual circumstances change, to identify who improves and who does not, and to examine what individual or household characteristics predict a change in trajectory, none of which is possible from repeated snapshots of different people. This is also what makes the paired designs in Change in Proportion and Change in Mean more statistically efficient than their independent groups equivalents, the same underlying logic of tracking individuals rather than resampling.

Common pitfalls

02Longitudinal versus Change in Proportion or Change in Mean

These tools are frequently confused because they all involve measuring the same people more than once. They answer different questions, and the choice between them depends entirely on what the study is actually trying to establish.

In practice, many studies that track the same people over multiple waves are really trying to answer the change question, in which case the paired designs in Change in Proportion or Change in Mean, not this tool, are the right calculation to size the study around. Longitudinal is the right tool specifically when the study needs a precise final-wave estimate, for example an endline prevalence figure that will stand on its own, rather than a formally tested comparison against baseline.

A useful test: if the main result you plan to report is a number, such as final coverage was 42%, use Longitudinal. If the main result you plan to report is a comparison, such as coverage increased by 12 percentage points, a difference the study was powered to detect, use the paired design in Change in Proportion or Change in Mean instead.

03The general sample size formula

The starting point is the same precision-based formula used for a single cross-sectional survey, for either a proportion or a mean.

n0 = Z2 × p(1 − p) / e2  or  Z2 × σ2 / e2 This is the minimum sample needed at the final wave, before accounting for anyone lost along the way.

Attrition, participants who drop out between waves, compounds with each additional round. A study with 20% attrition per wave retains only 64% of its original sample by the third wave, since 0.8 × 0.8 = 0.64. To keep the required sample at the final wave, more people must be enrolled at baseline than the precision formula alone suggests.

enrol = n0 / (1 − attrition)(waves − 1) waves is the total number of data collection rounds, including baseline. attrition is the expected dropout rate between each consecutive round.

Each symbol plays a specific role.

Choosing your confidence level and margin of error

Because this tool estimates a value at the final wave rather than testing a specific hypothesis, it uses confidence level and margin of error rather than power. There is no beta or effect size to specify here, only how precise the final-wave estimate needs to be.

Confidence level reflects how sure you want to be that the final estimate falls within the stated margin of error. 95% is the standard default. A higher level increases the required sample at every wave, compounding through the attrition adjustment.

Margin of error reflects how much imprecision in the final estimate is acceptable. A narrower margin of error, meaning a more precise final result, requires a larger baseline sample, an effect that is amplified by attrition across multiple waves in a way it is not in a single cross-sectional survey.

Setting confidence or margin of error too loosely undermines the value of tracking a panel at all. A study that goes to the effort and cost of following the same people across multiple waves, only to end with an imprecise final estimate, has spent that additional effort without the corresponding benefit.
This formula assumes attrition is random. If the people who drop out differ systematically from those who stay, for example if leavers are more mobile or more vulnerable, the remaining sample is biased in a way that enrolling more people at baseline cannot fix.

Accounting for cluster sampling

If the baseline sample is drawn from clusters, villages, schools, or facilities, rather than a simple random sample, a design effect should be applied before the attrition adjustment. It defaults to 1, meaning no clustering effect, and is always editable. See the dedicated guide on Design Effect and ICC for how to set this correctly.

How to Calculate This in AnalyZ Solutions
  1. Choose what you are estimating. Select Proportion if your outcome is a percentage or rate, such as prevalence of a condition, or Mean if it is a numeric average, such as household expenditure or a test score. This is the same choice offered in the Cross-sectional tool, and it determines which formula is applied to your final-wave precision target.
  2. Set your confidence level and margin of error. Enter both as numbers, not from a fixed list. These describe the precision you want at the final wave specifically, not at every wave along the way. For a proportion, also enter the expected proportion, leaving it at 50% if you have no prior estimate. For a mean, enter the expected standard deviation instead, ideally from a pilot or a prior round of the same instrument.
  3. Enter the number of waves your study will run. Count every planned round of data collection, including the baseline round itself. This number, together with your attrition assumption, determines how much the baseline sample needs to be inflated to still meet your precision target by the final round.
  4. Enter your expected attrition rate per wave. This is the proportion of participants expected to be lost between each consecutive round, not the total loss across the whole study. The tool compounds this figure across all waves automatically, so a seemingly modest per-wave rate can still produce substantial cumulative loss by the final round.
  5. Enter a population size, if relevant. If your population is small enough that a finite population correction should apply, enter it here. Otherwise, leave this field blank. AnalyZ Solutions applies the correction automatically whenever a population size is entered, and skips it otherwise, exactly as in the Cross-sectional tool.
  6. Set a design effect, if your baseline sample is drawn by cluster. If you are sampling from villages, schools, or facilities rather than a simple random sample, enter a design effect directly, or calculate one automatically from an intraclass correlation and average cluster size. It defaults to 1, meaning no clustering effect, and is applied before the attrition adjustment, so both effects compound correctly.
  7. Calculate. The result shows the number of participants to enrol at baseline, the minimum number needed at the final wave before the attrition adjustment, and your estimated retention rate by the final round, so you can see exactly how much of the baseline sample the attrition assumption is expected to consume.

Watch calculating sample size for a longitudinal study in the AnalyZ Solutions interface.

04Worked example

A nutrition programme tracks the same households across three waves, roughly a year apart. Baseline stunting prevalence is expected around 30%, with a 5% margin of error at 95% confidence, and 20% attrition expected between each wave.

Inputs
What you are measuringProportion
Confidence level95%
Margin of error5%
Expected proportion30%
Number of waves3
Attrition per wave20%
~505
households to enrol at baseline

Of these, roughly 323 are needed at the final wave to meet the stated precision. The gap between 323 and 505 is entirely the cost of two rounds of attrition compounding at 20% each.

05Common mistakes to avoid

Frequently Asked Questions
Is this the same as Change in Proportion measured over time?
No. Longitudinal estimates a precision at the final wave and accounts for attrition, it does not test whether a value has changed. If the goal is specifically to detect a change between waves with a stated power, use the paired design in Change in Proportion or Change in Mean instead.
How do I decide between Longitudinal and the paired Change in Proportion or Change in Mean design?
Ask what the main reported result will be. If it is a number describing the final wave, such as an endline prevalence figure, use Longitudinal. If it is a tested comparison against baseline, such as a stated percentage point increase the study was powered to detect, use the paired design in Change in Proportion or Change in Mean instead. Both tools can apply to a panel that tracks the same people, the difference is what question the sample size is built to answer.
What can I do to reduce attrition rather than just planning for it?
Regular contact between waves, updated tracking information, small incentives, and multiple contact attempts before recording someone as lost to follow up all tend to reduce attrition more cost effectively than inflating the baseline sample alone.
Does the margin of error apply to every wave or just the last one?
Just the final wave. The calculation works backward from the precision needed at the end of the study to the number that must be enrolled at the start.
What if attrition is not the same at every wave?
This tool assumes a constant attrition rate per wave. If attrition is expected to differ meaningfully between rounds, for example higher loss between the first two waves than later ones, consider running the calculation using the highest expected per-wave rate as a conservative planning assumption.

Ready to plan your longitudinal study?

Open the Longitudinal tool in AnalyZ Solutions. Free, browser based, your data never leaves your device.

Try it out
Related Guides