Arroyo-Marioli et al used a Kalman filter approach to estimate. I tried to reproduce in R. Let’s use a SIR model as was used in my previous post to generate growth rate time series.
Generate daily incidence assuming 100,000 population
I <-100000* (tudf$V3 +0.01) # true number of infected people at time tcase_daily <-rpois(length(I)-1, lambda=diff(I)) # observed number of infected people at t
gamma <-0.2# recovery rate, which is the same as p[2] in the ODE modelI_hat <-rep(NA, length(case_daily)+1) # true number of infected people at time tI_hat[1] <- I[1] # cheating, it's okay as this is the simulation check for (i in2:length(I_hat)) { I_hat[i] <- (1-gamma)*I_hat[i-1] + case_daily[i-1]}It <- I_hat # observed number of infected people at tn <-length(It)gr <- (It[2:n] - It[1:(n-1)]) / It[1:(n-1)] # observed growth ratet <-1:50R_true <-ifelse(t <20, 2, ifelse(t <40, 0.9, 1.4))gr_true <- gamma * (R_true -1)R_hat <- gr / gamma +1plot(R_hat, R_true[2:(length(R_hat)+1)], xlim=c(0,3), ylim=c(0,3), xlab="R_hat", ylab="R_true")abline(a=0, b=1)