# EpiInfer: A Non-Markovian Method and System to Forecast Infection Rates in Epidemics
## 3 Materials and Methods
### Epilinfer-Core: Estimating Infection Rates from Basic Parameters  
For given transition probabilities \(p_{1}\), \(p_{2}\), average incubation period \(inc\), and statistical information in the form of a distribution of the number of people each person meets each day, the algorithm has several components to predict how many people will be infected on a given day \(d\), given the number of newly infected on previous days. Anyone who entered the infected/symptomatic state \(I\) at time \(d-i\), for some \(i\leq inc\), must have already been in the Exposed state at the start of time \(d-inc\). Thus, the probability \(palreadyexp_{d-inc}\) that an asymptomatic person is already in the exposed state at the start of time \(d-inc\) is  
\[palreadyexp_{d-inc}=(\sum_{i=1}^{inc}NewInf(d-i))/(p_{2}\cdot asymptomatic(d-inc)) \tag{1}\]  
where \( asymptomatic(d-inc)\) is the number who were asymptomatic at time \(d-inc\) (i.e., not in state \(I\)) and \(NewInf(d-i)\) is the number of people who enter the infected state on day \(d-i\). Thus, the probability \(palreadyexp_{d-inc}\) is proportional to the number who became infected since \(d-inc\) and inversely proportional to the whole population of the asymptomatic ones at \(d-inc\). The \(p_{2}\) divisor reflects the fact that not all who become exposed subsequently become infected, so if \(p_{2}\) is small, then few who become exposed later become infected. So, if a person y meets \(n_{y}\) people at time \(d-inc\), then y will meet approximately \(n_{y}\cdot\mathit{palreadyexp}_{d-inc}\) already exposed people. As a consequence, the probability that an asymptotic person y becomes exposed at \(d-inc\) is  
\[\mathit{pnewexposed}(d-inc,y)=1-(1-p_{1})^{n_{y}\cdot\mathit{palreadyexp}_{d- inc}}. \tag{2}\]  
To avoid double-counting the number of exposed people, we want to exclude those people who are already exposed at day \(d-inc\). There are \(\sum_{i=1}^{inc}NewInf(d-i)/p_{2}\) people who are already exposed as of that day. \(\mathit{asymptomaticNotEx}\) denotes those who are asymptomatic, not exposed, but who could be exposed. Therefore,  
\[ \begin{array}{l}\mathit{asymptomaticNotEx}(d-inc)=\mathit{asymptomatic}(d-inc)\\ -(\sum_{i=1}^{inc}NewInf(d-i)/p_{2})-(\mathit{recovered}(d-inc)).\end{array}  \tag{3}\]  
The last term reflects the fact that recovered people have immunity for a certain period of time. So, we subtract the number of recovered people at time \(d-inc\) from those who could be exposed. So, the expected number of newly exposed people at \(d-inc\) is  
\[\mathit{NewExposed}(d-inc)=\sum_{y\text{ }in\text{ }asymptomaticNotEx(d-inc)}\mathit{pnewexposed}(d-inc,y) \tag{4}\]  
where \(\mathit{pnewexposed}(d-inc,y)\) is given by Equation (2) and \(\mathit{asymptomaticNotEx}\) is given by Equation (3). To predict the number of newly infected people at time d we multiply the predicted number of newly exposed people at \(d-inc\) by \(p_{2}\):  
\[NewInf(d)=NewExposed(d-inc)\times p_{2} \tag{5}\]  
Algorithm 1 shows the pseudocode that reflects the above reasoning. ```
1:functionsim(\(p_{1}\), \(p_{2}\))
2: Compute the probability of being exposed as of time \(d-inc\) Equation (1). 3: Compute the probability that a given susceptible individual \(y\) who meets \(n_{y}\) other asymptomatic people will be exposed at time \(d-inc\) Equation (2). 4: Compute an approximate number of those who are asymptomatic, not exposed, but could be exposed Equation (3). 5: Compute the number of newly exposed people at \(d-inc\) Equation (4). 6: Return the prediction of newly infected people at time \(d\) by multiplying the number of newly exposed people at time \(d-inc\) by \(p_{2}\) Equation (5). 7:endfunction
```  
**Algorithm 1**_EpiInter-core_: Estimating Infection Rates, given meeting distribution information and guesses for \(inc\), \(p_{1}\), \(p_{2}\). In summary, the goal of Algorithm 1_EpiInter-core_ is to estimate the number of people who will be newly infected at time \(d\).