首页 > > 详细

辅导ECON 467解析R语言程序、R辅导、辅导R

ECON 467 Final Project
Ivan Korolev∗
Due Date: by the end of day on May 11, 2020
Reminder: Collaboration in allowed. However, you are required to work out details by
yourself. Identical assignments are not allowed and will be penalized. Late answers cannot
be accepted.
In this project, you will learn how to simulate the SEIRD epidemic model and estimate
its parameters from the data. It will consist of several parts.
In order to simulate SIR-type models in R, you need to install an appropriate package. I
use deSolve, and to install it on my Mac I had to follow these steps:
(a) Download GNU Fortran for Mac here: https://cran.r-project.org/bin/macosx/
tools/
(b) Download Xcode here: https: //apps.apple.com/us/app/xcode/id497799835?mt=12
After that, I was able to install deSolve with the usual install.packages command.
You can use other packages, such as EpiDynamics or shinySIR, if you prefer. Install your
preferred package. Let me know if you have any issues.
Total: 100 points
1. (20 points) In this part you will code the SEIRD (Susceptible, Exposed, Infectious,
Recovered, Dead) model in R. Your model should include the following parameters:
γ - the inverse of the time to recovery. You can use γ = 1/10.
σ - the inverse of the length of infectious period. You can us σ = 1/4.
α - the case fatality ratio.
r0 - the basic reproduction number.
The initial values are I(0) = 0, E(0) = 1, D(0) = 0, R(0) = 0, S(0) = N −
I(0) − E(0) − R(0) − D(0). N is the population size. You can code your model
∗Department of Economics, Binghamton University. E-mail: .
1
in population shares or in numbers. You can take the population numbers from
https://population.un.org/wpp/Download/Standard/Population/ and https://
www.census.gov/data/tables/time-series/demo/popest/2010s-state-total.html,
from Wikipedia, or from other sources.
Write a code that takes α and r0 as inputs and simulates the SEIRD model. The
output should include 5 time series: S(t), E(t), I(t), R(t), D(t). Simulate your model
for r0 = 5 and α = 0.005 for T = 360 periods. Plot the results.
2. (20 points) Download the data on the number of deaths from COVID-19 for one
country, one state of the US, and one county. The country level data is available
at https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_
data/csse_covid_19_time_series. The state and county level data is available at
https://github.com/nytimes/covid-19-data.
Using your code above that simulates the SEIRD model, write a function that fits the
model to the data by minimizing the RSS. You can do it as follows: write a function
that computes the RSS (sum of squared differences between the number of deaths in
the model D(t, r0, α) and in the data D(t)) for the fixed values of r0 and α and for time
series data on deaths. Then find the parameters that minimize the RSS.
3. (20 points) Estimate the model for your selected country, state, and county. Report
the estimated parameters. Plot the model fit, i.e. fitted values and actual deaths
against time. Simulate the model into the future.
Note: you may want to restrict your sample to the observations before social distancing
took place, as it might have affected the value of r0.
4. (20 points) Change the initial values, e.g. to I(0) = 0, E(0) = 3 or to some other
values, and re-estimate your model. Plot the results and compare them with those in
the previous part.
5. (20 points) Now try simulating your model into the future with changing R0. For
instance, if you have estimated your model using the first T0 observations, you could
set the resulting values S(T0), E(T0), I(T0), R(T0), D(T0) as initial values of the new
model and simulate it with different parameter values. You could try to simulate your
model with r0 = 0.5rˆ0 and r0 = 0.25rˆ0, where rˆ0 is your estimate of r0 from the previous
parts.
Plot the simulated path of the model. Compare it with those in the previous parts.
How does a decrease in r0 affect your results?

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!