Canada 2022/23 / 26 weeks of laboratory counts / R // 2026
What one flu season can tell us.
Every week, laboratories report how many influenza tests came back positive. I fitted the simplest epidemic model to one season of those counts from Canada. Then I asked which of its numbers the counts really determine, how early the season could have been forecast, and whether the uncertainty it reports can be trusted.

- Reproduction number at the start of the season
- 1.35
- Prior uncertainty about the infectious period that the counts removed
- 18%
- Weeks inside the Poisson model’s 95% intervals
- 35%
Chapter 1
The question
One season of weekly laboratory counts, the simplest epidemic model, and a question about where its answers come from.
- 01 The counts
- Canada’s laboratories report their influenza detections each week, and WHO publishes them in FluNet. In the 26 weeks from week 35 of 2022 there were 59,554 detections of influenza A, with a peak of 9,702 in week 14 of that window.
- 02 The model
- Everyone starts susceptible, becomes infectious, then recovers and is immune. Two numbers drive it: the reproduction number, which is how many people one case infects at the start, and how many days a person stays infectious.
- 03 The link to the data
- Most infections are never tested. The model says a fixed fraction of each week’s new infections is detected, plus a small constant background. A separate choice says how far a real count may scatter around that expectation.
- 04 The method
- I wrote down what was already known about each number from published influenza studies, then let the counts update it. The method is Bayesian inference, and it makes it possible to see which beliefs the counts changed.
- Prior
- What is believed about a number before seeing the data, written as a range. Here each prior comes from published influenza studies.
- Posterior
- What is believed after the data have been taken into account: the prior, updated by the counts.
- 95% credible interval
- The range that holds the number with 95% probability, given the model, the prior and the data.
- Identifiable
- A number is identifiable if the data can pin it down. If very different values fit the data equally well, it is not.
1.1 / The model
Fit the curve by hand.
The bars are the weekly detections. The line is what the model expects for the numbers you choose. Move the sliders and try to make the line follow the bars, then press the two buttons: they are two answers the study’s optimiser found, and they are very different.
Start from one of the study’s best fits
The background, detections that the epidemic does not explain, stays at 37 a week, the value that goes with the last button you pressed. The log-likelihood scores the fit as if the counts were Poisson: higher is closer, and a few units is a real difference.
- Early doubling time
- 6.5 days
- Population infected
- 52%
- Expected detections
- 59,551
- Log-likelihood
- -320
With a reproduction number of 1.41, an infectious period of 3.9 days and 2.9 detections per 1,000 infections, the curve doubles every 6.5 days at first, peaks in week 14 and expects 59,551 detections against 59,554 observed. Its log-likelihood is -320, the same as the best plausible fit.
One curve against the counts
Bars: influenza A detections each week (WHO FluNet). Line: expected detections for the chosen numbers.
Observed detections Model curve
Chapter 2
What the data fix
The counts fix how fast the epidemic grew. They do not say how long anyone was infectious, so they cannot fix the reproduction number without help.
2.1 / Prior against posterior
What the data added, and what I assumed.
A prior is what I believed about a number before seeing the counts; the posterior is what I believe afterwards. If the two look alike, the counts taught me nothing about that number. Choose a number, then swap the prior built from published estimates for a much vaguer one.
Prior
The published prior takes each range from the influenza literature. The weak prior makes every range at least four times wider. The tiles below are for the negative-binomial fit, the one whose intervals can be trusted (chapter 3).
- Posterior median
- 3.5
- 95% credible interval
- 2.4–5.0
- Prior variance removed
- 18%
- Best fit with no prior
- 45.7
Starting from the prior built from published estimates, the infectious period in days is 3.5, with a 95% credible interval of 2.4 to 5.0. The prior alone said 2.0 to 4.5. The data removed 18% of the prior’s variance. With no prior at all, the best fit is at 45.7.
Infectious period (days)
Thin bars are 95% ranges, thick bars the middle half, dots the medians. The scale is logarithmic: each step multiplies.
Median Best fit with no prior Prior Negative binomial Poisson
2.2 / An exact trade-off
One curve, three readings.
Under the published prior the study’s answer is a reproduction number of 1.35 (1.23 to 1.50), an infectious period of 3.5 days (2.4 to 5.0) and 3.1 detections per 1,000 infections (2.3 to 4.5), with cases doubling every 7.1 days at first. That assumes nobody was immune when the season began. If some people were, exactly the same curve is produced by a higher basic reproduction number and a higher detection rate, and no amount of counting can tell the readings apart.
Everyone susceptible3.1 detections per 1,000basic reproduction number 1.35 (1.23 to 1.50)
80% susceptible3.9 detections per 1,000basic reproduction number 1.68 (1.53 to 1.88)
60% susceptible5.2 detections per 1,000basic reproduction number 2.24 (2.04 to 2.51)
Chapter 3
Honest intervals
Whether the uncertainty can be trusted depends on how the counts are allowed to scatter. With the right choice the forecast is honest, and honest means wide until the peak has passed.
3.1 / The observation model
A perfect line, and wrong intervals.
The model gives an expected count for each week. An observation model says how far a real count may fall from it. Poisson allows only the scatter of pure chance. The negative binomial allows extra scatter and estimates how much. Switch between them, and try the logarithmic axis to see the quiet weeks.
How counts scatter around the curve
Vertical axis
Both fits use the prior built from published estimates and all 26 weeks. The dispersion check compares the scatter in the data with the scatter in 2,000 seasons drawn from the fitted model: a value near zero means the data are far more scattered than the model can produce.
- Weeks inside the 95% interval
- 9 of 26
- Dispersion check, p-value
- 0.00
- Reproduction number, 95%
- 1.32–1.44
- Truth inside, simulated seasons
- 10%
With Poisson counts, 9 of the 26 observed weeks fall inside the model’s own 95% intervals. The 95% credible interval for the reproduction number is 1.32 to 1.44. On 50 simulated seasons with realistic week-to-week noise, where the true value is known, that interval contained the truth 10% of the time.
Where the model expected the counts
The line is the median prediction, the shaded bands hold 50% and 95% of predicted counts. Dots are the observed weeks; coloured dots fall outside the 95% band.
Observed, inside Observed, outside Predicted range
3.2 / Forecasting in real time
How early could I have known?
I refitted the model as if the season were still under way, giving it only the first weeks of counts, and asked it to forecast the rest. Move the slider to hand it more weeks. The hollow dots are what happened next, which the model had not seen.
How counts scatter around the curve
The log score rewards a forecast for giving high probability to what then happened. It is averaged over the weeks that followed; closer to zero is better. The refits use the counts as they stand today, not as they were first published.
- Season total, 95% interval
- 16,537–668,700
- Peak week, 95% interval
- 17 (12–24)
- Later weeks inside 95%
- 20 of 20
- Log score per week
- -8.6
With 6 weeks of data, the negative-binomial model forecast a season total of 115,430 detections, with a 95% interval of 16,537 to 668,700; 59,554 were observed. It put the peak in week 17 (12 to 24); it was week 14. 20 of the 20 weeks that followed fell inside its 95% intervals. Its log score was -8.6 per week, against -7.4 for the same model fitted to the whole season.
The forecast from week 6
Shaded: where the model expected 50% and 95% of later counts. Line: its median. The axis is logarithmic, so each gridline is ten times the one below.
Counts the model was given What happened next Forecast range
Chapter 4
The limits
The code is checked against exact mathematics and on simulated seasons. The model is still too simple for the question people most want answered, and the page should say so.
4.1 / Verification
Does the code solve the model?
These checks ask whether the code does what the equations say, and whether the sampler gives the right answer when the right answer is known. None of them shows that the model describes influenza in Canada.
Final size of an epidemic4 of 4 casesthe equation solver against the exact final-size relation, agreeing to within 0.07 parts per million
Sampler on a known answer4.193 against 4.195the sampler’s posterior mean against the exact one, on a test problem that can be solved with pen and paper
Chains that agree6 of 6 fits4 independent chains per fit; largest R-hat 1.008, smallest effective sample size 947

