An R(effective) Update

First time we’ve been above one for a while. The numbers have been rather odd lately – several days of reporting errors. It’s possible that this is a reflection of that, but the change in R for the 7-day average is harder to explain away.

Edit: today R(effective) for Germany went up again, and currently stands at 1.20. Not good news. This has, imo, been on the cards for a while. During the initial phase of the lockdown the decline in active cases (total number of infected minus recovered minus dead) was declining fairly linearly. You can see that clearly here:

(Been too busy / lazy to plot it out myself. The above is from the worldometers site, which is different dataset than RKI, but good enough for the purposes of this discussion.)

You can see that from around second week of May the incline on the graph changes, and starts to flatten out. This indicates that new infections are now being detected at the same rate as people are recovering. In recent days things have been close enough that small errors in reporting have seen the first upticks in active cases since shortly after the peak. Consequently it should come as no surprise that the R-effective number would be around 1. The total number (around 8500) is still declining, but much more slowly.

What really rankles is that had Germany stayed on it’s existing path for just a few more weeks the number of infections would have been down in the hundreds by now, certainly at a level where Track & Traceā„¢ would have been a sustainable strategy.

It’s not obvious what happens now. There is talk of degree of transmission being much lower outside (makes sense just with dispersion) and that warmer weather also helps. Whether this is enough to keep a lid on things until autumn is unclear. All of the cluster cases seem to be churches, or illegal indoor gatherings, which suggests that if people dont congregate indoors… there is a little hope.

Guess we’ll see… fingers-crossed.

A Little More R in R

Couple of things were bothering me:

  • the key wasn’t really a key it was a subtitle
  • the title needs a date
  • data wasn’t getting automatically downloaded
  • column naming was a mess
  • structure / formating of the ggplot was inconsistent

Sunday morning is the obvious time to fix such issues! Below is new plot, with a key, and built from data pulled from RKI.


And here is my updated script:


download.file("", "Nowcasting_Zahlen.xlsx")
nz_data <- read_excel("Nowcasting_Zahlen.xlsx", sheet = "Nowcast_R")
names(nz_data) <- c("date","new","new_under","new_over","new2", "new2_under", "new2_over", "R", "R_under", "R_over", "R7", "R7_under", "R7_over")
g <- ggplot(data = nz_data)
g <- g + geom_line(mapping = aes(x = date, y = R, color = "4 day"))
g <- g + geom_ribbon(mapping = aes(x = date, y = R, ymin = R_under, ymax = R_over), alpha = 0.3)
g <- g + geom_line(mapping = aes(x = date, y = R7, color = "7 day"))
g <- g + geom_ribbon(mapping = aes(x = date, y = R7, ymin = R7_under, ymax = R7_over), alpha = 0.5)
g <- g + ggtitle(label = sprintf("R-effective for Germany (%s)", format(Sys.Date(), format = "%b %d %Y")))
g <- g + ylab("R") + xlab("Date")
g <- g + scale_color_manual(values = c('4 day' = 'firebrick', '7 day' = 'darkblue'))
g <- g + labs(color = 'Average')

Now might be a good time to go outside and not think about this!

A Little R in R

As usually happens when learning something new, it gets pointed out that while i might have achieved my goal, there is a far cooler way of doing the same thing! In this case that would be R.


Now it seems a shame to have got this far into a career without ever having played around in R. The above is pretty close to the simplest plot posssible, but hey, it was fun!

Continue reading

R Numbers

A few days ago there was a post on /r/de showing a nice graph of now famous R number for Germany:


Exciting for a couple of reasons: that the data-set was available (i’d been looking for it for a while); the reported number was over 1 … which isn’t good.

The post linked to a .pynb script that had been used to produce the image. The code was obviously Python and somehow related to Jupyter Notebook – time to learn something new!

Since the original script was published the Excel spreadsheet download added a cover sheet, which obviously broke things. Having patched things up a little (and translated the labels to English), here is the updated plot:


One of the labels has gone missing… oops.

Update: the missing label was important! The above graph is for a new RKI dataset that tracks R on a 7 day average, the original series was too sensitive (see below). For “reasons” that series doesn’t include error estimates for the last data points, which broke calculation done on the final point. Below is a new plot on the 4 day averaged series – now really an update of the original image:


As you can see the R value for the original chart has been revised down, and the current value remains below 1. The brief bump up was attributed to the infection of slaughter house slave labour, housed in cramped shared dormitories. Come of Germany – be better than that!

Update: weekends are obviously good for tracking down datasets and visualizations! There is a GitLab project running model simulations on the regional data, below is the plot for Hamburg:


Having no background in epidemiology (or statistical analysis…) all i can do is accept it as presented, and note that it correlates well with the recent decline in reported new infections. The RKI made an interesting observation on the sensitivity of R the other day, noting that as the number of active cases (infections) fell any new hotspots (such as the slaughterhouse outbreaks) would have a larger impact on the reported number.