Code Monkey home page Code Monkey logo

covid19_ons_mortality's Introduction

ONS mortality

Project Status: [In progress]

Project Description

A descriptive analysis of trends in mortality using data from the Office for National Statistics (ONS). The R code can be used to recreate the analysis described in COVID-19 chart series and the Stata code can be used to recreate the analysis in our COVID-19 chart series analysis showing excess mortality.

Data source

This project uses publically available data that can be downloaded from the ONS website. The data were released with an Open Government Licence.

How does it work?

The R code provided downloads the data you need and cleans it. We have used the groupings provided by the ONS, summarised below.

  • Care homes includes homes for the chronic sick; nursing homes; homes for people with mental health problems and non-NHS multi function sites.
  • Deaths at home are those at the usual residence of the deceased (according to the informant)‚ where this is not a communal establishment.
  • Hospices include Sue Ryder Homes; Marie Curie Centres; oncology centres; voluntary hospice units; and palliative care centres.
  • Hospital includes acute or community, not psychiatric.
  • Other communal establishments include schools for people with learning disabilities; holiday homes and hotels; common lodging houses; aged persons’ accommodation; assessment centres; schools; convents and monasteries; nurses’ homes; university and college halls of residence; young offender institutions; secure training centres; detention centres; prisons and remand homes.
  • Elsewhere includes all places not covered above such as deaths on a motorway; at the beach; climbing a mountain; walking down the street; at the cinema; at a football match; while out shopping; or in someone else's home. This category also includes people who are pronounced dead on arrival at hospital.

The do file was written with Stata version 15. To run the whole code successfully, it is necessary to download and save all of the spreadsheets from 2010 to 2020. This can be done manually or using the R code provided. Running the code cleans and appends all of the data from the tabs called “Weekly figures 20**”. The final result should include a new dataset for all years with the following variables: all deaths; 5-years average of all deaths; respiratory disease deaths; COVID-19 deaths; deaths by age groups and gender; deaths by government office regions.

The final part of the code directly saves the data used to create the chart.

Requirements

The R scripts were written under R version 3.6.3 (2020-02-29) -- "Holding the windsock" and RStudio Version 1.2.5033. The following R packages (available on CRAN) are needed:

Functions from internal package, theme_THF() and scale_XXX_THF() can be removed or be replaced with eg theme_minimal().

The Stata code was written using Stata version 15.

Getting started

The 'src' folder contains

  • 0_download_data.R - Download weekly mortality data since 2010
  • 1_COVID_occurence_of_death.R - Clean and save data
  • 2_deaths_by_place_of_occurence.R - plot data on place of death
  • 3_daily_deaths_plot.R - plot daily deaths
  • 4_occupations_plot.R - plot death rates by occupation
  • ONS_deaths.do - clean mortality data over time

Authors

License

This project is licensed under the MIT License.

Acknowledgments

This builds on work by Zoe Turner - Github Twitter.

covid19_ons_mortality's People

Contributors

emmavestesson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.