Estimate how fast a new dengue genotype takes over, with a logistic model fitted to sequence counts.
Published
October 24, 2026
When a new genotype arrives, the share of sequences that belong to it often follows an S-shaped curve. A logistic model fitted to monthly sequence counts sums up the takeover in one number: how fast the odds of sampling the new genotype grow each month.
This tutorial uses simulated data, so you can check that the model recovers a known answer. You’ll need dplyr and ggplot2.
1. Simulate sequence counts
Three years of monthly sequencing, about 40 sequences a month, with the new genotype reaching half of all sequences in month 18.
library(dplyr)library(ggplot2)set.seed(42)months <-0:35true_growth <-0.25seqs <-tibble(month = months,n =rpois(length(months), 40),new =rbinom(length(months), n, plogis(true_growth * (months -18))),old = n - new)head(seqs)
The model estimates a growth rate of 0.25 per month against a true value of 0.25. Each month, the odds that a sequence belongs to the new genotype multiply by about 1.29.
NoteWith real data
Sequencing is rarely random. Check how samples were chosen for sequencing before reading the slope as a fitness advantage, and if you pool several places, consider a random effect for location.