Where the model is wrong.
With everyone susceptible, the fit implies that 47% of Canada (35% to 58%) was infected in one season. Published studies put the yearly infection rate in unvaccinated people at about 11% for adults and 23% for children (Somes et al. 2018). The gap points at my assumption that nobody was immune, not at the virus, and section 2.2 shows why the counts cannot correct it.
The counts are not a fixed sample either. The number of specimens tested rose from 12,544 to 44,884 a week across the window (middle panel), so more testing found more influenza, and the model’s single detection rate can only average over that. This is one season, one country and one data stream. The model has no age groups, no seasonality and no delay between infection and test, and the week-by-week forecasts use today’s revised counts, not the ones first published.
4.2 / The study
Behind the model.
This is an original study. The Warwick module Epidemiology by Example prompted the topic: its second worksheet fitted the same kind of model to a FluNet series. Nothing from that exercise, its data file or the coursework is used here. I downloaded the data afresh from WHO FluNet, took every prior from the published literature, and designed the questions, the checks and the forecasting test for this project.
What one season of influenza surveillance can and cannot tell us
Canada 2022/23 · 26 weekly counts · 59,554 detections of influenza A
The full report
The complete study as I wrote it up: the model, every check, all the results with their intervals, and the limitations.
Tools
Methods
- Deterministic SIR model fitted to weekly incidence
- Maximum likelihood with profile likelihoods
- Adaptive random-walk Metropolis sampling
- R-hat and effective sample size diagnostics
- Posterior predictive checks
- Forecast scoring with proper scoring rules
- Simulation study of interval coverage
What the study found
Within this model.
- The counts fix the early growth rate. The infectious period comes from the prior, and the reproduction number from the two together.
- The detection rate cannot be separated from the share of people who were susceptible.
- Forecasts of the season total became useful only around the peak.
- Poisson counts give narrow intervals that are wrong. Negative-binomial counts give wider ones that hold.
The data are from WHO FluNet, the virological database of the Global Influenza Surveillance and Response System, to which Canada’s Respiratory Virus Detection Surveillance System reports. WHO and Canada are the data owners, and the counts may be revised in later FluNet releases.