Skip to content

[R-sig-dyn-mod] SIR Model

3 messages · Daniel Kaschek, Simeon Lisovski

#
Hi Simeon,

you could define input functions

arrival <- function(t, tarrival, timespan, amount) {

	amount*dnorm(t, tarrival, timespan)

}

and analogously departure(). Then in your function mod, you would have

dM <- arrival(t, tarrival, timespan, amountComing) - departure(t,
tdeparture, timespan, amountLeaving)

tarrival, timespan, etc. are parameters in the parms vector.

You have to pay attention with the departure. In the above construction
M can become negative. This can be avoided by multiplying departure(t)
with M, e.g. dM = arrival - M*departure. In this case amountLeaving has
no longer the meaning of the number of persons leaving but reflects more
the velocity of the decay of M.

Hope this helps.

Best,
Daniel.
On Mon, 2012-10-22 at 19:09 +1100, Simeon Lisovski wrote:
#
Hi,
 thanks Daniel! 
Trying to implement the input functions
I realised the real problem. In the example 
I did not include for example mortality.
Sorry for that! 
This could be simply simulated 
as a rate (-my*M).

Using the input functions with M
I am not able to get rid of all Migrants 
(due to the decreasing size of M).
With this functions the amount of 
the start is important (first subtraction 
of Migrants) to end up with 0 Migrants.

Any ideas? Thanks!
Simeon
On 22/10/2012, at 7:27 PM, Daniel Kaschek wrote: