# COVID-19 Plots and analysis relating to the pandemic 1) *Cases*
[English LA Heatmaps.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/English%20LA%20Heatmaps.R) generates heatmaps and animated maps showing English Upper Tier Local Authority trajectories in both confirmed COVID-19 cases and estimated COVID-19 deaths (in hospitals only) inspired by similar plots for US states from [@Marco_Piani](https://twitter.com/Marco_Piani). The approach to modelling deaths, which are only published at NHS trust level, was developed by [@Benj_Barr](https://twitter.com/Benj_Barr). The code also generates a map of Local Authority-level changes in case numbers in the past week and animated maps of both case and death counts.

[COVIDCaseCartograms.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCaseCartograms.R) creates a series of cartograms based on [the excellent templates](https://t.co/rIej2uTt5D) created by [@carlbaker](https://twitter.com/carlbaker) showing COVID case rates across the UK. [COVIDCasesLTLAPhasePlot.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCasesLTLAPhasePlot.R) uses [an approach](https://twitter.com/jburnmurdoch/status/1339646913436676098) borrowed from [John Burn-Murdoch](https://twitter.com/jburnmurdoch) to look at the current picture of Local Authority-level cases and whether they are accelerating or decelerating. [COVIDLineages.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDLineages.R) Plots data from the Wellcome Sanger Institute to look at the spread of different COVID variants over time in UK regions.

[COVIDLACaseData.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDLACaseData.R) generates similar outputs, including for hospital admissions, at Lower Tier Local Authority level. I've written about these plots in [an article](https://t.co/zNCrpC0wMw?amp=1) for the journal [People, Place and Policy](https://extra.shu.ac.uk/ppp-online/). [COVIDTestingData.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDTestingData.R) analyses testing rates and positivity, although this analysis is now less relevant since the wider rollout of LFD tests, as it mostly focuses on PCR test data.

[COVIDCFRs](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCFRs.R) uses Case Fatality Rates estimated by [Daniel Howdon](https://medicinehealth.leeds.ac.uk/medicine/staff/447/dr-dan-howdon) to look at how these have changed over time, particularly in relation to the vaccine rollout. [COVIDCasesvsCFR.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCasesvsCFR.R) extends this to estimate the mortality burden associated with the current caseload in English Local Authorities and how this has changed over time as case numbers and the age profile of cases has shifted.

[Scottish HB Heatmaps.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/Scottish%20HB%20Heatmaps.R), [Welsh LA Heatmaps.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/Welsh%20LA%20Heatmaps.R), [Irish County Heatmaps.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/Irish%20County%20Heatmaps.R), [German State Heatmaps.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/German%20State%20Heatmaps.R) and [COVIDCanadaHeatmap.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCanadaHeatmap.R) produce equivalent case trajectory plots for Scottish Health Boards, Welsh Local Authorities, Irish Counties, German Bundesländer and Canadian Provinces respectively.

[COVIDMSOACaseRatexIMD.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDMSOACaseRatexIMD.R) looks at socioeconomic differences in case rates and how they have changed in recent weeks, while [COVIDBivariateCasesxIMD](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDBivariateCasesxIMD.R) looks at associations between COVID case rates and deprivation in London and Glasgow.

[COVIDPHESurveillance.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDPHESurveillance.R) and [COVIDPHESurveillance2.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDPHESurveillance2.R) provide analysis of the PHE Surveillance reports, including case data and positivity rates by age, although these have largely been replaced by [COVIDPHECasesxAgev2](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDPHECasesxAgev2.R) which generates similar plots now that age-specific case data at Local Authority level is published as part of [the PHE dashboard](http://coronavirus.data.gov.uk). [ONSInfectionSurvey](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/ONSInfectionSurvey.R) produces similar graphs for the ONS' random sampling infection survey. [ScotlandCOVIDCasesxAge.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/ScotlandCOVIDCasesxAge.R) performs some similar analysis of case data by age for Scotland, alongside analysis of cases and deaths by deprivation quintile. [COVIDAgeTrends.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDAgeTrends.R) takes data on COVID cases, admissions and deaths and separates the trends out by age, to help identify potential impacts of the vaccination programme.

[ScotlandCOVIDHouseParties.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/ScotlandCOVIDHouseParties.R) is a small piece of analysis looking at data from Scotland on regulation-breaching house parties. Finally, [COVIDPillars.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDPillars.R) is another, obsolete, approach using older, pre-dashboard API, data to separate out case trajectories by testing pillar, while [Misc Case Analysis.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/Misc%20Case%20Analysis.R) is a collection of various quick plots related to various aspects of case data.

*Hospital admissions*
[COVIDNHSAdmissions.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDNHSAdmissions.R) analyses hospital admissions, occupancy and ventilator bed use across England. [UK Hex Animation.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/UK%20Hex%20Animations.R) uses this data to generate an animated hex map of COVID-19 cases across the UK & Ireland, built on various excellent hex map resources from [@ODILeeds](https://twitter.com/ODILeeds) and [@olihawkins](https://twitter.com/olihawkins). [COVIDNHSBolton.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDNHSBolton.R) uses the same analysis, but focusing on Bolton specifically.

[COVIDCycle.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCycle.R) visualises data on COVID-19 hospital admissions and deaths (using deaths within 24 days of a positive test, rathern than death certificate data) using [an approach](https://twitter.com/maartenzam/status/1319622943526293505) taken from [Maarten Lambrechts](https://twitter.com/maartenzam). [COVIDCycleUS](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCycle_US.R) produces similar plots for the US as a whole and for individual states.

[COVIDAdmissionsLTLTPhasePlot.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDAdmissionsLTLAPhasePlot.R) uses [an approach](https://twitter.com/jburnmurdoch/status/1339646913436676098) borrowed from [John Burn-Murdoch](https://twitter.com/jburnmurdoch) to look at the current picture of trust- and Local Authority-level hospital admissions. [COVIDHFRs.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDHFRs.R) looks (fairly simplistically) at the association between hospital admissions and deaths in hospitals in England.

*Vaccinations*
[COVIDVaccinations.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaccinations.R) creates graphs of the UK rollout of COVID vaccines, while [COVIDVaccinationMSOACartogram](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaccinationMSOACartogram.R) plots maps of the geographic distribution of vaccinations in England and analyses the socioeconomic inequalities in this. [COVIDBivariateCasesxVax]https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDBivariateCasesxVax.R) looks at associations between COVID vaccination rates and deprivationacross England. [COVIDVaccinationStaffCartogram.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaccinationStaffCartogram.R) looks at vaccine coverage among health and social care staff. [COVIDVaccinationInequalityGB.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaccinationInequalityGB.R) uses rather patchy data on vaccine delivery by deprivation and age to look at how inequality in delivery varies between GB nations, by age and how this has changed over time. [COVIDVaxUptakexAge.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaxUptakexAge.R) plots cumulative uptake of vaccinations by age in England

[COVIDCasesxVaxTadpoles](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDCasesxVaxTadpoles.R) generates a tadpole plot showing how current COVID cases at Local Authority and MSOA level relate to current vaccination rates. [COVIDPHEVaxxAgexSex.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDPHEVaxxAgexSex.R) uses weekly data on vaccination coverage from the PHE Surveillance report to plot an age pyramid of vaccination coverage. [COVIDVaxPyramidxRegion.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaxPyramidxRegion.R) attempts to replicate theis at a regional level, while [COVIDVaccinationAnimations.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDVaccinationAnimations.R) creates an animated version to show the progress of vaccination coverage over time. Finally, [YorkshireVaxCartogram.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/YorkshireVaxCartogram.R) produces Yorkshire-specific analyses of vaccination coverage.

*Apps*
I've also made a few apps to allow you to explore local and national COVID-19 data. [One](https://victimofmaths.shinyapps.io/COVID_LA_Plots/) for mortality, cases and admissions data, [one](https://victimofmaths.shinyapps.io/COVID_Cases_By_Age/) for case data stratified by age and [another](https://victimofmaths.shinyapps.io/COVID_Case_Trends_By_Age/) which compares trends in recent age-specific case data. ![Cases heatmap](https://github.com/VictimOfMaths/COVID-19/blob/master/Heatmaps/COVIDLACasesHeatmap.png) 2) [AllCauseDeaths2021.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/AllCauseDeaths2021.R) harmonises weekly all-cause mortality data from England & Wales (from ONS), Scotland (from NRS) and Northern Ireland (from NISRA) and draws plots comparing deaths in 2020 so far to the previous decade, split by age, sex and region inspired by a plot from [@EdConwaySky](https://twitter.com/EdConwaySky). This replaces a previous (2020) version of [the same file](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/AllCauseDeaths.R) and now includes Scotland and Northern Ireland which were previous in separate code files: [ScottishAllCauseDeathsDetail.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/ScottishAllCauseDeathsDetail.R) uses richer data published by NRS to look at patterns in excess mortality in Scotland by place of death, Health Board area and age. [NRS Excess Deaths by Cause.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/NRS%20Excess%20Deaths%20by%20Cause.R) produces graphs of excess deaths in Scotland by cause and location of death.

[All Cause Deaths France.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/All%20Cause%20Deaths%20France.R) uses detailed French all-cause mortality records published by [Insee](https://www.insee.fr/fr/statistiques), the French statistical authority, to examine age-specific excess deaths in France and [All Cause Deaths Italy.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/All%20Cause%20Deaths%20Italy.R) does the same for Italy using data from [ISTAT](https://www.istat.it/en/).
[AllCauseDeathsxAge.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/AllCauseDeathsxAge.R) brings these together and extends this analysis using data from the UK and international data from the [Human Mortality Database](https://www.mortality.org/).

I've made [an app](https://victimofmaths.shinyapps.io/COVID_LA_Plots/) which you can use to generate excess deaths plots by Lower Tier Local Authority for every area in Great Britain. All code and data for this lives [here](https://github.com/VictimOfMaths/COVID_LA_Plots).

I've also created [a separate app](https://victimofmaths.shinyapps.io/COVID_Reg_Delays) to allow you to explore registration delays in English and Welsh mortality data from ONS. All code and data for this lives [here](https://github.com/VictimOfMaths/COVID_Reg_Delays).

[COVIDCareHomeDeaths.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/COVIDCareHomeDeaths.R) analyses additional data published by the ONS for England based on notifications from the Care Quality Commission of deaths of care home residents.

[COVIDDeathsxRegion.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/COVIDDeathsxRegion.R) produces plots of regional trends in COVID mortality in England based on the 28-day measure of mortality. [MSOA Deaths.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/MSOA%20Deaths.R) takes mortality data from England & Wales at Middle Super Output Area level and from Scotland at Intermediate Zone level and maps it, ready for 3D visualisation using [Aerialod](https://ephtracy.github.io/index.html?page=aerialod).

[COVIDAgeMortPred.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/COVIDAgeMortPred.R) uses age-specific Case Fatality Ratios estimated by [Daniel Howden](https://twitter.com/danielhowdon) to estimate the future burden of mortality from COVID-19 infections that have already been identified (i.e. the total number of deaths we'd expect in England over the next few months *assuming there were no further infections*).

[LA All Cause Deaths.R](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/LA%20All%20Cause%20Deaths.R) calculates excess mortality at Local Authority level from ONS figures. ![Excess deaths](https://github.com/VictimOfMaths/COVID-19/blob/master/All%20Cause%20Mortality/ONSNRSNISRAWeeklyDeathsxReg.png) 3) [Exposure Mapping](https://github.com/VictimOfMaths/COVID-19/tree/master/Exposure%20mapping):
[COVIDExposures.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Exposure%20mapping/COVIDExposures.R) brings together data on health deprivation and estimates of the potential COVID-19 mortality risk based on the age-sex structure of the population (following the approach developed by [@ikashnitsky](https://twitter.com/ikashnitsky) and [@jm_aburto](https://twitter.com/jm_aburto)) at Lower Super Output Area level and plots bivariate maps highlighting areas with the greatest potential COVID-19 risk. I also made a Shiny app which creates slightly lower resolution versions of the same plots online, which you can find [here](https://victimofmaths.shinyapps.io/covidmapper/), and wrote about these maps for the UK Data Service's [Impact and Innovation blog](http://lab.ukdataservice.ac.uk/2020/05/21/visualising-high-risk-areas-for-covid-19-mortality/). ![Bivariate map](https://github.com/VictimOfMaths/COVID-19/blob/master/Exposure%20mapping/COVIDBivariateLondon.png) 4) [Initial Inequality Estimates](https://github.com/VictimOfMaths/COVID-19/tree/master/Initial%20Inequality%20Estimates):
[Estimated Cases By IMD.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Initial%20Inequality%20Estimates/Estimated%20Cases%20by%20IMD.R) takes published figures on confirmed COVID-19 cases by Local Authority in England and maps that onto quintiles of the Index of Multiple Deprivation, then plots a variety of case trajectories by deprivation quintile as well as a map of confirmed case rates. ![Quintile plot](https://github.com/VictimOfMaths/COVID-19/blob/master/Initial%20Inequality%20Estimates/COVIDQuintilesLonRate.png) 5) [Observed Inequality](https://github.com/VictimOfMaths/COVID-19/tree/master/Observed%20Inequality):
[ONS Deaths Ineq.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Observed%20Inequality/ONS%20Deaths%20Ineq.R) takes data that ONS have published for England on deaths from COVID-19 and other causes between 1st March-17th April and illustrates socioeconomic inequalities in the impact of the pandemic.

[ONS DeathsIneq 2.R](https://github.com/VictimOfMaths/COVID-19/blob/master/Observed%20Inequality/ONS%20Deaths%20Ineq%202.R) brings in historical data on socioeconomic inequalities in all-cause deaths to compare the inequality impacts of the pandemic on mortality to historical levels of inequality. ![Inequality plot](https://github.com/VictimOfMaths/COVID-19/blob/master/Observed%20Inequality/COVIDIneqRate.png) Anyone is free to use any of this code for any purpose (except for evil).
Suggested citation for any of this analysis or associated visualisations:
Angus, Colin (2021): CoVid Plots and Analysis. The University of Sheffield. Dataset. https://doi.org/10.15131/shef.data.12328226