[R-sig-dyn-mod] (no subject) [WARNING: DKIM validation failed]

Setzer, Woodrow Setzer.Woodrow at epa.gov
Mon Apr 10 18:20:54 CEST 2017


Let S, I, and R represent the susceptible, infected, and recovered populations, respectively.
When you run, say, ode() on the function that provides the differential equations for your model, you get a matrix of output values (call it 'out') with columns time, S, I, and R.  One approach would be to do something like:

fn <- splinefun(out[,"time"], out[,"I"])

then, assuming you can determine lower and upper bounds, say: lower <- min(out[,"I"]); upper <- max(out[,"I"]). Check that upper is neither out[1,"I"] nor out[nrow(out),"I"]. Then,

root <- uniroot(fn, interval=c(lower, upper), deriv=1)

Then root$root is the time when the maximum occurs if fn(root$root, deriv=2) is negative, and fn(root$root, deriv=0) is the maximum.

Now, for your second question, define TI(t) as the total number of infected at time t. Add the equation

d TI / dt = I

to your ode system.

Woody Setzer

-----Original Message-----
From: R-sig-dynamic-models [mailto:r-sig-dynamic-models-bounces at r-project.org] On Behalf Of Emily Vachon
Sent: Saturday, April 08, 2017 2:31 PM
To: r-sig-dynamic-models at r-project.org
Subject: [R-sig-dyn-mod] (no subject) [WARNING: DKIM validation failed]

Hi Everyone,
I am working on an app that combines deSolve and Shiny to model a disease outbreak and vaccination strategies. Right now, I am producing a plot with three lines representing the susceptible, infected, and recovered populations. What I would like to do is find the maximum values for each of the populations (so, the local max of the graph produced by deSolve). I would also like to find the total number of people who become infected, which would involve finding the integral. Does anyone have any idea how to do either of those things in deSolve?
Thanks,
Emily

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-dynamic-models mailing list
R-sig-dynamic-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models



More information about the R-sig-dynamic-models mailing list