{"id":21625236,"url":"https://github.com/ohcnetwork/analytics","last_synced_at":"2025-03-18T19:55:03.344Z","repository":{"id":48357948,"uuid":"378675714","full_name":"ohcnetwork/analytics","owner":"ohcnetwork","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-17T04:41:51.000Z","size":811,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-10T23:16:22.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ohcnetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-20T15:15:12.000Z","updated_at":"2022-03-17T04:41:54.000Z","dependencies_parsed_at":"2022-08-24T14:49:46.974Z","dependency_job_id":null,"html_url":"https://github.com/ohcnetwork/analytics","commit_stats":null,"previous_names":["ohcnetwork/analytics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohcnetwork%2Fanalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohcnetwork%2Fanalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohcnetwork%2Fanalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohcnetwork%2Fanalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ohcnetwork","download_url":"https://codeload.github.com/ohcnetwork/analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243842095,"owners_count":20356608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T01:08:31.204Z","updated_at":"2025-03-18T19:55:03.314Z","avatar_url":"https://github.com/ohcnetwork.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is the effective reproduction rate of a pandemic, R\u003csub\u003et\u003c/sub\u003e ?\n\nThe effective reproduction rate of a pandemic, R\u003csub\u003e0\u003c/sub\u003e, is defined as is the average number of secondary cases per infectious case in a population made up of both susceptible and non-susceptible hosts. However, in COVID-19 pandemic, a static R0 does not adequately reflect the reality in time and space due to changes in social behaviors and restrictions. \n\nComputation of Rt for COVID-19 enables understanding how effectively a local or state government handles the pandemic and gives the authority helpful information in decision to loosen and tighten measures of social restrictions. As the pandemic spreads with great acceleration, R\u003csub\u003et\u003c/sub\u003e is much more larger than 1. On the contrary, when the pandemic slows down and dies out, Rt is smaller than 1 and approaches 0. This project focuses on computation of Rt for every state on the Kerala based on the number of new cases k reported daily by the state's Department of Health. The value of R\u003csub\u003et\u003c/sub\u003e is related to that of a day before R\u003csub\u003et-1\u003c/sub\u003e, and every previous value of n days before, R\u003csub\u003et-n\u003c/sub\u003e.\n\n# Simulating the effective reproduction number R\u003csub\u003eeff\u003c/sub\u003e\n\nWhen we derive the expression for the basic reproduction number R\u003csub\u003e0\u003c/sub\u003e in the simple SIR model: we get an epidemic only if $\\beta$/$\\gamma$ \u003e 1, i.e. if the average number of secondary cases caused by a single infected case in a totally susceptible population is greater than 1. As susceptibility declines over the course of the epidemic, the effective reproduction number R\u003csub\u003eeff\u003c/sub\u003e determines the shape of the epidemic curve as it reflects the amount of immunity in the population at any given time.\n\nIn a simple homogenous SIR model, R\u003csub\u003eeff\u003c/sub\u003e is directly related to the proportion of the population that is susceptible:\n\\begin{align}\nR_{eff} = R_{0} \\frac{S}{N}\n\\end{align}\n\nIn this  we model an epidemic and study the connection between the behaviour of R\u003csub\u003eeff\u003c/sub\u003e and the epidemic curve. We are looking at a closed fully susceptible population, into which a single infected person is introduced. \n\n### How does R\u003csub\u003eeff\u003c/sub\u003e vary over the course of the epidemic? What do you notice about the connection between the change in R\u003csub\u003eeff\u003c/sub\u003e and the epidemic curve over time? \n\nThe effective reproduction number is highest when everyone is susceptible: at the beginning, R\u003csub\u003eeff\u003c/sub\u003e = R\u003csub\u003e0\u003c/sub\u003e.  Over the course of the epidemic, R\u003csub\u003eeff\u003c/sub\u003e declines in proportion to susceptibility. \n\nThe peak of the epidemic happens when R\u003csub\u003eeff\u003c/sub\u003e goes down to 1. As R\u003csub\u003eeff\u003c/sub\u003e decreases further below 1, the epidemic prevalence goes into decline. \n\n## Algorithms used in this project\n\n### Bettencourt \u0026 Ribeiro\nWe will use the same approach outlined by Kevin in his article, which uses the paper [1] as its underlying basis.\n\n### Modeling arrivals\nThe first step is to model the 'arrival' process of infections. A popular choice for the distribution of arrivals amongst statisticians is the Poisson Distribution. Accordingly, if we let λ represent the average rate of infections per day, then the probability that we are likely to see k new cases on a day, is given by\n   \nP(k|λ) = λ\u003csup\u003ek\u003c/sup\u003e * e\u003csup\u003e−λ\u003c/sup\u003e / k!\n\nGiven this setup, we can construct the probability distribution of new cases for a set of λs.\n\n### Poisson likelihood\nModeling the arrival process as a Poisson distribution allows us to predict the distribution of new cases in a day as a function of the arrival rate λ. However, in reality, we only observe the number of arrivals. So the key question now is how do we go from the observed number of arrivals to get a sense of the distribution of λ. Thankfully, the answer to this question is simple.\n\nL(λ|k) = λ\u003csup\u003ek\u003c/sup\u003e * e\u003csup\u003e−λ\u003c/sup\u003e / k!\n\nThe distribution of λ over k is called the likelihood function, and it has the same mathematical expression as the probability mass function we used earlier. We can visualize the likelihood function by fixing the number of new cases observed (k), and computing the likelihood function over a range of values of λ.\n\n### Relating λ and Rt\nAccording to this paper by Bettencourt \u0026 Ribeiro, the relationship between arrival rate λ and effective reproduction rate is defined as follows:\n\nλ = k\u003csub\u003et−1\u003c/sub\u003e * e\u003csup\u003eγ(Rt−1)\u003c/sup\u003e\n\nNote that γ here is the reciprocal of the serial interval (about 4 days for COVID19), and k\u003csub\u003et−1\u003c/sub\u003e is the number of new cases observed in the time interval t−1.\n\nWe can use this expression for λ and reformulate the likelihood function in terms of R\u003csub\u003et\u003c/sub\u003e.\n\nL(R\u003csub\u003et\u003c/sub\u003e|k) = λ\u003csup\u003ek\u003c/sup\u003e * e \u003csup\u003e−λ\u003c/sup\u003e / k!\n\n## Dataset\nFor this project, we use the data from https://keralastats.coronasafe.live/histories.json page where daily counts of new COVID-19 cases are reported for every district in the state of Kerala. The data is then cleaned and wrangled in a proper dataframe containing the daily count of each district. We select Ernakulam to compute the district's effective reproduction rate of the COVID-19 pandemic, R\u003csub\u003et\u003c/sub\u003e. Every district's R\u003csub\u003et\u003c/sub\u003e can be computed at users' choice by modifying the vector districts in the Analytics markdown file.\n\n## Computation Steps\n\nThe process to compute Rt can be briefly described as follows:\n\n1. Import the all districts' daily counts to a dataframe\n2. Initialize a value of γ and a set of discrete values of R\u003csub\u003et\u003c/sub\u003e\n3. Select one or more states of interest\n4. Smooth out the daily counts to flatten the choppy data points\n5. Compute the log-likelihood distribution P(k|R\u003csub\u003et\u003c/sub\u003e)\n6. Compute the posterior P(R\u003csub\u003et\u003c/sub\u003e|k\u003csub\u003et\u003c/sub\u003e)\n7. Compute the estimate of R\u003csub\u003et\u003c/sub\u003e, including the most-likely, the max, and the min values of R\u003csub\u003et\u003c/sub\u003e\n8. Add Lockdown data to understand its impact\n9. Compute the Growth rate of the covid-19 cases \n\n\n# References\n[1] https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0002185\n\n[2] https://www.datacamp.com/community/tutorials/replicating-in-r-covid19\n\n[3] https://github.com/calldrj/COVID19.Effective.Reproduction.Rate\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohcnetwork%2Fanalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fohcnetwork%2Fanalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohcnetwork%2Fanalytics/lists"}