# How are epidemic models simulated in case of mobility?

I don't know whether this is a pure statistics, math or programming question so kindly let me know if there is a better place to post this question.

I am trying to implement the SIS epidemic model when the nodes have mobility. I understand how to perform this simulation in an analytical fashion. However, things get rather confusing when nodes are mobile.

The model assumes that each node can infect any node and hence the equations are valid. But when nodes are mobile, each node is not able to infect every other node (the other node might not be within the range) and has to explicity send a message to a node that is susceptible in order to infect it. In that case, give an infection rate B, how do I simulate this when the nodes are mobile?

Currently, the way I am doing this is in the following way:

def Controller():
for i in range(1,100):
randNum = getRand()
if (randNum <= InfectionRate):
neighbors = getNeighbors(i)
ScheduleTransmission(getCurrentTime(), i, neighbors)
Schedule(getCurrentTime() + 1, Controller)


My problem is that I am not understanding if the infection rate can now be captured through a single value (which was previously B). If not, how does one analyze this scenario? Do I set the InfectionRate as B/numNodes so that the overall probability will be B? Any suggestions?

UPDATE: Back calculating Beta and improved infection strategy

def Controller():
for i in range(1,100):
neighbors = getNeighbors(i)
k = len(neighbors)
for j in neighbors:
beta = -k log(1-c)
if (beta <= InfectionThreshold):
ScheduleTransmission(getCurrentTime(), i, j)
Schedule(getCurrentTime() + 1, Controller)

• I do a fair number of epidemic simulations for my work, but odds are you'll be better served on one of the math sites. I'm giving my take, but it might be a better question for elsewhere. – Fomite Oct 4 '11 at 0:27
• @EpiGrad: I asked it at a few other places. I will delete this question once I get an acceptable answer. I see from your profile that you seem to be quite familiar with this area. In the mean time, would you have any suggestions about this? Also a slightly unrelated question, is there an epidemiology community somewhere where I can go ask such questions? Thanks! – Legend Oct 4 '11 at 0:33
• As for the community, no, there really isn't one. The statistics site here is probably the closest, with occasional forays into StackOverflow etc. when you need it. By coincidence however, I am trying to start one...area51.stackexchange.com/proposals/34565/… – Fomite Oct 4 '11 at 0:41
• @EpiGrad: Thank You for taking the initiative. I started following it :) Would really love it to become an actual site. – Legend Oct 4 '11 at 0:45
• can you provide a possible explanation for choosing this particular form "beta = -k log(1-c)" ? – Guest Mar 29 '17 at 10:19

beta = -k log(1-c), where k is the average number of contacts per unit time, and c is the probability of successful transmission (Keeling and Rohani, 2008). Most models that don't assume homogeneous mixing - like the ones you are currently talking about - don't bother with beta, and just directly estimate k and c, and compute whether or not an individual has been infected from that (i.e. Did node come in contact with an infected node? If yes, was transmission successful? If yes, node is infected). Note that you can tinker with these numbers until you get an estimated beta that is equal to the beta of your compartmental model, but because of stochasticity, it will never be quite the same.
• +1 Very interesting. Yes I was referring to Beta by B and as a starting point I am using a Random Waypoint mobility model for the nodes. From what I understand, I should not be using Beta but instead be estimating k and c. In this case, I should probably be setting c instead of B. However, isn't k different for each node at each point in time? Oh.. so what you are saying is that k should be estimated instantaneously on a per node basis and from there beta can be estimated. This can then be used as the threshold? Am I understanding this correctly? Thanks! – Legend Oct 4 '11 at 0:41
• Oh... that "used as the threshold" refers to InfectionRate in my code which is the infection threshold (if beta is beyond this then the node can successfully infect the other node). I accepted this as the answer. One final request is perhaps if you could take a look at my updated code in my question. So now the probability of a node infecting its neighbors is just dependent on k and c. I am not sure if I am doing the thresholding right i.e. if beta <= InfectionThreshold in my code. – Legend Oct 4 '11 at 1:15