How to calculate 14-day trends in COVID-19 infections and deaths in US States?

I'm trying to calculate 14-day trends in COVID-19 infections and deaths (as shown on the NYTimes homepage). I want to do this on a state level and have access to each state's population and daily data about the covid infections/ deaths in that state https://docs.google.com/spreadsheets/u/2/d/e/2PACX-1vRwAqp96T9sYYq2-i7Tj0pvTf6XVHjDSMIKBdZHXiCGGdNC0ypEU9NbngS8mxea55JuCFuua1MUeOj5/pubhtml#

What's the best way to calculate these 14-day trends? And is a 14-day trend the same as a rate?

• Hi there, you need to give us more information about your problem. What sort of trend do you want (e.g. 14 day rolling average?). What type of rate are you looking for? Jul 17, 2020 at 1:18

The easiest way to achieve this is to split your recent data into two time period: the recent data is that from 13 days ago to today. The previous data is that from 27 days ago to 14 days ago.

From both vectors of 14 data points, you generate an average which give 14-days averages for these numbers, giving you two numbers $$r$$ and $$p$$for the recent and previous periods, respectively.

The rate of change $$C$$ is the difference computed in percentage:

$$C = \frac {r -p }{p} \times 100$$

The trends that you see in that graph are sparklines.

You find some great examples on this blog post Sparkline theory and practice Edward Tufte.

Regarding covid infections, I believe that you should not provide data of only the last 14 days (much too few details) but instead a longer period. In that way, the reader will be able to see useful/meaningful differences, rather than just the noise that occurs on a 14 day period.